From 93defa5f595062dea438feb780c595eccc1bc919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20BERTHELOT?= <sberthelot@emisfr.com> Date: Mon, 11 Sep 2017 18:01:24 +0200 Subject: [PATCH] Fix dates in commande and remisecheque for PostgreSQL (should be treated like strings) --- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/paiement/cheque/class/remisecheque.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 235e3a1aa75..9ed198eefa3 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2234,7 +2234,7 @@ class Commande extends CommonOrder $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; - $sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null'); + $sql.= " SET date_commande = ".($date ? "'".$this->db->idate($date)."'" : 'null'); $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; dol_syslog(__METHOD__, LOG_DEBUG); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 20afa14e0ca..03dffbabf34 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -861,8 +861,8 @@ class RemiseCheque extends CommonObject if ($user->rights->banque->cheque) { $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; - $sql.= " SET date_bordereau = ".($date ? $this->db->idate($date) : 'null'); - $sql.= " WHERE rowid = ".$this->id; + $sql.= " SET date_bordereau = '".($date ? $this->db->idate($date) : 'null'); + $sql.= "' WHERE rowid = ".$this->id; dol_syslog("RemiseCheque::set_date", LOG_DEBUG); $resql=$this->db->query($sql); -- GitLab