diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 1faa9271623..6a2c69e32fe 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -659,8 +659,7 @@ class Adherent extends CommonObject $nbrowsaffected = 0; $error = 0; - dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncuser=".$nosyncuser.", nosyncuserpass=".$nosyncuserpass." nosyncthirdparty=".$nosyncthirdparty.", email=". - $this->email); + dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncuser=".$nosyncuser.", nosyncuserpass=".$nosyncuserpass." nosyncthirdparty=".$nosyncthirdparty.", email=".$this->email); // Clean parameters $this->lastname = trim($this->lastname) ? trim($this->lastname) : trim($this->lastname); @@ -693,7 +692,9 @@ class Adherent extends CommonObject $sql .= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman' $sql .= ", login = ".($this->login ? "'".$this->db->escape($this->login)."'" : "null"); $sql .= ", societe = ".($this->company ? "'".$this->db->escape($this->company)."'" : ($this->societe ? "'".$this->db->escape($this->societe)."'" : "null")); - $sql .= ", fk_soc = ".($this->socid > 0 ? $this->db->escape($this->socid) : "null"); + if ($this->socid) { + $sql .= ", fk_soc = ".($this->socid > 0 ? $this->db->escape($this->socid) : "null"); // Must be modified only when creating from a third-party + } $sql .= ", address = ".($this->address ? "'".$this->db->escape($this->address)."'" : "null"); $sql .= ", zip = ".($this->zip ? "'".$this->db->escape($this->zip)."'" : "null"); $sql .= ", town = ".($this->town ? "'".$this->db->escape($this->town)."'" : "null"); @@ -713,9 +714,6 @@ class Adherent extends CommonObject $sql .= ", fk_adherent_type = ".$this->db->escape($this->typeid); $sql .= ", morphy = '".$this->db->escape($this->morphy)."'"; $sql .= ", birth = ".($this->birth ? "'".$this->db->idate($this->birth)."'" : "null"); - if ($this->socid) { - $sql .= ", fk_soc = '".$this->db->escape($this->socid)."'"; // Must be modified only when creating from a third-party - } if ($this->datefin) { $sql .= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription }