diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index eb07cddd4d7..5063af6c960 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -576,10 +576,6 @@ class Adherent extends CommonObject $sql.= ", state_id = ".($this->state_id>0?$this->db->escape($this->state_id):"null"); $sql.= ", email = '".$this->db->escape($this->email)."'"; $sql.= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'"; - // $sql.= ", skype = '".$this->db->escape($this->skype)."'"; - // $sql.= ", twitter = '".$this->db->escape($this->twitter)."'"; - // $sql.= ", facebook = '".$this->db->escape($this->facebook)."'"; - // $sql.= ", linkedin = '".$this->db->escape($this->linkedin)."'"; $sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null"); $sql.= ", phone_perso = ".($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null"); $sql.= ", phone_mobile = ".($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null"); @@ -703,10 +699,7 @@ class Adherent extends CommonObject $luser->state_id=$this->state_id; $luser->email=$this->email; - $luser->skype=$this->skype; - $luser->twitter=$this->twitter; - $luser->facebook=$this->facebook; - $luser->linkedin=$this->linkedin; + $luser->socialnetworks=$this->socialnetworks; $luser->office_phone=$this->phone; $luser->user_mobile=$this->phone_mobile; @@ -745,10 +738,7 @@ class Adherent extends CommonObject $lthirdparty->zip=$this->zip; $lthirdparty->town=$this->town; $lthirdparty->email=$this->email; - $lthirdparty->skype=$this->skype; - $lthirdparty->twitter=$this->twitter; - $lthirdparty->facebook=$this->facebook; - $lthirdparty->linkedin=$this->linkedin; + $lthirdparty->socialnetworks=$this->socialnetworks; $lthirdparty->phone=$this->phone; $lthirdparty->state_id=$this->state_id; $lthirdparty->country_id=$this->country_id; @@ -1237,7 +1227,7 @@ class Adherent extends CommonObject $sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_code, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,"; $sql.= " d.note_public,"; - $sql.= " d.email, d.socialnetworks, d.skype, d.twitter, d.facebook, d.linkedin, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; + $sql.= " d.email, d.socialnetworks, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql.= " d.datec as datec,"; $sql.= " d.tms as datem,"; @@ -1316,39 +1306,7 @@ class Adherent extends CommonObject $this->phone_mobile = $obj->phone_mobile; $this->email = $obj->email; - $arraysocialnetworks = array(); - $updatesocial = false; - if (!empty($obj->skype)) { - $arraysocialnetworks['skype'] = $obj->skype; - $updatesocial = true; - } - if (!empty($obj->twitter)) { - $arraysocialnetworks['twitter'] = $obj->twitter; - $updatesocial = true; - } - if (!empty($obj->facebook)) { - $arraysocialnetworks['facebook'] = $obj->facebook; - $updatesocial = true; - } - if (!empty($obj->linkedin)) { - $arraysocialnetworks['linkedin'] = $obj->linkedin; - $updatesocial = true; - } - $socialarray = ($obj->socialnetworks==''?array():json_decode($obj->socialnetworks, true)); - $this->socialnetworks = array_merge($arraysocialnetworks, $socialarray); - if ($updatesocial) { - $sqlupd = 'UPDATE '.MAIN_DB_PREFIX.'adherent SET skype=null'; - $sqlupd .= ', twitter=null'; - $sqlupd .= ', facebook=null'; - $sqlupd .= ', linkedin=null'; - $sqlupd .= ', socialnetworks="'.$this->db->escape(json_encode($this->socialnetworks)).'"'; - $sqlupd .= ' WHERE rowid='.$this->id; - $this->db->query($sqlupd); - } - $this->skype = $this->socialnetworks['skype']; - $this->twitter = $this->socialnetworks['twitter']; - $this->facebook = $this->socialnetworks['facebook']; - $this->linkedin = $this->socialnetworks['linkedin']; + $this->socialnetworks = (array) json_decode($obj->socialnetworks, true); $this->photo = $obj->photo; $this->statut = $obj->statut; @@ -2444,10 +2402,6 @@ class Adherent extends CommonObject $this->country = 'France'; $this->morphy = 'mor'; $this->email = 'specimen@specimen.com'; - $this->skype = 'skypepseudo'; - $this->twitter = 'twitterpseudo'; - $this->facebook = 'facebookpseudo'; - $this->linkedin = 'linkedinpseudo'; $this->socialnetworks = array( 'skype' => 'skypepseudo', 'twitter' => 'twitterpseudo', diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index a3e026c37f5..1f6fc8f34ae 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -386,11 +386,6 @@ class Contact extends CommonObject $sql .= ", fax='".$this->db->escape($this->fax)."'"; $sql .= ", email='".$this->db->escape($this->email)."'"; $sql .= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'"; - //$sql .= ", jabberid = ".(isset($this->jabberid)?"'".$this->db->escape($this->jabberid)."'":"null"); - //$sql .= ", skype='".$this->db->escape($this->skype)."'"; - //$sql .= ", twitter='".$this->db->escape($this->twitter)."'"; - //$sql .= ", facebook='".$this->db->escape($this->facebook)."'"; - //$sql .= ", linkedin='".$this->db->escape($this->linkedin)."'"; $sql .= ", photo='".$this->db->escape($this->photo)."'"; $sql .= ", birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null"); $sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); @@ -751,7 +746,7 @@ class Contact extends CommonObject $sql.= " c.fk_departement as state_id,"; $sql.= " c.birthday,"; $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email,"; - $sql.= " c.socialnetworks, c.jabberid, c.skype, c.twitter, c.facebook, c.linkedin,"; + $sql.= " c.socialnetworks,"; $sql.= " c.photo,"; $sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,"; $sql.= " c.import_key,"; @@ -820,45 +815,7 @@ class Contact extends CommonObject $this->phone_mobile = trim($obj->phone_mobile); $this->email = $obj->email; - $arraysocialnetworks = array(); - $updatesocial = false; - if (!empty($obj->jabberid)) { - $arraysocialnetworks['jabber'] = $obj->jabberid; - $updatesocial = true; - } - if (!empty($obj->skype)) { - $arraysocialnetworks['skype'] = $obj->skype; - $updatesocial = true; - } - if (!empty($obj->twitter)) { - $arraysocialnetworks['twitter'] = $obj->twitter; - $updatesocial = true; - } - if (!empty($obj->facebook)) { - $arraysocialnetworks['facebook'] = $obj->facebook; - $updatesocial = true; - } - if (!empty($obj->linkedin)) { - $arraysocialnetworks['linkedin'] = $obj->linkedin; - $updatesocial = true; - } - $socialarray = ($obj->socialnetworks==''?array():json_decode($obj->socialnetworks, true)); - $this->socialnetworks = array_merge($arraysocialnetworks, $socialarray); - if ($updatesocial) { - $sqlupd = 'UPDATE '.MAIN_DB_PREFIX.'socpeople SET skype=null'; - $sqlupd .= ', twitter=null'; - $sqlupd .= ', facebook=null'; - $sqlupd .= ', linkedin=null'; - $sqlupd .= ', jabberid=null'; - $sqlupd .= ', socialnetworks="'.$this->db->escape(json_encode($this->socialnetworks)).'"'; - $sqlupd .= ' WHERE rowid='.$this->id; - $this->db->query($sqlupd); - } - $this->jabberid = $this->socialnetworks['jabber']; - $this->skype = $this->socialnetworks['skype']; - $this->twitter = $this->socialnetworks['twitter']; - $this->facebook = $this->socialnetworks['facebook']; - $this->linkedin = $this->socialnetworks['linkedin']; + $this->socialnetworks = (array) json_decode($obj->socialnetworks, true); $this->photo = $obj->photo; $this->priv = $obj->priv; $this->mail = $obj->email; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 26646937656..3a6d76e30ef 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4944,21 +4944,21 @@ and rowid in (...) function migrate_users_socialnetworks() { global $db, $langs; - // jabberid,skype,twitter,facebook,linkedin,instagram,snapchat,googleplus,youtube,whatsapp + // skype,twitter,facebook,linkedin,instagram,snapchat,googleplus,youtube,whatsapp print '