From aa4d9cc8a67370cfd0e87d33b4198cc3ba18f4be Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 26 May 2026 16:00:28 +0200 Subject: [PATCH] FIX missing PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES checking (#38442) --- .../modules/stock/doc/pdf_standard_stock.modules.php | 4 ++-- htdocs/product/class/api_products.class.php | 4 ++-- htdocs/product/class/product.class.php | 2 +- htdocs/product/composition/card.php | 4 ++-- htdocs/product/index.php | 4 ++-- htdocs/product/list.php | 6 +++--- htdocs/product/stock/card.php | 6 +++--- htdocs/product/stock/list.php | 2 +- htdocs/product/stock/product.php | 4 ++-- htdocs/product/stock/stockatdate.php | 10 +++++----- htdocs/product/stock/valo.php | 2 +- htdocs/societe/class/api_thirdparties.class.php | 2 +- htdocs/variants/combinations.php | 4 ++-- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php b/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php index 6c6fd033290..84ee121f6bf 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php @@ -419,7 +419,7 @@ class pdf_standard_stock extends ModelePDFStock $pricemin = 0; // Price sell min - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { $pricemin = $objp->price; $pdf->SetXY($this->posxdiscount, $curY); $pdf->MultiCell($this->postotalht - $this->posxdiscount, 3, price(price2num($pricemin, 'MU'), 0, $outputlangs), 0, 'R', false); @@ -512,7 +512,7 @@ class pdf_standard_stock extends ModelePDFStock $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 3, price(price2num($totalvalue, 'MT'), 0, $outputlangs), 0, 'R'); // Price sell min - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { // Total sell min $pdf->SetXY($this->postotalht, $curY); $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, price(price2num($totalvaluesell, 'MT'), 0, $outputlangs), 0, 'R', false); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index a2df15f53fd..075dbea6a56 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -750,7 +750,7 @@ class Products extends DolibarrApi throw new RestException(403); } - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { throw new RestException(400, 'API not available: this mode of pricing is not enabled by setup'); } @@ -796,7 +796,7 @@ class Products extends DolibarrApi throw new RestException(403); } - if (!getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { + if (!getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { throw new RestException(400, 'API not available: this mode of pricing is not enabled by setup'); } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 38aca1ca8e9..60157c83fa4 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2877,7 +2877,7 @@ class Product extends CommonObject // check if price have really change before log $newPriceData = $this->getArrayForPriceCompare($level); - if (!empty(array_diff_assoc($newPriceData, $lastPriceData)) || !getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!empty(array_diff_assoc($newPriceData, $lastPriceData)) || (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'))) { $this->_log_price($user, $level); // Save price for level into table product_price } diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 5085eb02448..56993c98733 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -253,7 +253,7 @@ if ($id > 0 || !empty($ref)) { dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', ''); - if ($object->type != Product::TYPE_SERVICE || getDolGlobalString('STOCK_SUPPORTS_SERVICES') || !getDolGlobalString('PRODUIT_MULTIPRICES')) { + if ($object->type != Product::TYPE_SERVICE || getDolGlobalString('STOCK_SUPPORTS_SERVICES') || (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'))) { print '
'; print '
'; print '
'; @@ -308,7 +308,7 @@ if ($id > 0 || !empty($ref)) { } } - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { // Price print ''.$langs->trans("SellingPrice").''; if ($object->price_base_type == 'TTC') { diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 2c604eaf269..688438982d0 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -362,7 +362,7 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr $lastmodified .= ''; $colnb = 2; - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { $colnb++; } @@ -431,7 +431,7 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr $lastmodified .= dol_print_date($db->jdate($objp->datem), 'day', 'tzuserrel'); $lastmodified .= ""; // Sell price - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { if (isModEnabled('dynamicprices') && !empty($objp->fk_price_expression)) { $product = new Product($db); $product->fetch($objp->rowid); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index eb6166c430c..514e33be040 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -228,7 +228,7 @@ if (getDolGlobalString('PRODUCT_QUICKSEARCH_ON_FIELDS')) { if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { $titlesellprice = $langs->trans("SellingPrice"); - if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { $titlesellprice = $form->textwithpicto($langs->trans("SellingPrice"), $langs->trans("DefaultPriceRealPriceMayDependOnCustomer")); } } @@ -266,8 +266,8 @@ $arrayfields = array( 'p.volume_units' => array('label' => 'VolumeUnits', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_VOLUME') && $type != '1'), 'position' => 31), 'cu.label' => array('label' => "DefaultUnitToShow", 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && getDolGlobalString('PRODUCT_USE_UNITS')), 'position' => 32), 'p.fk_default_workstation' => array('label' => 'DefaultWorkstation', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled('workstation') && $type == 1), 'position' => 33), - 'p.sellprice' => array('label' => "SellingPrice", 'checked' => '1', 'enabled' => (string) (int) !getDolGlobalString('PRODUIT_MULTIPRICES'), 'position' => 40), - 'p.tva_tx' => array('label' => "VATRate", 'checked' => '0', 'enabled' => (string) (int) !getDolGlobalString('PRODUIT_MULTIPRICES'), 'position' => 41), + 'p.sellprice' => array('label' => "SellingPrice", 'checked' => '1', 'enabled' => (string) (int) (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')), 'position' => 40), + 'p.tva_tx' => array('label' => "VATRate", 'checked' => '0', 'enabled' => (string) (int) (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')), 'position' => 41), 'p.minbuyprice' => array('label' => "BuyingPriceMinShort", 'checked' => '1', 'enabled' => (string) (int) ($user->hasRight('fournisseur', 'lire')), 'position' => 42), 'p.numbuyprice' => array('label' => "BuyingPriceNumShort", 'checked' => '0', 'enabled' => (string) (int) ($user->hasRight('fournisseur', 'lire')), 'position' => 43), 'p.pmp' => array('label' => "PMPValueShort", 'checked' => '0', 'enabled' => (string) (int) ($user->hasRight('fournisseur', 'lire')), 'position' => 44), diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index ae032d55c92..592071a20f5 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -673,11 +673,11 @@ if ($action == 'create') { $totalarray['type'][$totalarray['nbfield']] = ''; } - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { print_liste_field_titre("SellPriceMin", "", "p.price", "", "&id=".$object->id, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { print_liste_field_titre("EstimatedStockValueSellShort", "", "", "", "&id=".$object->id, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; $totalarray['pos'][$totalarray['nbfield']] = 'totalvaluesell'; @@ -844,7 +844,7 @@ if ($action == 'create') { } $pricemin = 0; // Price sell min - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { $pricemin = $objp->price; print ''; - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { // Price print ''; print ''; - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { print ''; } else { print ''; diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index e1a543eeedd..26d96650d47 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -130,7 +130,7 @@ if ($result) { print ''; // Selling value print '
'; print price(price2num($pricemin, 'MU'), 1); diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 8810fd59a85..0d5a331e1a8 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -845,7 +845,7 @@ while ($i < $imaxinloop) { // Selling value if (!empty($arrayfields["estimatedstockvaluesell"]['checked'])) { print ''; - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { if ($obj->sellvalue) { print ''.price(price2num($obj->sellvalue, 'MT'), 1).''; } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 3d4d38f60a9..e2aa8d6b7d7 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -750,7 +750,7 @@ if ($id > 0 || $ref) { } print '
'.$langs->trans("SellingPrice").''; if ($usercancreadprice) { @@ -1328,7 +1328,7 @@ if ($showstockdetails) { print ''; if ($num) { print ''; - if (!getDolGlobalString('PRODUIT_MULTIPRICES') && $usercancreadprice) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES') && $usercancreadprice) { print price(price2num($totalvaluesell, 'MT'), 1); } else { print $form->textwithpicto('', $langs->trans("Variable")); diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index b906879bb96..3694fecf712 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -695,7 +695,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { '"'.$objp->label.'"', '"'.price(price2num($stock, 'MS')).'"', price2num($stock * $objp->pmp, 'MT') ? '"'.price2num($stock * $objp->pmp, 'MT').'"' : '', - !getDolGlobalString('PRODUIT_MULTIPRICES') ? '"'.price2num($stock * $objp->price, 'MT').'"' : '"'.$langs->trans("Variable").'('.$langs->trans("OptionMULTIPRICESIsOn").')"', + (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) ? '"'.price2num($stock * $objp->price, 'MT').'"' : '"'.$langs->trans("Variable").'('.$langs->trans("OptionMULTIPRICESIsOn").')"', "$nbofmovement", '"'.price2num($currentstock, 'MS').'"'))."\r\n"; $totalbuyingprice += $stock * $objp->pmp; @@ -748,11 +748,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Selling value print 'trans("Currently").'): '.price(price2num($objp->price, 'MU'), 1)); } print '">'; - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { print ''; if ($stock || (float) ($stock * $objp->price)) { print price(price2num($stock * $objp->price, 'MT'), 1); @@ -838,7 +838,7 @@ if ($ext == 'csv') { '', '', '"'.price2num($totalbuyingprice, 'MT').'"', - !getDolGlobalString('PRODUIT_MULTIPRICES') ? '"'.price2num($totalsellingprice, 'MT').'"' : '', + (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) ? '"'.price2num($totalsellingprice, 'MT').'"' : '', '', $productid > 0 ? price2num($totalcurrentstock, 'MS') : '') ); @@ -857,7 +857,7 @@ if ($ext == 'csv') { } else { print ''.price(price2num($totalbuyingprice, 'MT')).''.price(price2num($totalsellingprice, 'MT')).''; - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { print price(price2num($objp->sellvalue, 'MT'), 1); } else { print $langs->trans("Variable"); diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index defd9a52e21..a0b3fefa7c0 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -538,7 +538,7 @@ class Thirdparties extends DolibarrApi throw new RestException(501, 'Module "Products" needed for this request'); } - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { throw new RestException(501, 'Multiprices features activation needed for this request'); } diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 6a77e684615..d1b5f4cda6d 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -169,7 +169,7 @@ if (($action == 'add' || $action == 'create') && $usercancreate && empty($massac $weight_impact = price2num($weight_impact); $price_impact = price2num($price_impact); - if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { $level_price_impact = array(1 => $price_impact); $level_price_impact_percent = array(1 => $price_impact_percent); } @@ -723,7 +723,7 @@ if (!empty($id) || !empty($ref)) {