NEW - Add user right order generete doc

This commit is contained in:
Anthony Berton 2022-07-28 11:29:36 +02:00
parent 4cd85f3029
commit d8ae2361a9
4 changed files with 15 additions and 5 deletions

View File

@ -108,14 +108,15 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
$usercanread = $user->rights->commande->lire;
$usercancreate = $user->rights->commande->creer;
$usercandelete = $user->rights->commande->supprimer;
$usercanread = $user->hasRight('commande', 'lire');
$usercancreate = $user->hasRight('commande', 'creer');
$usercandelete = $user->hasRight('commande', 'supprimer');
// Advanced permissions
$usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->close)));
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->validate)));
$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->annuler)));
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send);
$usercangeneretedoc = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->hasRight('commande', 'order_advance', 'generetedoc'));
$usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer);

View File

@ -34,7 +34,7 @@ if (!empty($permissioncreate) && empty($permissiontoadd)) {
}
// Build doc
if ($action == 'builddoc' && $permissiontoadd) {
if ($action == 'builddoc' && ($permissiontoadd || !empty($usercangeneretedoc))) {
if (is_numeric(GETPOST('model', 'alpha'))) {
$error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Model"));
} else {

View File

@ -139,9 +139,17 @@ class modCommande extends DolibarrModules
$this->rights[$r][4] = 'order_advance';
$this->rights[$r][5] = 'validate';
$r++;
$this->rights[$r][0] = 85;
$this->rights[$r][1] = 'Generate the documents sales orders';
$this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'order_advance';
$this->rights[$r][5] = 'generetedoc';
$r++;
$this->rights[$r][0] = 86;
$this->rights[$r][1] = 'Send sale orders by email';
$this->rights[$r][1] = 'Send sales orders by email';
$this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'order_advance';

View File

@ -739,6 +739,7 @@ Permission79=Create/modify subscriptions
Permission81=Read customers orders
Permission82=Create/modify customers orders
Permission84=Validate customers orders
Permission85=Generate the documents sales orders
Permission86=Send customers orders
Permission87=Close customers orders
Permission88=Cancel customers orders