FIX: workflow for closing supplier order dn't work (wrong source type) (#25407)

* FIX: workflow for closing supplier order dn't work (wrong source type)

* FIX: sql error when passing origin and origin id, no need to pass theses values

$object->origin is set to "commandeFournisseur', and it's definitively not working with the setStatus method.
SQL error : Table 'dolibarr.llx_commandeFournisseur' doesn't exist

I suppose origin should never be set to commandeFournisseur, but 'order_supplier' instead. Also, setStatus() $elementType is meant to be a table_element value, not an element value.

* Update interface_20_modWorkflow_WorkflowManager.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
jyhere 2023-07-23 21:44:20 +02:00 committed by Laurent Destailleur
parent 849e59797e
commit fe09500e91

View file

@ -402,7 +402,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
$this->errors = $order->errors;
return $ret;
}
$ret = $order->fetchObjectLinked($order->id, 'supplier_order', null, 'reception');
$ret = $order->fetchObjectLinked($order->id, $order->element, null, 'reception');
if ($ret < 0) {
$this->error = $order->error;
$this->errors = $order->errors;
@ -439,7 +439,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
$diff_array = array_diff_assoc($qtyordred, $qtyshipped);
if (count($diff_array) == 0) {
//No diff => mean everythings is received
$ret = $order->setStatut(CommandeFournisseur::STATUS_RECEIVED_COMPLETELY, $object->origin_id, $object->origin, 'SUPPLIER_ORDER_CLOSE');
$ret = $order->setStatut(CommandeFournisseur::STATUS_RECEIVED_COMPLETELY, null, null, 'SUPPLIER_ORDER_CLOSE');
if ($ret < 0) {
$this->error = $order->error;
$this->errors = $order->errors;