diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 4c8bed6bfe6..32150131314 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -144,6 +144,12 @@ $permissiondellink = $usercancreate; // Used by the include of actions_dellink.i $permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php +// Project permission +$caneditproject = false; +if (!empty($conf->projet->enabled)) { + $caneditproject = empty($conf->global->SUPPLIER_ORDER_FORBID_EDIT_PROJECT) || ($object->statut == CommandeFournisseur::STATUS_DRAFT && preg_match('/^[\(]?PROV/i', $object->ref)); +} + /* * Actions @@ -239,7 +245,7 @@ if (empty($reshook)) { } // Set project - if ($action == 'classin' && $usercancreate) { + if ($action == 'classin' && $usercancreate && $caneditproject) { $result = $object->setProject($projectid); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -1988,7 +1994,7 @@ if ($action == 'create') { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($usercancreate) { - if ($action != 'classify') { + if ($action != 'classify' && $caneditproject) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; } if ($action == 'classify') {