diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 6246b47dcd3..d64ebe263d1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1837,6 +1837,7 @@ class CommandeFournisseur extends CommonOrder if ($resql) { $result = 0; + $this->statut = $statut; $result=$this->log($user, $statut, $date, $comment); $this->db->commit(); @@ -1851,6 +1852,8 @@ class CommandeFournisseur extends CommonOrder } else { + $this->error = 'Not Authorized'; + $this->errors[] = 'Not Authorized'; dol_syslog(get_class($this)."::Livraison Not Authorized"); $result = -3; } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 8078665c321..904cd5b3133 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -766,15 +766,15 @@ if (empty($reshook)) { $date_liv = dol_mktime(GETPOST('rehour'),GETPOST('remin'),GETPOST('resec'),GETPOST("remonth"),GETPOST("reday"),GETPOST("reyear")); - $result = $object->Livraison($user, $date_liv, GETPOST("type"), GETPOST("comment")); + $result = $object->Livraison($user, $date_liv, GETPOST("type"), GETPOST("comment")); if ($result > 0) { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); - exit; - } + setEventMessages($langs->trans("DeliveryStateSaved"), null); + $action = ''; + } else if($result == -3) { - setEventMessage($langs->trans("NotAuthorized"), 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } else {