From af63ac40514e6422c1251b823adbe437152767d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 14 Sep 2019 13:31:26 +0200 Subject: [PATCH] work on contact --- htdocs/adherents/card.php | 1 - htdocs/contact/card.php | 10 +++++++--- htdocs/contact/class/contact.class.php | 4 ++-- test/phpunit/ContactTest.php | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 1b099a55c10..cbc7e5774e9 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -487,7 +487,6 @@ if (empty($reshook)) $object->socialnetworks = array(); if (! empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - if (!$value['active']) break; $object->socialnetworks[$key] = GETPOST("member_".$key, 'alpha'); } } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 83143901148..d122ae509a7 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -196,7 +196,9 @@ if (empty($reshook)) $object->socialnetworks = array(); if (! empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - $object->socialnetworks[$key] = GETPOST($key, 'alphanohtml'); + if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') { + $object->socialnetworks[$key] = GETPOST($key, 'alphanohtml'); + } } } $object->email = GETPOST("email", 'alpha'); @@ -374,7 +376,9 @@ if (empty($reshook)) //$object->linkedin = GETPOST("linkedin", 'alpha'); if (! empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - $object->socialnetworks[$key] = GETPOST($key, 'alpha'); + if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') { + $object->socialnetworks[$key] = GETPOST($key, 'alphanohtml'); + } } } $object->phone_pro = GETPOST("phone_pro", 'alpha'); @@ -383,7 +387,7 @@ if (empty($reshook)) $object->fax = GETPOST("fax", 'alpha'); $object->priv = GETPOST("priv", 'int'); $object->note_public = GETPOST("note_public", 'none'); - $object->note_private = GETPOST("note_private", 'none'); + $object->note_private = GETPOST("note_private", 'none'); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 082c178ef12..2170927d2d7 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -750,8 +750,8 @@ class Contact extends CommonObject $sql.= " c.fk_pays as country_id,"; $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, c.jabberid,"; - $sql.= " c.socialnetworks, c.skype, c.twitter, c.facebook, c.linkedin,"; + $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.photo,"; $sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,"; $sql.= " c.import_key,"; diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index c0ed8d7843f..726b674220a 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -208,6 +208,7 @@ class ContactTest extends PHPUnit\Framework\TestCase $localobject->fax='New fax'; $localobject->email='newemail@newemail.com'; $localobject->jabberid='New im id'; + $localobject->socialnetworks['jabber']='New im id'; $localobject->default_lang='es_ES'; $result=$localobject->update($localobject->id, $user);