Skip to content

Commit aa8fac1

Browse files
authored
Merge pull request #36429 from atm-adrien/FIX/MulticompanyStockCompatibility
FIX : Implementation of multi-company compatibility with inventory/warehouse management
2 parents 2ebdcfd + c1c2358 commit aa8fac1

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

htdocs/core/lib/security.lib.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,14 +902,14 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
902902
$checkonentitydone = 0;
903903

904904
// Array to define rules of checks to do
905-
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'payment_sc', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment', 'chargesociales', 'knowledgemanagement'); // Test on entity only (Objects with no link to company)
905+
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'payment_sc', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment', 'chargesociales', 'knowledgemanagement', 'stock'); // Test on entity only (Objects with no link to company)
906906
$checksoc = array('societe'); // Test for object Societe
907907
$checkparentsoc = array('agenda', 'contact', 'contrat'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...).
908908
$checkproject = array('projet', 'project'); // Test for project object
909909
$checktask = array('projet_task', 'project_task'); // Test for task object
910910
$checkhierarchy = array('expensereport', 'holiday', 'hrm'); // check permission among the hierarchy of user
911911
$checkuser = array('bookmark'); // check permission among the fk_user (must be myself or null)
912-
$nocheck = array('barcode', 'stock'); // No test
912+
$nocheck = array('barcode'); // No test
913913

914914
//$checkdefault = 'all other not already defined'; // Test on entity + link to third party on field $dbt_keyfield. Not allowed if link is empty (Ex: invoice, orders...).
915915

htdocs/product/inventory/card.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
$backtopage = GETPOST('backtopage', 'alpha');
4343

4444
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
45-
$result = restrictedArea($user, 'stock', $id);
45+
$result = restrictedArea($user, 'stock', $id, 'inventory&stock');
4646
} else {
47-
$result = restrictedArea($user, 'stock', $id, '', 'inventory_advance');
47+
$result = restrictedArea($user, 'stock', $id, 'inventory&stock', 'inventory_advance');
4848
}
4949

5050
// Initialize technical objects

htdocs/product/inventory/inventory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
$totalExpectedValuation = 0;
6060
$totalRealValuation = 0;
6161
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
62-
$result = restrictedArea($user, 'stock', $id);
62+
$result = restrictedArea($user, 'stock', $id, 'inventory&stock');
6363
} else {
64-
$result = restrictedArea($user, 'stock', $id, '', 'inventory_advance');
64+
$result = restrictedArea($user, 'stock', $id, 'inventory&stock', 'inventory_advance');
6565
}
6666

6767
// Initialize technical objects

htdocs/product/stock/card.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@
7070
$backtopage = GETPOST('backtopage', 'alpha');
7171

7272
// Security check
73-
//$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
74-
$result = restrictedArea($user, 'stock');
73+
$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
7574

7675
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
7776
$hookmanager->initHooks(array('warehousecard', 'globalcard'));

0 commit comments

Comments
 (0)