webERP v4.15.2 Typo Error in GLTags.php #232
Replies: 5 comments
-
Hi Ricard, inside an echo statement commas and full stops are
interchangeable though we should at least be consistent within one
line of code!
PHP processes the commas marginally more efficiently than the full
stops, so my preference is to change them all to commas.
Thanks
Tim
…On Wed, 13 Nov 2024 at 02:16, pakricard ***@***.***> wrote:
Hi all:
Line 53 of GLTags.php reads
<img src="'.$RootPath, '/css/', $Theme, '/images/maintenance.png" title="' .
and should read
<img src="'.$RootPath. '/css/'. $Theme. '/images/maintenance.png" title="' .
I guess a typo error of typing a comma instead of a period.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
--
www.weberp.org
@TimSchofield2
Blog: https://kwamoja.home.blog/
|
Beta Was this translation helpful? Give feedback.
-
Iiuc (and I'm far from what I would call a competent PHP programmer), commas seperate arguments and periods concatentate strings. In this situation, even if using either produced the same results, imho a period would better convey the intent of concatenating sub-strings to create a full path. Here's a related discussion, although the popular example used to demonstrate why one is faster than the other is when echo'ing text https://stackoverflow.com/questions/1466408/difference-between-period-and-comma-when-concatenating-with-echo-versus-return @pakricard were you troubleshooting an issue when you noticed this? |
Beta Was this translation helpful? Give feedback.
-
Hi Dale, you are right. echo is a function call so can take a series of
arguments, or one concatenated string, or as in this case a mixture. PHP
has always been slow at concatenating strings (though more modern releases
may be better) which is why I always believed commas were best. However I
don't really believe anybody could actually tell the difference in speed
except in a script doing thousands of echo calls.
Not an issue I am that worried about, but we should be consistent, so if
others prefer I am quite happy to go with full stops.
Tim
…On Wed, 13 Nov 2024 at 15:53, Dale Scott ***@***.***> wrote:
Iiuc (and I'm far from what I would call a competent PHP programmer),
commas seperate arguments and periods concatentate strings. In this
situation, even if using either produced the same results, imho a period
would better convey the intent of concatenating sub-strings to create a
full path.
Here's a related discussion, although the popular example used to
demonstrate why one is faster than the other is when echo'ing text
https://stackoverflow.com/questions/1466408/difference-between-period-and-comma-when-concatenating-with-echo-versus-return
@pakricard <https://github.com/pakricard> were you troubleshooting an
issue when you noticed this?
—
Reply to this email directly, view it on GitHub
<#232 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAL6LFJARIV4IESGULJNT32ANYXNAVCNFSM6AAAAABRVMENUOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMRUGIZTGMI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi, Tim and Dale: Regarding this particular line of code, I didn't find any error, but in my ignorance I assumed that echo only could concatenate with periods, not commas. My two cents:
As an example, I found a big speed improvement by creating PERSISTENT fields for repetitive calculations. In stockmaster table, adding the field:
made a real difference across webERP, as we are using the expression (materialcost+labourcost+overheadcost) many times in many scripts and having it precalculated saves time. Anyway, I am just a small contributor, and the leaders of the project have more profound knowledge and whatever is decided, will be OK with me. Ricard |
Beta Was this translation helpful? Give feedback.
-
Hi Ricard,
If memory serves me correctly you provided the petty cash module along
with many other fixes, so not a "small contributor" :)
I would be happy to include the DB optimisations you mention. Perhaps
you could send them all as one contribution?
The only downside I have found to using commas is that if later we
change that line from being an echo to something else - for instance
assigning the string to a variable - then the commas don't work.
So having said that, unless there are any strong feelings I will
revert to using the full stop (period). However I think I will just
update these as I find them, rather than a wholesale change. That is
unless someone else wants to take on the job :)
Thanks
Tim
…On Wed, 13 Nov 2024 at 23:00, pakricard ***@***.***> wrote:
Hi, Tim and Dale:
I am bringing my v4.13.1 (with over 140 customized scripts) up to date to v 4.15.2, to get ready for the anticipated v5 and PHP 8. So I am revising all scripts and keep finding small issues, mainly notices, deprecated, etc kind of stuff.
Regarding this particular line of code, I didn't find any error, but in my ignorance I assumed that echo only could concatenate with periods, not commas.
My two cents:
webERP is not a highly optimized code, from my perspective. It tends to be easy to read, but to be more efficient we could save on SQL queries here and there, keeping more data on memory variables, avoid repeated code encapsulating in functions, optimizing DB setup, etc.
Nowadays, saving a few microseconds here and there on the server side is less relevant than having an easy to maintain and clear code, or having a high-speed internet.
So, to keep clear code, I think we should keep echo sentences with periods or commas, but not mixed.
As an example, I found a big speed improvement by creating PERSISTENT fields for repetitive calculations. In stockmaster table, adding the field:
actualcost decimal(20,4) AS (materialcost+labourcost+overheadcost) PERSISTENT`
made a real difference across webERP, as we are using the expression (materialcost+labourcost+overheadcost) many times in many scripts and having it precalculated saves time.
Anyway, I am just a small contributor, and the leaders of the project have more profound knowledge and whatever is decided, will be OK with me.
Ricard
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
--
www.weberp.org
@TimSchofield2
Blog: https://kwamoja.home.blog/
|
Beta Was this translation helpful? Give feedback.
-
Hi all:
Line 53 of GLTags.php reads
<img src="'.$RootPath, '/css/', $Theme, '/images/maintenance.png" title="' .
and should read
<img src="'.$RootPath. '/css/'. $Theme. '/images/maintenance.png" title="' .
I guess a typo error of typing a comma instead of a period.
Beta Was this translation helpful? Give feedback.
All reactions