From a4e861397b920432746fc902e78927e3656feddf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Tue, 23 May 2006 21:15:33 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20La=20date=20des=20actions=20n'=E9tait=20?= =?UTF-8?q?pas=20toujours=20retourn=E9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/actioncomm.class.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php index a2dbf7aea26..65d11d3ad02 100644 --- a/htdocs/actioncomm.class.php +++ b/htdocs/actioncomm.class.php @@ -85,12 +85,12 @@ class ActionComm $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm"; $sql.= "(datec,"; - $sql.= "datep,"; + if ($this->percent < 100) $sql.= "datep,"; if ($this->percent == 100) $sql.= "datea,"; $sql.= "fk_action,fk_soc,note,fk_contact,fk_user_author,fk_user_action,label,percent,priority,"; $sql.= "fk_facture,propalrowid,fk_commande)"; $sql.= " VALUES (now(),"; - $sql.= "'".$this->db->idate($this->date)."',"; + if ($this->percent < 100) $sql.= "'".$this->db->idate($this->date)."',"; if ($this->percent == 100) $sql.= "'".$this->db->idate($this->date)."',"; $sql.= "'".$this->type_id."', '".$this->societe->id."' ,'".addslashes($this->note)."',"; $sql.= ($this->contact->id?$this->contact->id:"null").","; @@ -128,10 +128,13 @@ class ActionComm { global $langs; - $sql = "SELECT ".$this->db->pdate("a.datea")." as da, a.note, a.label, a.fk_action as type_id"; - $sql.= ", c.code, c.libelle, fk_soc, fk_user_author, fk_contact, fk_facture, a.percent, a.fk_commande"; + $sql = "SELECT ".$this->db->pdate("a.datea")." as datea,"; + $sql.= " ".$this->db->pdate("a.datep")." as datep,"; + $sql.= " ".$this->db->pdate("a.datec")." as datec, tms as datem,"; + $sql.= " a.note, a.label, a.fk_action as type_id,"; + $sql.= " c.code, c.libelle, fk_soc, fk_user_author, fk_contact, fk_facture, a.percent, a.fk_commande"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c"; - $sql.= " WHERE a.id=$id AND a.fk_action=c.id;"; + $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; $resql=$this->db->query($sql); if ($resql) @@ -147,7 +150,10 @@ class ActionComm $type_libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle); $this->type = $type_libelle; $this->label = $obj->label; - $this->date = $obj->da; + $this->date = $obj->datea; + $this->datep = $obj->datep; + $this->datec = $obj->datec; + $this->datem = $obj->datem; $this->note =$obj->note; $this->percent =$obj->percent; $this->societe->id = $obj->fk_soc; @@ -213,7 +219,7 @@ class ActionComm if ($this->percent == 100) $sql.= ", datea = now()"; if ($this->note) $sql.= ", note = '".addslashes($this->note)."'"; if ($this->contact->id) $sql.= ", fk_contact =". $this->contact->id; - $sql.= " WHERE id=$this->id;"; + $sql.= " WHERE id=".$this->id; if ($this->db->query($sql)) { -- GitLab