2
0
forked from Wavyzz/dolibarr

FIX - Edit price product if status_buy or status is empty (#26239)

Co-authored-by: Anthony Berton <anthony.berton@bb2a.fr>
This commit is contained in:
Anthony Berton
2023-10-17 16:39:55 +02:00
committed by GitHub
parent c0f04dc078
commit 8cbbd88f52

View File

@@ -54,39 +54,39 @@ function product_prepare_head($object)
$head[$h][2] = 'card';
$h++;
if (!empty($object->status)) {
// if (!empty($object->status)) {
if ($usercancreadprice) {
$head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$object->id;
$head[$h][1] = $langs->trans("SellingPrices");
$head[$h][2] = 'price';
$h++;
} else {
$head[$h][0] = '#';
$head[$h][1] = $langs->trans("SellingPrices");
$head[$h][2] = 'price';
$head[$h][5] = 'disabled';
$h++;
}
// }
// if (!empty($object->status_buy) || (isModEnabled('margin') && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase
if ((isModEnabled("supplier_proposal") || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && ($user->hasRight('fournisseur', 'lire') || $user->hasRight('supplier_order', 'read') || $user->hasRight('supplier_invoice', 'read'))
|| (isModEnabled('margin') && $user->hasRight("margin", "liretous"))
) {
if ($usercancreadprice) {
$head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$object->id;
$head[$h][1] = $langs->trans("SellingPrices");
$head[$h][2] = 'price';
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id;
$head[$h][1] = $langs->trans("BuyingPrices");
$head[$h][2] = 'suppliers';
$h++;
} else {
$head[$h][0] = '#';
$head[$h][1] = $langs->trans("SellingPrices");
$head[$h][2] = 'price';
$head[$h][1] = $langs->trans("BuyingPrices");
$head[$h][2] = 'suppliers';
$head[$h][5] = 'disabled';
$h++;
}
}
if (!empty($object->status_buy) || (isModEnabled('margin') && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase
if ((isModEnabled("supplier_proposal") || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && ($user->hasRight('fournisseur', 'lire') || $user->hasRight('supplier_order', 'read') || $user->hasRight('supplier_invoice', 'read'))
|| (isModEnabled('margin') && $user->hasRight("margin", "liretous"))
) {
if ($usercancreadprice) {
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id;
$head[$h][1] = $langs->trans("BuyingPrices");
$head[$h][2] = 'suppliers';
$h++;
} else {
$head[$h][0] = '#';
$head[$h][1] = $langs->trans("BuyingPrices");
$head[$h][2] = 'suppliers';
$head[$h][5] = 'disabled';
$h++;
}
}
}
// }
// Multilangs
if (getDolGlobalInt('MAIN_MULTILANGS')) {