FIX : If we enable 3 steps for supplier order approbation, we must not delete all fourn rights def.

This commit is contained in:
gauthier 2018-06-08 17:11:59 +02:00
parent 426eb178f2
commit baf9d4a806

View File

@ -179,6 +179,9 @@ else if ($action == 'set_SUPPLIER_ORDER_OTHER')
// TODO We add/delete permission here until permission can have a condition on a global var // TODO We add/delete permission here until permission can have a condition on a global var
include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php';
$newmodule=new modFournisseur($db); $newmodule=new modFournisseur($db);
if ($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)
{
// clear default rights array // clear default rights array
$newmodule->rights=array(); $newmodule->rights=array();
// add new right // add new right
@ -190,13 +193,16 @@ else if ($action == 'set_SUPPLIER_ORDER_OTHER')
$newmodule->rights[$r][4] = 'commande'; $newmodule->rights[$r][4] = 'commande';
$newmodule->rights[$r][5] = 'approve2'; $newmodule->rights[$r][5] = 'approve2';
if ($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) // Insert
{
$newmodule->insert_permissions(1); $newmodule->insert_permissions(1);
} }
else else
{ {
// Remove all rights with Permission1190
$newmodule->delete_permissions(); $newmodule->delete_permissions();
// Add all right without Permission1190
$newmodule->insert_permissions(1);
} }
} }