diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 7db4d3c9767..148fa427fff 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -117,6 +117,9 @@ if (!empty($conf->expedition->enabled) && $conf->global->WAREHOUSE_ASK_WAREHOUSE if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $object->warehouse_id = $user->fk_warehouse; } +$error = 0; + + /* * Actions */ diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9197c14be5c..797e3693614 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1223,8 +1223,13 @@ class CommandeFournisseur extends CommonOrder { $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = ".self::STATUS_ORDERSENT.", fk_input_method=".$methode.", date_commande='".$this->db->idate($date)."'"; - $sql .= " WHERE rowid = ".$this->id; + $newnoteprivate = $this->note_private; + if ($comment) $newnoteprivate = dol_concatdesc($newnoteprivate, $langs->trans("Comment").': '.$comment); + + $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; + $sql .= " SET fk_statut=".self::STATUS_ORDERSENT.", fk_input_method=".$methode.", date_commande='".$this->db->idate($date)."', "; + $sql .= " note_private='".$this->db->escape($newnoteprivate)."'"; + $sql .= " WHERE rowid=".$this->id; dol_syslog(get_class($this)."::commande", LOG_DEBUG); if ($this->db->query($sql)) @@ -1232,6 +1237,7 @@ class CommandeFournisseur extends CommonOrder $this->statut = self::STATUS_ORDERSENT; $this->methode_commande_id = $methode; $this->date_commande = $date; + $this->context = array('comments' => $comment); // Call trigger $result = $this->call_trigger('ORDER_SUPPLIER_SUBMIT', $user); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 16cc619949f..c8706d1b22e 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -62,7 +62,6 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); -$comclientid = GETPOST('comid', 'int'); $socid = GETPOST('socid', 'int'); $projectid = GETPOST('projectid', 'int'); $cancel = GETPOST('cancel', 'alpha'); @@ -917,7 +916,7 @@ if (empty($reshook)) // Force mandatory order method if ($action == 'commande') { - $methodecommande = GETPOST('methodecommande'); + $methodecommande = GETPOST('methodecommande', 'int'); if ($methodecommande <= 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("OrderMode")), null, 'errors'); @@ -927,7 +926,7 @@ 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, GETPOST("datecommande"), GETPOST("methode", 'int'), GETPOST('comment', 'alphanohtml')); if ($result > 0) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))