Skip to content

Conversation

@SylvainLegrand
Copy link

Dolibarr#36245
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
Copilot AI review requested due to automatic review settings November 13, 2025 14:41
Copy link

Copilot AI left a 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 fixes from v22 to improve supplier price handling and checkbox column positioning functionality.

Key changes:

  • Added support for MAIN_CHECKBOX_LEFT_COLUMN configuration to enable left-positioned action columns in supplier product lists
  • Fixed best supplier price calculation to use discounted unit price instead of base unit price

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
htdocs/product/fournisseurs.php Adds conditional rendering of action column based on MAIN_CHECKBOX_LEFT_COLUMN setting and passes the setting to multiSelectArrayWithCheckbox
htdocs/fourn/class/fournisseur.product.class.php Fixes minimum price calculation to compare discounted unit prices and adds type casting for safer arithmetic operations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

$fourn_unitprice = $fourn_price;
}
$fourn_unitprice_with_discount = $fourn_unitprice * (1 - $record["remise_percent"] / 100);
$fourn_unitprice_with_discount = (float) $fourn_unitprice * (1 - $record["remise_percent"] / 100); // backport from v22
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The discount calculation lacks protection against invalid percentage values. If remise_percent is greater than 100, this will result in a negative price. Consider adding validation to ensure remise_percent is within the valid range (0-100).

Copilot uses AI. Check for mistakes.
@kkhelifa-opendsi kkhelifa-opendsi merged commit 7cdad2f into Easya-Solutions:2024_rc Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants