Debug v21

This commit is contained in:
Laurent Destailleur (aka Eldy) 2025-02-11 15:40:47 +01:00
parent 6f87dc441e
commit 5401791247
2 changed files with 25 additions and 16 deletions

View File

@ -328,7 +328,7 @@ function productlot_prepare_head($object)
*/
function product_admin_prepare_head()
{
global $langs, $conf, $user, $db;
global $langs, $conf, $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('product');
@ -368,24 +368,31 @@ function product_admin_prepare_head()
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_price_extrafields.php';
$head[$h][1] = $langs->trans("ProductLevelExtraFields");
$nbExtrafields = $extrafields->attributes['product_price']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
// Extrafields for price levels
if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_price_extrafields.php';
$head[$h][1] = $langs->trans("ProductLevelExtraFields");
$nbExtrafields = $extrafields->attributes['product_price']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'levelAttributes';
$h++;
}
$head[$h][2] = 'levelAttributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_customer_extrafields.php';
$head[$h][1] = $langs->trans("ProductCustomerExtraFields");
$nbExtrafields = $extrafields->attributes['product_customer_price']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
//Extrafields for price per customer
if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_customer_extrafields.php';
$head[$h][1] = $langs->trans("ProductCustomerExtraFields");
$nbExtrafields = $extrafields->attributes['product_customer_price']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'customerAttributes';
$h++;
}
$head[$h][2] = 'customerAttributes';
$h++;
// Supplier prices
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_supplier_extrafields.php';
$head[$h][1] = $langs->trans("ProductSupplierExtraFields");
$nbExtrafields = $extrafields->attributes['product_fournisseur_price']['count'];

View File

@ -122,9 +122,11 @@ if ($action == 'other') {
if ($tmprule == $princingrules) { // We are on selected rule, we enable it
if ($princingrules == 'PRODUCT_PRICE_UNIQ') { // For this case, we disable entries manually
$res = dolibarr_set_const($db, 'PRODUIT_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY', 0, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES', 0, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY', 0, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'PRODUCT_PRICE_UNIQ', 1, 'chaine', 0, '', $conf->entity);
} else {
$multirule = explode('&', $princingrules);