Add an option to forbird changing the project of a supplier order if validated or if in draft but already has a reference (not )
This commit is contained in:
parent
f3ea05b701
commit
8370973a9d
@ -149,6 +149,7 @@ if ($action == 'updateMask') {
|
|||||||
|
|
||||||
$res1 = dolibarr_set_const($db, "SUPPLIER_ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
|
$res1 = dolibarr_set_const($db, "SUPPLIER_ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
|
||||||
$res2 = dolibarr_set_const($db, "SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED", $doubleapproval, 'chaine', 0, '', $conf->entity);
|
$res2 = dolibarr_set_const($db, "SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED", $doubleapproval, 'chaine', 0, '', $conf->entity);
|
||||||
|
$res3 = dolibarr_set_const($db, "FORBID_EDIT_PROJECT_ON_SUPPLIER_ORDER", GETPOST('FORBID_EDIT_PROJECT_ON_SUPPLIER_ORDER', 'int'), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
// 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';
|
||||||
@ -532,6 +533,15 @@ if ($conf->reception->enabled) {
|
|||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
// Option
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>'.$langs->trans("SupplierOrderForbidProjectChange").'</td>';
|
||||||
|
print '<td class="center">'.$form->selectyesno('FORBID_EDIT_PROJECT_ON_SUPPLIER_ORDER', $conf->global->FORBID_EDIT_PROJECT_ON_SUPPLIER_ORDER, 1).'</td>';
|
||||||
|
print '<td class="center">';
|
||||||
|
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
print '</table><br>';
|
print '</table><br>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|||||||
@ -144,6 +144,11 @@ $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
|
||||||
|
if (!empty($conf->projet->enabled)) {
|
||||||
|
$caneditproject = empty($conf->global->FORBID_EDIT_PROJECT_ON_SUPPLIER_ORDER) || ($object->statut == CommandeFournisseur::STATUS_DRAFT && preg_match('/^[\(]?PROV/i', $object->ref));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -239,7 +244,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 +1993,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') {
|
||||||
|
|||||||
@ -1436,6 +1436,7 @@ OrdersNumberingModules=Orders numbering models
|
|||||||
OrdersModelModule=Order documents models
|
OrdersModelModule=Order documents models
|
||||||
FreeLegalTextOnOrders=Free text on orders
|
FreeLegalTextOnOrders=Free text on orders
|
||||||
WatermarkOnDraftOrders=Watermark on draft orders (none if empty)
|
WatermarkOnDraftOrders=Watermark on draft orders (none if empty)
|
||||||
|
SupplierOrderForbidProjectChange=Forbid changing the project of a supplier order or a draft which already has a reference
|
||||||
ShippableOrderIconInList=Add an icon in Orders list which indicate if order is shippable
|
ShippableOrderIconInList=Add an icon in Orders list which indicate if order is shippable
|
||||||
BANK_ASK_PAYMENT_BANK_DURING_ORDER=Ask for bank account destination of order
|
BANK_ASK_PAYMENT_BANK_DURING_ORDER=Ask for bank account destination of order
|
||||||
##### Interventions #####
|
##### Interventions #####
|
||||||
|
|||||||
@ -1428,6 +1428,7 @@ OrdersNumberingModules=Modèles de numérotation des commandes
|
|||||||
OrdersModelModule=Modèles de document des commandes
|
OrdersModelModule=Modèles de document des commandes
|
||||||
FreeLegalTextOnOrders=Mention complémentaire sur les commandes
|
FreeLegalTextOnOrders=Mention complémentaire sur les commandes
|
||||||
WatermarkOnDraftOrders=Filigrane sur les brouillons de commandes (aucun si vide)
|
WatermarkOnDraftOrders=Filigrane sur les brouillons de commandes (aucun si vide)
|
||||||
|
SupplierOrderForbidProjectChange=Interdire de modifier le projet d'une commande validée (ou en brouillon mais ayant déjà une référence)
|
||||||
ShippableOrderIconInList=Ajouter une icône dans la liste des commandes qui indique si la commande est expédiable.
|
ShippableOrderIconInList=Ajouter une icône dans la liste des commandes qui indique si la commande est expédiable.
|
||||||
BANK_ASK_PAYMENT_BANK_DURING_ORDER=Demander le compte bancaire cible durant la commande
|
BANK_ASK_PAYMENT_BANK_DURING_ORDER=Demander le compte bancaire cible durant la commande
|
||||||
##### Interventions #####
|
##### Interventions #####
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user