Merge pull request #18960 from vincentjdc/project-edit-fordid-supplier-order
Add an option to forbid changing the project of a supplier order
This commit is contained in:
commit
507d5962ab
@ -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
|
$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
|
||||||
$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.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
|
* Actions
|
||||||
@ -239,7 +245,7 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set project
|
// Set project
|
||||||
if ($action == 'classin' && $usercancreate) {
|
if ($action == 'classin' && $usercancreate && $caneditproject) {
|
||||||
$result = $object->setProject($projectid);
|
$result = $object->setProject($projectid);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -1988,7 +1994,7 @@ if ($action == 'create') {
|
|||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||||
if ($usercancreate) {
|
if ($usercancreate) {
|
||||||
if ($action != 'classify') {
|
if ($action != 'classify' && $caneditproject) {
|
||||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||||
}
|
}
|
||||||
if ($action == 'classify') {
|
if ($action == 'classify') {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user