FIX missing PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES checking (#38442)

This commit is contained in:
Regis Houssin 2026-05-26 16:00:28 +02:00 committed by GitHub
parent 5675986268
commit aa4d9cc8a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 27 additions and 27 deletions

View file

@ -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);

View file

@ -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');
}

View file

@ -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
}

View file

@ -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 '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
@ -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 '<tr><td class="titlefield">'.$langs->trans("SellingPrice").'</td><td>';
if ($object->price_base_type == 'TTC') {

View file

@ -362,7 +362,7 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr
$lastmodified .= '<table class="noborder centpercent">';
$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 .= "</td>";
// 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);

View file

@ -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),

View file

@ -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 '<td class="right">';
print price(price2num($pricemin, 'MU'), 1);

View file

@ -845,7 +845,7 @@ while ($i < $imaxinloop) {
// Selling value
if (!empty($arrayfields["estimatedstockvaluesell"]['checked'])) {
print '<td class="right">';
if (!getDolGlobalString('PRODUIT_MULTIPRICES')) {
if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
if ($obj->sellvalue) {
print '<span class="amount">'.price(price2num($obj->sellvalue, 'MT'), 1).'</span>';
}

View file

@ -750,7 +750,7 @@ if ($id > 0 || $ref) {
}
print '</td></tr>';
if (!getDolGlobalString('PRODUIT_MULTIPRICES')) {
if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
// Price
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>';
if ($usercancreadprice) {
@ -1328,7 +1328,7 @@ if ($showstockdetails) {
print '<td class="liste_total right amount">';
if ($num) {
print '<span class="valignmiddle">';
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"));

View file

@ -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 '<td class="right"';
if (!getDolGlobalString('PRODUIT_MULTIPRICES')) {
if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
print ' title="'.dolPrintHTMLForAttribute($langs->trans("SellingPrice").' ('.$langs->trans("Currently").'): '.price(price2num($objp->price, 'MU'), 1));
}
print '">';
if (!getDolGlobalString('PRODUIT_MULTIPRICES')) {
if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
print '<span class="amount">';
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 '<td></td>';
print '<td class="right">'.price(price2num($totalbuyingprice, 'MT')).'</td>';
if (!getDolGlobalString('PRODUIT_MULTIPRICES')) {
if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
print '<td class="right">'.price(price2num($totalsellingprice, 'MT')).'</td>';
} else {
print '<td></td>';

View file

@ -130,7 +130,7 @@ if ($result) {
print '</td>';
// Selling value
print '<td class="right">';
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");

View file

@ -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');
}

View file

@ -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)) {
<td><input type="text" id="reference" name="reference" value="<?php echo trim($reference) ?>" spellcheck="false"></td>
</tr>
<?php
if (!getDolGlobalString('PRODUIT_MULTIPRICES')) {
if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
?>
<tr>
<td><label for="price_impact"><?php echo $langs->trans('PriceImpact') ?></label></td>