Merge pull request #20403 from Easya-Solutions/develop_remake_variants_permissions

NEW : Update variants to standard card and list (permissions)
This commit is contained in:
Laurent Destailleur
2022-03-23 16:02:34 +01:00
committed by GitHub
5 changed files with 25 additions and 8 deletions

View File

@@ -109,5 +109,19 @@ class modVariants extends DolibarrModules
// Permissions
$this->rights = array(); // Permission array used by this module
$r = 0;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read objects of ProductAttribute'; // Permission label
$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Create/Update objects of ProductAttribute'; // Permission label
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Delete objects of ProductAttribute'; // Permission label
$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
$r++;
}
}

View File

@@ -883,6 +883,9 @@ Permission564=Record Debits/Rejections of credit transfer
Permission601=Read stickers
Permission602=Create/modify stickers
Permission609=Delete stickers
Permission611=Read objects of ProductAttribute
Permission612=Create/Update objects of ProductAttribute
Permission613=Delete objects of ProductAttribute
Permission650=Read Bills of Materials
Permission651=Create/Update Bills of Materials
Permission652=Delete Bills of Materials

View File

@@ -58,10 +58,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('productattributecard', 'globalcard'));
$permissiontoread = $user->rights->produit->lire || $user->rights->service->lire;
$permissiontoadd = $user->rights->produit->lire || $user->rights->service->lire; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontoedit = $user->rights->produit->lire || $user->rights->service->lire; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->produit->lire || $user->rights->service->lire;
$permissiontoread = $user->rights->variants->read;
$permissiontoadd = $user->rights->variants->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontoedit = $user->rights->variants->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->variants->delete;
$error = 0;

View File

@@ -1346,7 +1346,7 @@ class ProductAttribute extends CommonObject
global $form;
global $object_rights, $disableedit, $disablemove, $disableremove; // TODO We should not use global var for this !
$object_rights = $user->rights->produit->lire || $user->rights->service->lire;
$object_rights = $user->rights->variants;
// Line in view mode
if ($action != 'editline' || $selected != $line->id) {

View File

@@ -131,9 +131,9 @@ $arrayfields['nb_products'] = array(
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
$permissiontoread = $user->rights->produit->lire || $user->rights->service->lire;
$permissiontoadd = $user->rights->produit->lire || $user->rights->service->lire;
$permissiontodelete = $user->rights->produit->lire || $user->rights->service->lire;
$permissiontoread = $user->rights->variants->read;
$permissiontoadd = $user->rights->variants->write;
$permissiontodelete = $user->rights->variants->delete;
// Security check
if (empty($conf->variants->enabled)) {