From 2945d2d1718c38b00366ba0a702b7d0e435ef2bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Thu, 7 Jan 2016 00:05:28 +0100 Subject: [PATCH] Fix bad condition to show tabs --- htdocs/core/lib/product.lib.php | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 73c74cfb97e..6deaf7eae08 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -45,21 +45,27 @@ function product_prepare_head($object) $head[$h][2] = 'card'; $h++; - $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$object->id; - $head[$h][1] = $langs->trans("SellingPrices"); - $head[$h][2] = 'price'; - $h++; - - if ((! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) - || (! empty($conf->margin->enabled) && $user->rights->margin->liretous) - ) + if (! empty($object->status)) { - $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id; - $head[$h][1] = $langs->trans("BuyingPrices"); - $head[$h][2] = 'suppliers'; - $h++; + $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$object->id; + $head[$h][1] = $langs->trans("SellingPrices"); + $head[$h][2] = 'price'; + $h++; } - + + if (! empty($object->status_buy) || (! empty($conf->margin->enabled) && ! 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 ((! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) + || (! empty($conf->margin->enabled) && $user->rights->margin->liretous) + ) + { + $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id; + $head[$h][1] = $langs->trans("BuyingPrices"); + $head[$h][2] = 'suppliers'; + $h++; + } + } + // Show category tab /* No more required. Replaced with new multiselect component if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) -- GitLab