From 7c43aa86c9b9b72df996073425c0bfda2cbbc35e Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 16 Nov 2023 15:31:20 +0100 Subject: [PATCH] fix: mising delete inventory perms with MAIN_USE_ADVANCED_PERMS (#26617) * fix: mising delete inventory perms * fix: mising delete inventory perms --- htdocs/core/modules/modStock.class.php | 7 +++++++ htdocs/langs/en_US/stocks.lang | 2 +- htdocs/product/inventory/card.php | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index e99742a14c4..740bbf6cc7a 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -160,6 +160,13 @@ class modStock extends DolibarrModules $this->rights[6][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[6][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[6][0] = 1013; + $this->rights[6][1] = 'inventoryDeletePermission'; // Permission label + $this->rights[6][3] = 0; // Permission by default for new user (0/1) + $this->rights[6][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[6][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { $this->rights[8][0] = 1014; $this->rights[8][1] = 'inventoryValidatePermission'; // Permission label diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 3ee38749b10..504a637a869 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -317,4 +317,4 @@ StockTransferRightRead=Read stocks transfers StockTransferRightCreateUpdate=Create/Update stocks transfers StockTransferRightDelete=Delete stocks transfers BatchNotFound=Lot / serial not found for this product -WarningThisWIllAlsoDeleteStock=Warning, this will also destroy all quantities in stock in the warehouse \ No newline at end of file +WarningThisWIllAlsoDeleteStock=Warning, this will also destroy all quantities in stock in the warehouse diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 874c1918de2..a16b11a0f5a 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -92,7 +92,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { } else { $permissiontoread = $user->rights->stock->inventory_advance->read; $permissiontoadd = $user->rights->stock->inventory_advance->write; - $permissiontodelete = $user->rights->stock->inventory_advance->write; + $permissiontodelete = $user->rights->stock->inventory_advance->delete; $permissionnote = $user->rights->stock->inventory_advance->write; // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->rights->stock->inventory_advance->write; // Used by the include of actions_dellink.inc.php $upload_dir = $conf->stock->multidir_output[isset($object->entity) ? $object->entity : 1];