From 8ec2c44f3a5f6de4ec48153454b94a4ad1a77df3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Jun 2006 23:04:13 +0000 Subject: [PATCH] Fix: On ne pouvait plus modifier la date de livraison d'une commande --- htdocs/commande/commande.class.php | 13 +++++++++---- htdocs/commande/fiche.php | 9 +++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index cca2a0c6c09..37ce04b7e30 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -1343,10 +1343,11 @@ class Commande if ($user->rights->commande->creer) { $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; - $sql.= " SET date_livraison = ".' '.($this->date_livraison?$this->db->idate($this->date_livraison):'null'); + $sql.= " SET date_livraison = ".($date_livraison ? $this->db->idate($date_livraison) : 'null'); $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; - - if ($this->db->query($sql) ) + + $resql=$this->db->query($sql); + if ($resql) { $this->date_livraison = $date_livraison; return 1; @@ -1354,10 +1355,14 @@ class Commande else { $this->error=$this->db->error(); - dolibarr_syslog("Commande::set_date_livraison Erreur SQL"); + dolibarr_syslog("Commande::set_date_livraison Erreur SQL sql=$sql"); return -1; } } + else + { + return -2; + } } /** diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 366c9d32811..c5ff9e4a908 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -85,7 +85,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer) $datecommande=''; $datecommande = @mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datelivraison = @mktime(12, 0, 0, $_POST['liv_month'],$_POST['liv_day'],$_POST['liv_year']); - + $commande = new Commande($db); $commande->soc_id = $_POST['soc_id']; @@ -143,9 +143,14 @@ if ($_POST['action'] == 'setremise' && $user->rights->commande->creer) if ($_POST['action'] == 'setdate_livraison' && $user->rights->commande->creer) { + $datelivraison=@mktime(0, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']); $commande = new Commande($db); $commande->fetch($_GET['id']); - $commande->set_date_livraison($user,mktime(0, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); + $result=$commande->set_date_livraison($user,$datelivraison); + if ($result < 0) + { + $mesg='
'.$commande->error.'
'; + } } if ($_POST['action'] == 'setdeliveryadress' && $user->rights->commande->creer)