diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index d384eea9b91..09900e14d49 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -448,14 +448,14 @@ class Contrat extends CommonObject $this->extraparams = (array) json_decode($result["extraparams"], true); $this->db->free($resql); - + // Retreive all extrafield for thirdparty // fetch optionals attributes and labels require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); $extrafields=new ExtraFields($this->db); $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $this->fetch_optionals($this->id,$extralabels); - + return $this->id; } @@ -728,7 +728,7 @@ class Contrat extends CommonObject $sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,"; $sql.= " ref, entity, note_private, note_public)"; $sql.= " VALUES ('".$this->db->idate($now)."',".$this->socid.",".$user->id; - $sql.= ",".$this->db->idate($this->date_contrat); + $sql.= ", '".$this->db->idate($this->date_contrat)."'"; $sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL"); $sql.= ",".($this->commercial_suivi_id>0?$this->commercial_suivi_id:"NULL"); $sql.= ",".($this->fk_project>0?$this->fk_project:"NULL"); @@ -761,8 +761,8 @@ class Contrat extends CommonObject // Insert contacts commerciaux ('SALESREPFOLL','contrat') $result=$this->add_contact($this->commercial_suivi_id,'SALESREPFOLL','internal'); if ($result < 0) $error++; - - + + if (! $error) { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used