Merge pull request #15075 from FHenry/12.0_fix_status_receipt_tot

fix set status on order Receipt when no dispatch
This commit is contained in:
Laurent Destailleur 2020-10-22 15:50:30 +02:00 committed by GitHub
commit 37749e8e9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2298,8 +2298,7 @@ class CommandeFournisseur extends CommonOrder
// TODO LDR01 Add a control test to accept only if ALL predefined products are received (same qty). // TODO LDR01 Add a control test to accept only if ALL predefined products are received (same qty).
if (empty($error))
if (!$error)
{ {
$this->db->begin(); $this->db->begin();
@ -2312,17 +2311,18 @@ class CommandeFournisseur extends CommonOrder
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$result = 0; $result = 1;
$old_statut = $this->statut; $old_statut = $this->statut;
$this->statut = $statut; $this->statut = $statut;
$this->actionmsg2 = $comment; $this->actionmsg2 = $comment;
// Call trigger // Call trigger
$result = $this->call_trigger('ORDER_SUPPLIER_RECEIVE', $user); $result_trigger = $this->call_trigger('ORDER_SUPPLIER_RECEIVE', $user);
if ($result < 0) $error++; if ($result_trigger < 0) $error++;
else $result += (int) $result_trigger;
// End call triggers // End call triggers
if (!$error) if (empty($error))
{ {
$this->db->commit(); $this->db->commit();
} }