-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
FIX: TakePos sometimes thirdpartyid = undefined #36343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
Conversation
htdocs/takepos/index.php
Outdated
|
|
||
| // Only show products for sale (tosell=1) | ||
| let socid = jQuery('#thirdpartyid').val(); | ||
| if ((socid === undefined || socid === "") && parseInt("<?= $socid ?>") > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use of <?= is forbidden
Must use <?php echo for better compatibility and security
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I corrected it, but why is it forbidden ? According to the PHP documentation, both uses are exactly the same since PHP 5.4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I corrected it, but why is it forbidden ? According to the PHP documentation, both uses are exactly the same since PHP 5.4.
Several reason mentionned into wiki:
PHP code section must start with '''<?php''' (the "smart tags" <? or <?=, also known as the "short tags", depend on php configuration option '''short_open_tag''' even if this is no more true after php5.4. The use of <? can still have conflict with XML syntax. The smartags may not be supported by all IDE. Also, the use of <?= make easier for a hacker to make PHP injection. To fight this, some Dolibarr components, like the website PHP editor, accepts only full php tags to detect, parse and filter PHP. Finaly, using the same tag everywhere make also easier to make code scanning or impact analysis when we are sure of the tags that is used, and the best solution, to be sure of which tag is used, is to use one, only one and the same tag everywhere.
Linked to 36341
Sometimes jQuery('#thirdpartyid').val() is undefined because the input is described in takepos/invoice.php.
But it needs to be defined before, to prevent wrong price to be fetched in case of multilevel prices.