diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ab489d02578..2b90af268c5 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -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). - - if (!$error) + if (empty($error)) { $this->db->begin(); @@ -2312,17 +2311,18 @@ class CommandeFournisseur extends CommonOrder $resql = $this->db->query($sql); if ($resql) { - $result = 0; + $result = 1; $old_statut = $this->statut; $this->statut = $statut; $this->actionmsg2 = $comment; // Call trigger - $result = $this->call_trigger('ORDER_SUPPLIER_RECEIVE', $user); - if ($result < 0) $error++; + $result_trigger = $this->call_trigger('ORDER_SUPPLIER_RECEIVE', $user); + if ($result_trigger < 0) $error++; + else $result += (int) $result_trigger; // End call triggers - if (!$error) + if (empty($error)) { $this->db->commit(); }