';
+
print ' ';
print '';
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 4c8bed6bfe6..cea11eda9bc 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -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
$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
@@ -239,7 +244,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 +1993,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') {
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index def603e653e..6620b3c73ff 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1436,6 +1436,7 @@ OrdersNumberingModules=Orders numbering models
OrdersModelModule=Order documents models
FreeLegalTextOnOrders=Free text on orders
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
BANK_ASK_PAYMENT_BANK_DURING_ORDER=Ask for bank account destination of order
##### Interventions #####
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 9579e51920d..16279587795 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -1428,6 +1428,7 @@ OrdersNumberingModules=Modèles de numérotation des commandes
OrdersModelModule=Modèles de document des commandes
FreeLegalTextOnOrders=Mention complémentaire sur les commandes
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.
BANK_ASK_PAYMENT_BANK_DURING_ORDER=Demander le compte bancaire cible durant la commande
##### Interventions #####