-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fixes Backported from v22 #36245
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?
Fixes Backported from v22 #36245
Conversation
use of "MAIN_CHECKBOX_LEFT_COLUMN" fix calculation of best supplier price
Dolibarr#36245 use of "MAIN_CHECKBOX_LEFT_COLUMN" fix calculation of best supplier price
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.
Pull Request Overview
This PR backports two fixes from v22: (1) support for the MAIN_CHECKBOX_LEFT_COLUMN configuration to move action/checkbox columns to the left side of tables, and (2) correction of the best supplier price calculation to properly account for discounts when finding the minimum price.
- Added support for
MAIN_CHECKBOX_LEFT_COLUMNconfiguration option to position action columns on the left side of supplier price tables - Fixed best supplier price calculation to compare discounted unit prices instead of base unit prices
- Added explicit float casts to price calculations for better type safety
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| htdocs/product/fournisseurs.php | Implements conditional rendering of action/checkbox columns based on MAIN_CHECKBOX_LEFT_COLUMN configuration, allowing columns to appear on either left or right side of the supplier prices table |
| htdocs/fourn/class/fournisseur.product.class.php | Fixes supplier price comparison logic to use $fourn_unitprice_with_discount instead of $fourn_unitprice, ensuring discounts are properly considered when finding the minimum price |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { | ||
| print '<td class="center nowraponall">'; | ||
| if ($usercancreate) { | ||
| print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.((int) $object->id).'&socid='.((int) $productfourn->fourn_id).'&action=edit_price&token='.newToken().'&rowid='.((int) $productfourn->product_fourn_price_id).'">'.img_edit()."</a>"; |
Copilot
AI
Nov 13, 2025
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.
The action parameter should be update_price instead of edit_price. The correct action is update_price as shown in the right column implementation (line 1314) and as handled by the form processing logic (line 474 where $action == 'update_price' is checked).
| print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.((int) $object->id).'&socid='.((int) $productfourn->fourn_id).'&action=edit_price&token='.newToken().'&rowid='.((int) $productfourn->product_fourn_price_id).'">'.img_edit()."</a>"; | |
| print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.((int) $object->id).'&socid='.((int) $productfourn->fourn_id).'&action=update_price&token='.newToken().'&rowid='.((int) $productfourn->product_fourn_price_id).'">'.img_edit()."</a>"; |
|
i'm sorry @SylvainLegrand but we can't accept that PR : please split your contribution in two parts: one for MAIN_CHECKBOX_LEFT_COLUMN and an other one for calculation of best supplier price thanks, |
use of "MAIN_CHECKBOX_LEFT_COLUMN"
fix calculation of best supplier price