diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 6a83aab0155..6246b47dcd3 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -946,16 +946,24 @@ class CommandeFournisseur extends CommonOrder dol_syslog(get_class($this)."::commande", LOG_DEBUG); if ($this->db->query($sql)) { + $this->statut = 3; + $this->methode_commande_id = $methode; + $this->date_commande = $this->db->idate($date); $result = 1; $this->log($user, 3, $date, $comment); } else { + $this->error = $this->db->lasterror(); + $this->errors[] = $this->db->lasterror(); $result = -1; } } else { + $result = -1; + $this->error = 'Not Authorized'; + $this->errors[] = 'Not Authorized'; dol_syslog(get_class($this)."::commande User not Authorized", LOG_ERR); } return $result ; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index cb1754fa8d3..8078665c321 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -704,15 +704,14 @@ if (empty($reshook)) if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander) { - $result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']); + $result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']); if ($result > 0) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); - exit; - } + $action = ''; + } else { setEventMessages($object->error, $object->errors, 'errors');