From 628a14db0c80c0ec86ed3a65df2a14996afdd1c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Mar 2018 17:06:14 +0100 Subject: [PATCH] FIX Trad and creation date in subscription create --- htdocs/adherents/class/subscription.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 8d4b1884bab..1c4007780b9 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -77,15 +77,17 @@ class Subscription extends CommonObject $this->error=$langs->trans("ErrorBadValueForDate"); return -1; } + if (empty($this->datec)) $this->datec = $now; + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, datec, dateadh, datef, subscription, note)"; - $sql.= " VALUES (".$this->fk_adherent.", '".$this->db->idate($now)."',"; + $sql.= " VALUES (".$this->fk_adherent.", '".$this->db->idate($this->datec)."',"; $sql.= " '".$this->db->idate($this->dateh)."',"; $sql.= " '".$this->db->idate($this->datef)."',"; $sql.= " ".$this->amount.","; - $sql.= " '".$this->db->escape($this->note)."')"; + $sql.= " '".$this->db->escape($this->note_public?$this->note_public:$this->note)."')"; $resql = $this->db->query($sql); if (! $resql) { @@ -324,6 +326,8 @@ class Subscription extends CommonObject global $langs; $result=''; + + $langs->load("members"); $label=$langs->trans("ShowSubscription").': '.$this->ref; $linkstart = '';