Merge pull request #21354 from badre-agtaib/new2

FIX #21204
This commit is contained in:
Laurent Destailleur 2022-07-04 15:30:33 +02:00 committed by GitHub
commit 1c2727e2a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 10 deletions

View File

@ -72,19 +72,25 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($action == 'PROPAL_CLOSE_SIGNED') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) {
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$newobject = new Commande($this->db);
$object->fetchObjectLinked();
if (!empty($object->linkedObjectsIds['commande'])) {
setEventMessages($langs->trans("OrderExists"), null, 'warnings');
return $ret;
} else {
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$newobject = new Commande($this->db);
$newobject->context['createfrompropal'] = 'createfrompropal';
$newobject->context['origin'] = $object->element;
$newobject->context['origin_id'] = $object->id;
$newobject->context['createfrompropal'] = 'createfrompropal';
$newobject->context['origin'] = $object->element;
$newobject->context['origin_id'] = $object->id;
$ret = $newobject->createFromProposal($object, $user);
if ($ret < 0) {
$this->error = $newobject->error;
$this->errors[] = $newobject->error;
$ret = $newobject->createFromProposal($object, $user);
if ($ret < 0) {
$this->error = $newobject->error;
$this->errors[] = $newobject->error;
}
return $ret;
}
return $ret;
}
}

View File

@ -1,4 +1,5 @@
# Dolibarr language file - Source file is en_US - orders
OrderExists=An order was already open linked to this proposal, so no other order was created automatically
OrdersArea=Customers orders area
SuppliersOrdersArea=Purchase orders area
OrderCard=Order card