diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 7b3d1e4637f..5b1d5ba91d0 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -38,8 +38,11 @@ function product_prepare_head($object) $langs->load("products"); $label = $langs->trans('Product'); + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('produit', 'lire'); + if ($object->isService()) { $label = $langs->trans('Service'); + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire'); } $h = 0; @@ -50,7 +53,7 @@ function product_prepare_head($object) $head[$h][2] = 'card'; $h++; - if (!empty($object->status)) { + if (!empty($object->status) && $usercancreadprice) { $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$object->id; $head[$h][1] = $langs->trans("SellingPrices"); $head[$h][2] = 'price'; @@ -61,10 +64,12 @@ function product_prepare_head($object) if ((((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->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++; + 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++; + } } } diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 090fdd59fa3..b32cc5a3cda 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -127,6 +127,14 @@ class modProduct extends DolibarrModules $this->rights[$r][4] = 'creer'; $r++; + $this->rights[$r][0] = 33; // id de la permission + $this->rights[$r][1] = 'Read prices products'; // libelle de la permission + $this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'product_advance'; + $this->rights[$r][5] = 'read_prices'; + $r++; + $this->rights[$r][0] = 34; // id de la permission $this->rights[$r][1] = 'Delete products'; // libelle de la permission $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 8f4b697332b..7649e8d5b76 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -102,6 +102,14 @@ class modService extends DolibarrModules $this->rights[$r][4] = 'creer'; $r++; + $this->rights[$r][0] = 533; // id de la permission + $this->rights[$r][1] = 'Read prices services'; // libelle de la permission + $this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'service_advance'; + $this->rights[$r][5] = 'read_prices'; + $r++; + $this->rights[$r][0] = 534; // id de la permission $this->rights[$r][1] = 'Delete les services'; // libelle de la permission $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index c68a0ada7d6..f34d0a17e15 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -714,6 +714,7 @@ Permission27=Delete commercial proposals Permission28=Export commercial proposals Permission31=Read products Permission32=Create/modify products +Permission33=Read prices products Permission34=Delete products Permission36=See/manage hidden products Permission38=Export products @@ -875,6 +876,7 @@ Permission525=Access loan calculator Permission527=Export loans Permission531=Read services Permission532=Create/modify services +Permission533=Read prices services Permission534=Delete services Permission536=See/manage hidden services Permission538=Export services diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 4cc79472ada..f66b1cb5b8b 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -291,7 +291,6 @@ if ($search_type == '0') { $result = restrictedArea($user, 'produit|service', '', '', '', '', '', 0); } - /* * Actions */ @@ -1360,6 +1359,11 @@ if ($resql) { } } + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('produit', 'lire'); + if ($product_static->isService()) { + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire'); + } + print '