Merge pull request #11867 from frederic34/socialnetworks
NEW add socialnetworks dictionary
This commit is contained in:
commit
1aef1c60dd
@ -70,6 +70,8 @@ $extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$socialnetworks = getArrayOfSocialNetworks();
|
||||
|
||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||
$object->getCanvas($id);
|
||||
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
|
||||
@ -302,10 +304,16 @@ if (empty($reshook))
|
||||
$object->phone_perso = trim(GETPOST("phone_perso", 'alpha'));
|
||||
$object->phone_mobile= trim(GETPOST("phone_mobile", 'alpha'));
|
||||
$object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
|
||||
$object->skype = trim(GETPOST("skype", 'alpha'));
|
||||
$object->twitter = trim(GETPOST("twitter", 'alpha'));
|
||||
$object->facebook = trim(GETPOST("facebook", 'alpha'));
|
||||
$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
|
||||
$object->socialnetworks = array();
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') {
|
||||
$object->socialnetworks[$key] = trim(GETPOST($key, 'alphanohtml'));
|
||||
}
|
||||
}
|
||||
//$object->skype = trim(GETPOST("skype", 'alpha'));
|
||||
//$object->twitter = trim(GETPOST("twitter", 'alpha'));
|
||||
//$object->facebook = trim(GETPOST("facebook", 'alpha'));
|
||||
//$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
|
||||
$object->birth = $birthdate;
|
||||
|
||||
$object->typeid = GETPOST("typeid", 'int');
|
||||
@ -448,10 +456,10 @@ if (empty($reshook))
|
||||
$phone=GETPOST("phone", 'alpha');
|
||||
$phone_perso=GETPOST("phone_perso", 'alpha');
|
||||
$phone_mobile=GETPOST("phone_mobile", 'alpha');
|
||||
$skype=GETPOST("member_skype", 'alpha');
|
||||
$twitter=GETPOST("member_twitter", 'alpha');
|
||||
$facebook=GETPOST("member_facebook", 'alpha');
|
||||
$linkedin=GETPOST("member_linkedin", 'alpha');
|
||||
// $skype=GETPOST("member_skype", 'alpha');
|
||||
// $twitter=GETPOST("member_twitter", 'alpha');
|
||||
// $facebook=GETPOST("member_facebook", 'alpha');
|
||||
// $linkedin=GETPOST("member_linkedin", 'alpha');
|
||||
$email=preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
|
||||
$login=GETPOST("member_login", 'alpha');
|
||||
$pass=GETPOST("password", 'alpha');
|
||||
@ -478,11 +486,19 @@ if (empty($reshook))
|
||||
$object->phone = $phone;
|
||||
$object->phone_perso = $phone_perso;
|
||||
$object->phone_mobile= $phone_mobile;
|
||||
$object->socialnetworks = array();
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') {
|
||||
$object->socialnetworks[$key] = GETPOST("member_".$key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$object->skype = $skype;
|
||||
$object->twitter = $twitter;
|
||||
$object->facebook = $facebook;
|
||||
$object->linkedin = $linkedin;
|
||||
// $object->skype = $skype;
|
||||
// $object->twitter = $twitter;
|
||||
// $object->facebook = $facebook;
|
||||
// $object->linkedin = $linkedin;
|
||||
|
||||
$object->email = $email;
|
||||
$object->login = $login;
|
||||
@ -1028,29 +1044,12 @@ else
|
||||
// Mobile phone
|
||||
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOST('phone_mobile', 'alpha')?GETPOST('phone_mobile', 'alpha'):$object->phone_mobile).'"></td></tr>';
|
||||
|
||||
// Skype
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Skype").'</td><td><input type="text" name="member_skype" size="40" value="'.(GETPOST('member_skype', 'alpha')?GETPOST('member_skype', 'alpha'):$object->skype).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Twitter
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Twitter").'</td><td><input type="text" name="member_twitter" size="40" value="'.(GETPOST('member_twitter', 'alpha')?GETPOST('member_twitter', 'alpha'):$object->twitter).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Facebook
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Facebook").'</td><td><input type="text" name="member_facebook" size="40" value="'.(GETPOST('member_facebook', 'alpha')?GETPOST('member_facebook', 'alpha'):$object->facebook).'"></td></tr>';
|
||||
}
|
||||
|
||||
// LinkedIn
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LinkedIn").'</td><td><input type="text" name="member_linkedin" size="40" value="'.(GETPOST('member_linkedin', 'alpha')?GETPOST('member_linkedin', 'alpha'):$object->linkedin).'"></td></tr>';
|
||||
}
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (!$value['active']) break;
|
||||
print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="member_'.$key.'" size="40" value="'.(GETPOST('member_'.$key, 'alpha')?GETPOST('member_'.$key, 'alpha'):$object->socialnetworks[$key]).'"></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Birth Date
|
||||
print "<tr><td>".$langs->trans("DateToBirth")."</td><td>\n";
|
||||
@ -1297,29 +1296,12 @@ else
|
||||
// Mobile phone
|
||||
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(isset($_POST["phone_mobile"])?GETPOST("phone_mobile"):$object->phone_mobile).'"></td></tr>';
|
||||
|
||||
// Skype
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Skype").'</td><td><input type="text" name="skype" class="minwidth100" value="'.(isset($_POST["skype"])?GETPOST("skype"):$object->skype).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Twitter
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Twitter").'</td><td><input type="text" name="twitter" class="minwidth100" value="'.(isset($_POST["twitter"])?GETPOST("twitter"):$object->twitter).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Facebook
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Facebook").'</td><td><input type="text" name="facebook" class="minwidth100" value="'.(isset($_POST["facebook"])?GETPOST("facebook"):$object->facebook).'"></td></tr>';
|
||||
}
|
||||
|
||||
// LinkedIn
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LinkedIn").'</td><td><input type="text" name="linkedin" class="minwidth100" value="'.(isset($_POST["linkedin"])?GETPOST("linkedin"):$object->linkedin).'"></td></tr>';
|
||||
}
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (!$value['active']) break;
|
||||
print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="'.$key.'" class="minwidth100" value="'.(isset($_POST[$key])?GETPOST($key):$object->socialnetworks[$key]).'"></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Birth Date
|
||||
print "<tr><td>".$langs->trans("DateToBirth")."</td><td>\n";
|
||||
|
||||
@ -124,23 +124,32 @@ class Adherent extends CommonObject
|
||||
*/
|
||||
public $email;
|
||||
|
||||
/**
|
||||
* @var array array of socialnetworks
|
||||
*/
|
||||
public $socialnetworks;
|
||||
|
||||
/**
|
||||
* @var string skype account
|
||||
* @deprecated
|
||||
*/
|
||||
public $skype;
|
||||
|
||||
/**
|
||||
* @var string twitter account
|
||||
* @deprecated
|
||||
*/
|
||||
public $twitter;
|
||||
|
||||
/**
|
||||
* @var string facebook account
|
||||
* @deprecated
|
||||
*/
|
||||
public $facebook;
|
||||
|
||||
/**
|
||||
* @var string linkedin account
|
||||
* @deprecated
|
||||
*/
|
||||
public $linkedin;
|
||||
|
||||
@ -566,10 +575,7 @@ class Adherent extends CommonObject
|
||||
$sql.= ", country = ".($this->country_id>0?$this->db->escape($this->country_id):"null");
|
||||
$sql.= ", state_id = ".($this->state_id>0?$this->db->escape($this->state_id):"null");
|
||||
$sql.= ", email = '".$this->db->escape($this->email)."'";
|
||||
$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.= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'";
|
||||
$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");
|
||||
@ -694,10 +700,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;
|
||||
|
||||
@ -736,10 +739,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;
|
||||
@ -1228,7 +1228,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.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,";
|
||||
@ -1307,10 +1307,7 @@ class Adherent extends CommonObject
|
||||
$this->phone_mobile = $obj->phone_mobile;
|
||||
$this->email = $obj->email;
|
||||
|
||||
$this->skype = $obj->skype;
|
||||
$this->twitter = $obj->twitter;
|
||||
$this->facebook = $obj->facebook;
|
||||
$this->linkedin = $obj->linkedin;
|
||||
$this->socialnetworks = (array) json_decode($obj->socialnetworks, true);
|
||||
|
||||
$this->photo = $obj->photo;
|
||||
$this->statut = $obj->statut;
|
||||
@ -2385,10 +2382,12 @@ 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',
|
||||
'facebook' => 'facebookpseudo',
|
||||
'linkedin' => 'linkedinpseudo',
|
||||
);
|
||||
$this->phone = '0999999999';
|
||||
$this->phone_perso = '0999999998';
|
||||
$this->phone_mobile = '0999999997';
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -88,7 +89,7 @@ $hookmanager->initHooks(array('admin'));
|
||||
// Put here declaration of dictionaries properties
|
||||
|
||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,32,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,37,0,25,0);
|
||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,38,0,5,11,0,32,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,37,0,25,0);
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname=array();
|
||||
@ -130,6 +131,7 @@ $tabname[34]= MAIN_DB_PREFIX."c_hrm_function";
|
||||
$tabname[35]= MAIN_DB_PREFIX."c_exp_tax_cat";
|
||||
$tabname[36]= MAIN_DB_PREFIX."c_exp_tax_range";
|
||||
$tabname[37]= MAIN_DB_PREFIX."c_units";
|
||||
$tabname[38]= MAIN_DB_PREFIX."c_socialnetworks";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib=array();
|
||||
@ -170,6 +172,7 @@ $tablib[34]= "DictionaryFunction";
|
||||
$tablib[35]= "DictionaryExpenseTaxCat";
|
||||
$tablib[36]= "DictionaryExpenseTaxRange";
|
||||
$tablib[37]= "DictionaryMeasuringUnits";
|
||||
$tablib[38]= "DictionarySocialNetworks";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
@ -210,6 +213,7 @@ $tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PRE
|
||||
$tabsql[35]= "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
|
||||
$tabsql[36]= "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
|
||||
$tabsql[37]= "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
|
||||
$tabsql[38]= "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
@ -250,6 +254,7 @@ $tabsqlsort[34]="code ASC";
|
||||
$tabsqlsort[35]="c.label ASC";
|
||||
$tabsqlsort[36]="r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
|
||||
$tabsqlsort[37]="r.unit_type ASC, r.scale ASC, r.code ASC";
|
||||
$tabsqlsort[38]="rowid, code ASC";
|
||||
|
||||
// Field names in select result for dictionary display
|
||||
$tabfield=array();
|
||||
@ -290,6 +295,7 @@ $tabfield[34]= "code,label";
|
||||
$tabfield[35]= "label";
|
||||
$tabfield[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfield[37]= "code,label,short_label,unit_type,scale";
|
||||
$tabfield[38]= "code,label,url,icon,entity";
|
||||
|
||||
// Edit field names for editing a record
|
||||
$tabfieldvalue=array();
|
||||
@ -330,6 +336,7 @@ $tabfieldvalue[34]= "code,label";
|
||||
$tabfieldvalue[35]= "label";
|
||||
$tabfieldvalue[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfieldvalue[37]= "code,label,short_label,unit_type,scale";
|
||||
$tabfieldvalue[38]= "code,label,url,icon";
|
||||
|
||||
// Field names in the table for inserting a record
|
||||
$tabfieldinsert=array();
|
||||
@ -371,6 +378,7 @@ $tabfieldinsert[34]= "code,label";
|
||||
$tabfieldinsert[35]= "label";
|
||||
$tabfieldinsert[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfieldinsert[37]= "code,label,short_label,unit_type,scale";
|
||||
$tabfieldinsert[38]= "entity,code,label,url,icon";
|
||||
|
||||
// Rowid name of field depending if field is autoincrement on or off..
|
||||
// Use "" if id field is "rowid" and has autoincrement on
|
||||
@ -413,6 +421,7 @@ $tabrowid[34]= "rowid";
|
||||
$tabrowid[35]= "";
|
||||
$tabrowid[36]= "";
|
||||
$tabrowid[37]= "";
|
||||
$tabrowid[38]= "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond=array();
|
||||
@ -453,6 +462,7 @@ $tabcond[34]= ! empty($conf->hrm->enabled);
|
||||
$tabcond[35]= ! empty($conf->expensereport->enabled);
|
||||
$tabcond[36]= ! empty($conf->expensereport->enabled);
|
||||
$tabcond[37]= ! empty($conf->product->enabled);
|
||||
$tabcond[38]= ! empty($conf->socialnetworks->enabled);
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
@ -493,6 +503,7 @@ $tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[35] = array();
|
||||
$tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
|
||||
$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
@ -533,6 +544,7 @@ $tabfieldcheck[34] = array();
|
||||
$tabfieldcheck[35] = array();
|
||||
$tabfieldcheck[36] = array();
|
||||
$tabfieldcheck[37] = array();
|
||||
$tabfieldcheck[38] = array();
|
||||
|
||||
// Complete all arrays with entries found into modules
|
||||
complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck);
|
||||
|
||||
@ -62,6 +62,8 @@ $extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$socialnetworks = getArrayOfSocialNetworks();
|
||||
|
||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||
$object->getCanvas($id);
|
||||
$objcanvas=null;
|
||||
@ -186,17 +188,25 @@ if (empty($reshook))
|
||||
$object->town = GETPOST("town", 'alpha');
|
||||
$object->country_id = GETPOST("country_id", 'int');
|
||||
$object->state_id = GETPOST("state_id", 'int');
|
||||
$object->skype = GETPOST("skype", 'alpha');
|
||||
$object->twitter = GETPOST("twitter", 'alpha');
|
||||
$object->facebook = GETPOST("facebook", 'alpha');
|
||||
$object->linkedin = GETPOST("linkedin", 'alpha');
|
||||
//$object->jabberid = GETPOST("jabberid", 'alpha');
|
||||
//$object->skype = GETPOST("skype", 'alpha');
|
||||
//$object->twitter = GETPOST("twitter", 'alpha');
|
||||
//$object->facebook = GETPOST("facebook", 'alpha');
|
||||
//$object->linkedin = GETPOST("linkedin", 'alpha');
|
||||
$object->socialnetworks = array();
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') {
|
||||
$object->socialnetworks[$key] = GETPOST($key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
}
|
||||
$object->email = GETPOST("email", 'alpha');
|
||||
$object->no_email = GETPOST("no_email", "int");
|
||||
$object->phone_pro = GETPOST("phone_pro", 'alpha');
|
||||
$object->phone_perso = GETPOST("phone_perso", 'alpha');
|
||||
$object->phone_mobile = GETPOST("phone_mobile", 'alpha');
|
||||
$object->fax = GETPOST("fax", 'alpha');
|
||||
$object->jabberid = GETPOST("jabberid", 'alpha');
|
||||
$object->priv = GETPOST("priv", 'int');
|
||||
$object->note_public = GETPOST("note_public", 'none');
|
||||
$object->note_private = GETPOST("note_private", 'none');
|
||||
@ -378,19 +388,26 @@ if (empty($reshook))
|
||||
|
||||
$object->email = GETPOST("email", 'alpha');
|
||||
$object->no_email = GETPOST("no_email", "int");
|
||||
$object->skype = GETPOST("skype", 'alpha');
|
||||
$object->twitter = GETPOST("twitter", 'alpha');
|
||||
$object->facebook = GETPOST("facebook", 'alpha');
|
||||
$object->linkedin = GETPOST("linkedin", 'alpha');
|
||||
//$object->jabberid = GETPOST("jabberid", 'alpha');
|
||||
//$object->skype = GETPOST("skype", 'alpha');
|
||||
//$object->twitter = GETPOST("twitter", 'alpha');
|
||||
//$object->facebook = GETPOST("facebook", 'alpha');
|
||||
//$object->linkedin = GETPOST("linkedin", 'alpha');
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') {
|
||||
$object->socialnetworks[$key] = GETPOST($key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
}
|
||||
$object->phone_pro = GETPOST("phone_pro", 'alpha');
|
||||
$object->phone_perso = GETPOST("phone_perso", 'alpha');
|
||||
$object->phone_mobile = GETPOST("phone_mobile", 'alpha');
|
||||
$object->fax = GETPOST("fax", 'alpha');
|
||||
$object->jabberid = GETPOST("jabberid", 'alpha');
|
||||
$object->priv = GETPOST("priv", 'int');
|
||||
$object->note_public = GETPOST("note_public", 'none');
|
||||
$object->note_private = GETPOST("note_private", 'none');
|
||||
$object->roles = GETPOST("roles", 'array');
|
||||
$object->note_private = GETPOST("note_private", 'none');
|
||||
$object->roles = GETPOST("roles", 'array');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
@ -727,39 +744,53 @@ else
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
// Jabber
|
||||
if (! empty($conf->global->SOCIALNETWORKS_JABBER))
|
||||
{
|
||||
print '<tr><td><label for="skype">'.$form->editfieldkey('Jabber', 'jabberid', '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3"><input type="text" name="jabberid" id="jabberid" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("jabberid")?GETPOST("jabberid", 'alpha'):$object->jabberid).'"></td></tr>';
|
||||
}
|
||||
// Skype
|
||||
if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
|
||||
{
|
||||
print '<tr><td><label for="skype">'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3"><input type="text" name="skype" id="skype" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype", 'alpha'):$object->skype).'"></td></tr>';
|
||||
}
|
||||
// Twitter
|
||||
if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
|
||||
{
|
||||
print '<tr><td><label for="twitter">'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3"><input type="text" name="twitter" id="twitter" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter", 'alpha'):$object->twitter).'"></td></tr>';
|
||||
}
|
||||
// Facebook
|
||||
if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
|
||||
{
|
||||
print '<tr><td><label for="facebook">'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3"><input type="text" name="facebook" id="facebook" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("facebook")?GETPOST("facebook", 'alpha'):$object->facebook).'"></td></tr>';
|
||||
}
|
||||
// LinkedIn
|
||||
if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN))
|
||||
{
|
||||
print '<tr><td><label for="linkedin">'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3"><input type="text" name="linkedin" id="linkedin" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("linkedin")?GETPOST("linkedin", 'alpha'):$object->linkedin).'"></td></tr>';
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
print '<tr>';
|
||||
print '<td><label for="'.$value['label'].'">'.$form->editfieldkey($value['label'], $key, '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3">';
|
||||
print '<input type="text" name="'.$key.'" id="'.$key.'" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET($key)?GETPOST($key, 'alphanohtml'):$object->socialnetworks[$key]).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
} elseif (!empty($object->socialnetworks[$key])) {
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$object->socialnetworks[$key].'">';
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (! empty($conf->socialnetworks->enabled))
|
||||
// {
|
||||
// // Jabber
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_JABBER))
|
||||
// {
|
||||
// print '<tr><td><label for="skype">'.$form->editfieldkey('Jabber', 'jabberid', '', $object, 0).'</label></td>';
|
||||
// print '<td colspan="3"><input type="text" name="jabberid" id="jabberid" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("jabberid")?GETPOST("jabberid", 'alpha'):$object->jabberid).'"></td></tr>';
|
||||
// }
|
||||
// // Skype
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
|
||||
// {
|
||||
// print '<tr><td><label for="skype">'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'</label></td>';
|
||||
// print '<td colspan="3"><input type="text" name="skype" id="skype" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype", 'alpha'):$object->skype).'"></td></tr>';
|
||||
// }
|
||||
// // Twitter
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
|
||||
// {
|
||||
// print '<tr><td><label for="twitter">'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'</label></td>';
|
||||
// print '<td colspan="3"><input type="text" name="twitter" id="twitter" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter", 'alpha'):$object->twitter).'"></td></tr>';
|
||||
// }
|
||||
// // Facebook
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
|
||||
// {
|
||||
// print '<tr><td><label for="facebook">'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'</label></td>';
|
||||
// print '<td colspan="3"><input type="text" name="facebook" id="facebook" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("facebook")?GETPOST("facebook", 'alpha'):$object->facebook).'"></td></tr>';
|
||||
// }
|
||||
// // LinkedIn
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN))
|
||||
// {
|
||||
// print '<tr><td><label for="linkedin">'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'</label></td>';
|
||||
// print '<td colspan="3"><input type="text" name="linkedin" id="linkedin" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("linkedin")?GETPOST("linkedin", 'alpha'):$object->linkedin).'"></td></tr>';
|
||||
// }
|
||||
// }
|
||||
|
||||
// Visibility
|
||||
print '<tr><td><label for="priv">'.$langs->trans("ContactVisibility").'</label></td><td colspan="3">';
|
||||
@ -1028,39 +1059,53 @@ else
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
// Jabber ID
|
||||
if (! empty($conf->global->SOCIALNETWORKS_JABBER))
|
||||
{
|
||||
print '<tr><td><label for="jabberid">'.$form->editfieldkey('Jabber', 'jabberid', '', $object, 0).'</label></td>';
|
||||
print '<td><input type="text" name="jabberid" id="jabberid" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("jabberid")?GETPOST("jabberid", 'alpha'):$object->jabberid).'"></td></tr>';
|
||||
}
|
||||
// Skype
|
||||
if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
|
||||
{
|
||||
print '<tr><td><label for="skype">'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'</label></td>';
|
||||
print '<td><input type="text" name="skype" id="skype" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype", 'alpha'):$object->skype).'"></td></tr>';
|
||||
}
|
||||
// Twitter
|
||||
if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
|
||||
{
|
||||
print '<tr><td><label for="twitter">'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'</label></td>';
|
||||
print '<td><input type="text" name="twitter" id="twitter" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter", 'alpha'):$object->twitter).'"></td></tr>';
|
||||
}
|
||||
// Facebook
|
||||
if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
|
||||
{
|
||||
print '<tr><td><label for="facebook">'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'</label></td>';
|
||||
print '<td><input type="text" name="facebook" id="facebook" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("facebook")?GETPOST("facebook", 'alpha'):$object->facebook).'"></td></tr>';
|
||||
}
|
||||
// LinkedIn
|
||||
if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN))
|
||||
{
|
||||
print '<tr><td><label for="linkedin">'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'</label></td>';
|
||||
print '<td><input type="text" name="linkedin" id="linkedin" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("linkedin")?GETPOST("linkedin", 'alpha'):$object->linkedin).'"></td></tr>';
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
print '<tr>';
|
||||
print '<td><label for="'.$value['label'].'">'.$form->editfieldkey($value['label'], $key, '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3">';
|
||||
print '<input type="text" name="'.$key.'" id="'.$key.'" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET($key)?GETPOST($key, 'alphanohtml'):$object->socialnetworks[$key]).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
} elseif (!empty($object->socialnetworks[$key])) {
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$object->socialnetworks[$key].'">';
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (! empty($conf->socialnetworks->enabled))
|
||||
// {
|
||||
// // Jabber ID
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_JABBER))
|
||||
// {
|
||||
// print '<tr><td><label for="jabberid">'.$form->editfieldkey('Jabber', 'jabberid', '', $object, 0).'</label></td>';
|
||||
// print '<td><input type="text" name="jabberid" id="jabberid" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("jabberid")?GETPOST("jabberid", 'alpha'):$object->jabberid).'"></td></tr>';
|
||||
// }
|
||||
// // Skype
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
|
||||
// {
|
||||
// print '<tr><td><label for="skype">'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'</label></td>';
|
||||
// print '<td><input type="text" name="skype" id="skype" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype", 'alpha'):$object->skype).'"></td></tr>';
|
||||
// }
|
||||
// // Twitter
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
|
||||
// {
|
||||
// print '<tr><td><label for="twitter">'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'</label></td>';
|
||||
// print '<td><input type="text" name="twitter" id="twitter" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter", 'alpha'):$object->twitter).'"></td></tr>';
|
||||
// }
|
||||
// // Facebook
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
|
||||
// {
|
||||
// print '<tr><td><label for="facebook">'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'</label></td>';
|
||||
// print '<td><input type="text" name="facebook" id="facebook" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("facebook")?GETPOST("facebook", 'alpha'):$object->facebook).'"></td></tr>';
|
||||
// }
|
||||
// // LinkedIn
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN))
|
||||
// {
|
||||
// print '<tr><td><label for="linkedin">'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'</label></td>';
|
||||
// print '<td><input type="text" name="linkedin" id="linkedin" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("linkedin")?GETPOST("linkedin", 'alpha'):$object->linkedin).'"></td></tr>';
|
||||
// }
|
||||
// }
|
||||
|
||||
// Visibility
|
||||
print '<tr><td><label for="priv">'.$langs->trans("ContactVisibility").'</label></td><td colspan="3">';
|
||||
|
||||
@ -83,6 +83,11 @@ class Contact extends CommonObject
|
||||
public $civility_id; // In fact we store civility_code
|
||||
public $civility_code;
|
||||
public $civility;
|
||||
|
||||
/**
|
||||
* Address
|
||||
* @var string
|
||||
*/
|
||||
public $address;
|
||||
public $zip;
|
||||
public $town;
|
||||
@ -97,11 +102,60 @@ class Contact extends CommonObject
|
||||
public $statut; // 0=inactif, 1=actif
|
||||
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* Email
|
||||
* @var string
|
||||
*/
|
||||
public $email;
|
||||
public $no_email; // 1 = contact has globaly unsubscribe of all mass emailings
|
||||
|
||||
/**
|
||||
* Unsuscribe all : 1 = contact has globaly unsubscribe of all mass emailings
|
||||
* @var int
|
||||
*/
|
||||
public $no_email;
|
||||
|
||||
/**
|
||||
* @var array array of socialnetworks
|
||||
*/
|
||||
public $socialnetworks;
|
||||
|
||||
/**
|
||||
* Skype username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $skype;
|
||||
public $photo;
|
||||
|
||||
/**
|
||||
* Twitter username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $twitter;
|
||||
|
||||
/**
|
||||
* Facebook username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $facebook;
|
||||
|
||||
/**
|
||||
* Linkedin username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $linkedin;
|
||||
|
||||
/**
|
||||
* Jabber username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $jabberid;
|
||||
|
||||
public $photo;
|
||||
public $phone_pro;
|
||||
public $phone_perso;
|
||||
public $phone_mobile;
|
||||
@ -123,6 +177,10 @@ class Contact extends CommonObject
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
|
||||
/**
|
||||
* Old copy
|
||||
* @var Contact
|
||||
*/
|
||||
public $oldcopy; // To contains a clone of this when we need to save old properties of object
|
||||
|
||||
public $roles=array();
|
||||
@ -345,10 +403,7 @@ class Contact extends CommonObject
|
||||
$sql .= ", poste='".$this->db->escape($this->poste)."'";
|
||||
$sql .= ", fax='".$this->db->escape($this->fax)."'";
|
||||
$sql .= ", email='".$this->db->escape($this->email)."'";
|
||||
$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 .= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'";
|
||||
$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");
|
||||
@ -356,7 +411,6 @@ class Contact extends CommonObject
|
||||
$sql .= ", phone = ".(isset($this->phone_pro)?"'".$this->db->escape($this->phone_pro)."'":"null");
|
||||
$sql .= ", phone_perso = ".(isset($this->phone_perso)?"'".$this->db->escape($this->phone_perso)."'":"null");
|
||||
$sql .= ", phone_mobile = ".(isset($this->phone_mobile)?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||
$sql .= ", jabberid = ".(isset($this->jabberid)?"'".$this->db->escape($this->jabberid)."'":"null");
|
||||
$sql .= ", priv = '".$this->db->escape($this->priv)."'";
|
||||
$sql .= ", statut = ".$this->db->escape($this->statut);
|
||||
$sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape($user->id)."'":"NULL");
|
||||
@ -439,29 +493,34 @@ class Contact extends CommonObject
|
||||
$tmpobj->email = $this->email;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->skype != $this->skype)
|
||||
if (!empty(array_diff($tmpobj->socialnetworks, $this->socialnetworks)))
|
||||
{
|
||||
$tmpobj->skype = $this->skype;
|
||||
$tmpobj->socialnetworks = $this->socialnetworks;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->twitter != $this->twitter)
|
||||
{
|
||||
$tmpobj->twitter = $this->twitter;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->facebook != $this->facebook)
|
||||
{
|
||||
$tmpobj->facebook = $this->facebook;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->linkedin != $this->linkedin)
|
||||
{
|
||||
$tmpobj->linkedin = $this->linkedin;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
// if ($tmpobj->skype != $this->skype)
|
||||
// {
|
||||
// $tmpobj->skype = $this->skype;
|
||||
// $usermustbemodified++;
|
||||
// }
|
||||
// if ($tmpobj->twitter != $this->twitter)
|
||||
// {
|
||||
// $tmpobj->twitter = $this->twitter;
|
||||
// $usermustbemodified++;
|
||||
// }
|
||||
// if ($tmpobj->facebook != $this->facebook)
|
||||
// {
|
||||
// $tmpobj->facebook = $this->facebook;
|
||||
// $usermustbemodified++;
|
||||
// }
|
||||
// if ($tmpobj->linkedin != $this->linkedin)
|
||||
// {
|
||||
// $tmpobj->linkedin = $this->linkedin;
|
||||
// $usermustbemodified++;
|
||||
// }
|
||||
if ($usermustbemodified)
|
||||
{
|
||||
$result=$tmpobj->update($user, 0, 1, 1, 1);
|
||||
$result = $tmpobj->update($user, 0, 1, 1, 1);
|
||||
if ($result < 0) { $error++; }
|
||||
}
|
||||
}
|
||||
@ -713,7 +772,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, 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,";
|
||||
$sql.= " c.photo,";
|
||||
$sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,";
|
||||
$sql.= " c.import_key,";
|
||||
@ -782,11 +842,7 @@ class Contact extends CommonObject
|
||||
$this->phone_mobile = trim($obj->phone_mobile);
|
||||
|
||||
$this->email = $obj->email;
|
||||
$this->jabberid = $obj->jabberid;
|
||||
$this->skype = $obj->skype;
|
||||
$this->twitter = $obj->twitter;
|
||||
$this->facebook = $obj->facebook;
|
||||
$this->linkedin = $obj->linkedin;
|
||||
$this->socialnetworks = (array) json_decode($obj->socialnetworks, true);
|
||||
$this->photo = $obj->photo;
|
||||
$this->priv = $obj->priv;
|
||||
$this->mail = $obj->email;
|
||||
@ -1333,8 +1389,10 @@ class Contact extends CommonObject
|
||||
$this->country_code = 'FR';
|
||||
$this->country = 'France';
|
||||
$this->email = 'specimen@specimen.com';
|
||||
$this->skype = 'tom.hanson';
|
||||
|
||||
$this->skype = 'tom.hanson';
|
||||
$this->socialnetworks = array(
|
||||
'skype' => 'tom.hanson',
|
||||
);
|
||||
$this->phone_pro = '0909090901';
|
||||
$this->phone_perso = '0909090902';
|
||||
$this->phone_mobile = '0909090903';
|
||||
|
||||
@ -41,6 +41,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "suppliers", "categories"));
|
||||
|
||||
$socialnetworks = getArrayOfSocialNetworks();
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$massaction=GETPOST('massaction', 'alpha');
|
||||
$show_files=GETPOST('show_files', 'int');
|
||||
@ -71,10 +73,13 @@ $search_phone_mobile=GETPOST("search_phone_mobile", 'alpha');
|
||||
$search_fax=GETPOST("search_fax", 'alpha');
|
||||
$search_email=GETPOST("search_email", 'alpha');
|
||||
$search_no_email=GETPOST("search_no_email", 'int');
|
||||
$search_skype=GETPOST("search_skype", 'alpha');
|
||||
$search_twitter=GETPOST("search_twitter", 'alpha');
|
||||
$search_facebook=GETPOST("search_facebook", 'alpha');
|
||||
$search_linkedin=GETPOST("search_linkedin", 'alpha');
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
$search_{$key} = GETPOST("search_".$key, 'alpha');
|
||||
}
|
||||
}
|
||||
}
|
||||
$search_priv=GETPOST("search_priv", 'alpha');
|
||||
$search_categ=GETPOST("search_categ", 'int');
|
||||
$search_categ_thirdparty=GETPOST("search_categ_thirdparty", 'int');
|
||||
@ -168,11 +173,6 @@ $arrayfields=array(
|
||||
'p.fax'=>array('label'=>"Fax", 'checked'=>0),
|
||||
'p.email'=>array('label'=>"EMail", 'checked'=>1),
|
||||
'p.no_email'=>array('label'=>"No_Email", 'checked'=>0, 'enabled'=>(! empty($conf->mailing->enabled))),
|
||||
'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
|
||||
'p.jabberid'=>array('label'=>"Jabber", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
|
||||
'p.twitter'=>array('label'=>"Twitter", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
|
||||
'p.facebook'=>array('label'=>"Facebook", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
|
||||
'p.linkedin'=>array('label'=>"LinkedIn", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
|
||||
'p.thirdparty'=>array('label'=>"ThirdParty", 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
|
||||
'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200),
|
||||
'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500),
|
||||
@ -180,6 +180,16 @@ $arrayfields=array(
|
||||
'p.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||
'p.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
|
||||
);
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
$arrayfields['p.'.$key] = array(
|
||||
'label' => $value['label'],
|
||||
'checked' => 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||
{
|
||||
@ -236,10 +246,13 @@ if (empty($reshook))
|
||||
$search_fax="";
|
||||
$search_email="";
|
||||
$search_no_email=-1;
|
||||
$search_skype="";
|
||||
$search_twitter="";
|
||||
$search_facebook="";
|
||||
$search_linkedin="";
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
$search_{$key} = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
$search_priv="";
|
||||
$search_status=-1;
|
||||
$search_categ='';
|
||||
@ -275,7 +288,8 @@ $contactstatic=new Contact($db);
|
||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name,";
|
||||
$sql.= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email, p.skype,";
|
||||
$sql.= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email,";
|
||||
$sql.= " p.socialnetworks,";
|
||||
$sql.= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
|
||||
$sql.= " co.label as country, co.code as country_code";
|
||||
// Add fields from extrafields
|
||||
@ -337,10 +351,14 @@ if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $sear
|
||||
if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone_pro);
|
||||
if (strlen($search_phone_mobile)) $sql.= natural_search('p.phone_mobile', $search_phone_mobile);
|
||||
if (strlen($search_fax)) $sql.= natural_search('p.fax', $search_fax);
|
||||
if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype);
|
||||
if (strlen($search_twitter)) $sql.= natural_search('p.twitter', $search_twitter);
|
||||
if (strlen($search_facebook)) $sql.= natural_search('p.facebook', $search_facebook);
|
||||
if (strlen($search_linkedin)) $sql.= natural_search('p.linkedin', $search_linkedin);
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active'] && strlen($search_{$key})) {
|
||||
//$sql.= natural_search("p.socialnetworks->'$.".$key."'", $search_{$key});
|
||||
$sql.= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\'';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strlen($search_email)) $sql.= natural_search('p.email', $search_email);
|
||||
if (strlen($search_zip)) $sql.= natural_search("p.zip", $search_zip);
|
||||
if (strlen($search_town)) $sql.= natural_search("p.town", $search_town);
|
||||
@ -641,35 +659,17 @@ if (! empty($arrayfields['p.no_email']['checked']))
|
||||
print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.skype']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_skype" size="6" value="'.dol_escape_htmltag($search_skype).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.jabberid']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_jabberid" size="6" value="'.dol_escape_htmltag($search_jabberid).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.twitter']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_twitter" size="6" value="'.dol_escape_htmltag($search_twitter).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.facebook']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_facebook" size="6" value="'.dol_escape_htmltag($search_facebook).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.linkedin']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_linkedin" size="6" value="'.dol_escape_htmltag($search_linkedin).'">';
|
||||
print '</td>';
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
if (! empty($arrayfields['p.'.$key]['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_'.$key.'" size="6" value="'.dol_escape_htmltag($search_{$key}).'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! empty($arrayfields['p.thirdparty']['checked']))
|
||||
{
|
||||
@ -743,11 +743,13 @@ if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field
|
||||
if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'], $_SERVER["PHP_SELF"], "p.fax", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'], $_SERVER["PHP_SELF"], "p.skype", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.jabberid']['checked'])) print_liste_field_titre($arrayfields['p.jabberid']['label'], $_SERVER["PHP_SELF"], "p.jabberid", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.twitter']['checked'])) print_liste_field_titre($arrayfields['p.twitter']['label'], $_SERVER["PHP_SELF"], "p.twitter", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.facebook']['checked'])) print_liste_field_titre($arrayfields['p.facebook']['label'], $_SERVER["PHP_SELF"], "p.facebook", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.linkedin']['checked'])) print_liste_field_titre($arrayfields['p.linkedin']['label'], $_SERVER["PHP_SELF"], "p.linkedin", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active'] && ! empty($arrayfields['p.'.$key]['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.'.$key]['label'], $_SERVER["PHP_SELF"], "p.".$key, $begin, $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($arrayfields['p.thirdparty']['label'], $_SERVER["PHP_SELF"], "s.nom", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, '', $sortfield, $sortorder, 'center ');
|
||||
// Extra fields
|
||||
@ -784,7 +786,7 @@ while ($i < min($num, $limit))
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
$arraysocialnetworks = (array) json_decode($obj->socialnetworks, true);
|
||||
$contactstatic->lastname=$obj->lastname;
|
||||
$contactstatic->firstname='';
|
||||
$contactstatic->id=$obj->rowid;
|
||||
@ -796,6 +798,7 @@ while ($i < min($num, $limit))
|
||||
$contactstatic->phone_mobile=$obj->phone_mobile;
|
||||
$contactstatic->zip=$obj->zip;
|
||||
$contactstatic->town=$obj->town;
|
||||
$contactstatic->socialnetworks = $arraysocialnetworks;
|
||||
$contactstatic->country = $obj->country;
|
||||
$contactstatic->country_code = $obj->country_code;
|
||||
|
||||
@ -896,36 +899,14 @@ while ($i < min($num, $limit))
|
||||
print '<td align="center">'.yn($obj->no_email).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Skype
|
||||
if (! empty($arrayfields['p.skype']['checked']))
|
||||
{
|
||||
if (! empty($conf->socialnetworks->enabled)) { print '<td>'.dol_print_socialnetworks($obj->skype, $obj->rowid, $obj->socid, 'skype').'</td>'; }
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active'] && ! empty($arrayfields['p.'.$key]['checked'])) {
|
||||
print '<td>'.dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Jabber
|
||||
if (! empty($arrayfields['p.jabberid']['checked']))
|
||||
{
|
||||
if (! empty($conf->socialnetworks->enabled)) { print '<td>'.dol_print_socialnetworks($obj->jabberid, $obj->rowid, $obj->socid, 'jabberid').'</td>'; }
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Twitter
|
||||
if (! empty($arrayfields['p.twitter']['checked']))
|
||||
{
|
||||
if (! empty($conf->socialnetworks->enabled)) { print '<td>'.dol_print_socialnetworks($obj->twitter, $obj->rowid, $obj->socid, 'twitter').'</td>'; }
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Facebook
|
||||
if (! empty($arrayfields['p.facebook']['checked']))
|
||||
{
|
||||
if (! empty($conf->socialnetworks->enabled)) { print '<td>'.dol_print_socialnetworks($obj->facebook, $obj->rowid, $obj->socid, 'facebook').'</td>'; }
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// LinkedIn
|
||||
if (! empty($arrayfields['p.linkedin']['checked']))
|
||||
{
|
||||
if (! empty($conf->socialnetworks->enabled)) { print '<td>'.dol_print_socialnetworks($obj->linkedin, $obj->rowid, $obj->socid, 'linkedin').'</td>'; }
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Company
|
||||
if (! empty($arrayfields['p.thirdparty']['checked']))
|
||||
{
|
||||
|
||||
@ -692,16 +692,23 @@ abstract class CommonObject
|
||||
$out.='<div style="clear: both;">';
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
if ($this->skype) $out.=dol_print_socialnetworks($this->skype, $this->id, $object->id, 'skype');
|
||||
$outdone++;
|
||||
if ($this->jabberid) $out.=dol_print_socialnetworks($this->jabberid, $this->id, $object->id, 'jabber');
|
||||
$outdone++;
|
||||
if ($this->twitter) $out.=dol_print_socialnetworks($this->twitter, $this->id, $object->id, 'twitter');
|
||||
$outdone++;
|
||||
if ($this->facebook) $out.=dol_print_socialnetworks($this->facebook, $this->id, $object->id, 'facebook');
|
||||
$outdone++;
|
||||
if ($this->linkedin) $out.=dol_print_socialnetworks($this->linkedin, $this->id, $object->id, 'linkedin');
|
||||
$outdone++;
|
||||
if (is_array($this->socialnetworks) && count($this->socialnetworks)>0) {
|
||||
foreach ($this->socialnetworks as $key => $value) {
|
||||
$out.=dol_print_socialnetworks($value, $this->id, $object->id, $key);
|
||||
$outdone++;
|
||||
}
|
||||
} else {
|
||||
if ($this->skype) $out.=dol_print_socialnetworks($this->skype, $this->id, $object->id, 'skype');
|
||||
$outdone++;
|
||||
if ($this->jabberid) $out.=dol_print_socialnetworks($this->jabberid, $this->id, $object->id, 'jabber');
|
||||
$outdone++;
|
||||
if ($this->twitter) $out.=dol_print_socialnetworks($this->twitter, $this->id, $object->id, 'twitter');
|
||||
$outdone++;
|
||||
if ($this->facebook) $out.=dol_print_socialnetworks($this->facebook, $this->id, $object->id, 'facebook');
|
||||
$outdone++;
|
||||
if ($this->linkedin) $out.=dol_print_socialnetworks($this->linkedin, $this->id, $object->id, 'linkedin');
|
||||
$outdone++;
|
||||
}
|
||||
}
|
||||
$out.='</div>';
|
||||
|
||||
|
||||
@ -876,6 +876,8 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
$search_poste = GETPOST("search_poste", 'alpha');
|
||||
$search_roles = GETPOST("search_roles", 'array');
|
||||
|
||||
$socialnetworks = getArrayOfSocialNetworks();
|
||||
|
||||
$searchAddressPhoneDBFields = array(
|
||||
//Address
|
||||
't.address',
|
||||
@ -892,18 +894,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
|
||||
//E-mail
|
||||
't.email',
|
||||
|
||||
//Social media
|
||||
"t.skype",
|
||||
"t.jabberid",
|
||||
"t.twitter",
|
||||
"t.facebook",
|
||||
"t.linkedin",
|
||||
"t.whatsapp",
|
||||
"t.youtube",
|
||||
"t.snapchat",
|
||||
"t.instagram"
|
||||
);
|
||||
//Social media
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
$searchAddressPhoneDBFields['t.'.$key] = "t.socialnetworks->'$.".$key."'";
|
||||
}
|
||||
}
|
||||
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="t.lastname";
|
||||
@ -919,11 +916,11 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
$extrafields->fetch_name_optionals_label($contactstatic->table_element);
|
||||
|
||||
$contactstatic->fields=array(
|
||||
'name' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1),
|
||||
'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20),
|
||||
'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>30),
|
||||
'role' =>array('type'=>'checkbox', 'label'=>'Role', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>40),
|
||||
'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>50, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0, 1), 1=>$contactstatic->LibStatut(1, 1))),
|
||||
'name' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1),
|
||||
'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20),
|
||||
'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>30),
|
||||
'role' =>array('type'=>'checkbox', 'label'=>'Role', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>40),
|
||||
'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>50, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0, 1), 1=>$contactstatic->LibStatut(1, 1))),
|
||||
);
|
||||
|
||||
// Definition of fields for list
|
||||
@ -1020,7 +1017,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
$extrafieldsobjectkey=$contactstatic->table_element;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
$sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.skype, t.statut, t.photo,";
|
||||
$sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.socialnetworks, t.statut, t.photo,";
|
||||
$sql .= " t.civility as civility_id, t.address, t.zip, t.town";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
@ -1028,7 +1025,9 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
if ($search_status!='' && $search_status != '-1') $sql .= " AND t.statut = ".$db->escape($search_status);
|
||||
if ($search_name) $sql .= natural_search(array('t.lastname', 't.firstname'), $search_name);
|
||||
if ($search_poste) $sql .= natural_search('t.poste', $search_poste);
|
||||
if ($search_address) $sql .= natural_search($searchAddressPhoneDBFields, $search_address);
|
||||
if ($search_address) {
|
||||
$sql .= natural_search($searchAddressPhoneDBFields, $search_address);
|
||||
}
|
||||
if (count($search_roles)>0) {
|
||||
$sql .= " AND t.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".implode(',', $search_roles)."))";
|
||||
}
|
||||
@ -1132,7 +1131,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
$contactstatic->phone_perso = $obj->phone_perso;
|
||||
$contactstatic->email = $obj->email;
|
||||
$contactstatic->web = $obj->web;
|
||||
$contactstatic->skype = $obj->skype;
|
||||
$contactstatic->socialnetworks = $obj->socialnetworks;
|
||||
$contactstatic->photo = $obj->photo;
|
||||
|
||||
$country_code = getCountry($obj->country_id, 2);
|
||||
|
||||
@ -1899,7 +1899,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'tzserver', $outputlang
|
||||
|
||||
|
||||
/**
|
||||
* Return an array with locale date info.
|
||||
* Return an array with locale date info.
|
||||
* PHP getdate is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows
|
||||
* WARNING: This function always use PHP server timezone to return locale informations !!!
|
||||
* Usage must be avoid.
|
||||
@ -2037,9 +2037,9 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = false, $
|
||||
|
||||
|
||||
/**
|
||||
* Return date for now. In most cases, we use this function without parameters (that means GMT time).
|
||||
* Return date for now. In most cases, we use this function without parameters (that means GMT time).
|
||||
*
|
||||
* @param string $mode 'gmt' => we return GMT timestamp,
|
||||
* @param string $mode 'gmt' => we return GMT timestamp,
|
||||
* 'tzserver' => we add the PHP server timezone
|
||||
* 'tzref' => we add the company timezone
|
||||
* 'tzuser' => we add the user timezone
|
||||
@ -2198,6 +2198,32 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
|
||||
return $rep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get array of social network dictionary
|
||||
*
|
||||
* @return array Array of Social Networks Dictionary
|
||||
*/
|
||||
function getArrayOfSocialNetworks()
|
||||
{
|
||||
global $conf, $db;
|
||||
$sql = "SELECT rowid, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
|
||||
$sql.= " WHERE entity=".$conf->entity;
|
||||
$socialnetworks = array();
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$socialnetworks[$obj->code] = array(
|
||||
'rowid' => $obj->rowid,
|
||||
'label' => $obj->label,
|
||||
'url' => $obj->url,
|
||||
'icon' => $obj->icon,
|
||||
'active' => $obj->active,
|
||||
);
|
||||
}
|
||||
}
|
||||
return $socialnetworks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show social network link
|
||||
*
|
||||
@ -2211,42 +2237,43 @@ function dol_print_socialnetworks($value, $cid, $socid, $type)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
$newskype=$value;
|
||||
$htmllink=$value;
|
||||
|
||||
if (empty($value)) return ' ';
|
||||
|
||||
if (! empty($type))
|
||||
{
|
||||
$newskype ='<div class="divsocialnetwork inline-block valignmiddle">';
|
||||
$newskype.=img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright', 0);
|
||||
$newskype.=$value;
|
||||
$htmllink = '<div class="divsocialnetwork inline-block valignmiddle">';
|
||||
$htmllink .= img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright', 0);
|
||||
$htmllink .= $value;
|
||||
if ($type == 'skype')
|
||||
{
|
||||
$newskype.= ' ';
|
||||
$newskype.='<a href="skype:';
|
||||
$newskype.=$value;
|
||||
$newskype.='?call" alt="'.$langs->trans("Call").' '.$value.'" title="'.$langs->trans("Call").' '.$value.'">';
|
||||
$newskype.='<img src="'.DOL_URL_ROOT.'/theme/common/skype_callbutton.png" border="0">';
|
||||
$newskype.='</a><a href="skype:';
|
||||
$newskype.=$value;
|
||||
$newskype.='?chat" alt="'.$langs->trans("Chat").' '.$value.'" title="'.$langs->trans("Chat").' '.$value.'">';
|
||||
$newskype.='<img class="paddingleft" src="'.DOL_URL_ROOT.'/theme/common/skype_chatbutton.png" border="0">';
|
||||
$newskype.='</a>';
|
||||
$htmllink.= ' ';
|
||||
$htmllink.='<a href="skype:';
|
||||
$htmllink.=$value;
|
||||
$htmllink.='?call" alt="'.$langs->trans("Call").' '.$value.'" title="'.$langs->trans("Call").' '.$value.'">';
|
||||
$htmllink.='<img src="'.DOL_URL_ROOT.'/theme/common/skype_callbutton.png" border="0">';
|
||||
$htmllink.='</a><a href="skype:';
|
||||
$htmllink.=$value;
|
||||
$htmllink.='?chat" alt="'.$langs->trans("Chat").' '.$value.'" title="'.$langs->trans("Chat").' '.$value.'">';
|
||||
$htmllink.='<img class="paddingleft" src="'.DOL_URL_ROOT.'/theme/common/skype_chatbutton.png" border="0">';
|
||||
$htmllink.='</a>';
|
||||
}
|
||||
if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create && $type=='skype')
|
||||
{
|
||||
$addlink='AC_SKYPE'; $link='';
|
||||
$addlink='AC_SKYPE';
|
||||
$link='';
|
||||
if (! empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) $link='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&actioncode='.$addlink.'&contactid='.$cid.'&socid='.$socid.'">'.img_object($langs->trans("AddAction"), "calendar").'</a>';
|
||||
$newskype.=($link?' '.$link:'');
|
||||
$htmllink.=($link?' '.$link:'');
|
||||
}
|
||||
$newskype.='</div>';
|
||||
$htmllink.='</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
$newskype.=img_warning($langs->trans("ErrorBadSocialNetworkValue", $value));
|
||||
$htmllink.=img_warning($langs->trans("ErrorBadSocialNetworkValue", $value));
|
||||
}
|
||||
return $newskype;
|
||||
return $htmllink;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3033,6 +3060,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'stats',
|
||||
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'globe',
|
||||
'jabber','skype','twitter','facebook','linkedin',
|
||||
'instagram', 'snapchat', 'youtube', 'google-plus-g','whatsapp',
|
||||
'chevron-left','chevron-right','chevron-down','chevron-top',
|
||||
'home', 'companies', 'products', 'commercial', 'invoicing', 'accountancy', 'project', 'hrm', 'members', 'ticket', 'generic',
|
||||
'error','warning',
|
||||
@ -3146,7 +3174,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
elseif ($pictowithouttext == 'jabber') {
|
||||
$fakey = 'fa-comment-o';
|
||||
}
|
||||
elseif (in_array($pictowithouttext, array('skype', 'twitter', 'facebook', 'linkedin'))) {
|
||||
elseif (in_array($pictowithouttext, array('skype', 'twitter', 'facebook', 'linkedin', 'instagram','snapchat','youtube','google-plus-g','whatsapp'))) {
|
||||
$fakey = 'fa-'.$pictowithouttext;
|
||||
$fa = 'fab';
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ class modSocialNetworks extends DolibarrModules
|
||||
$this->dirs = array();
|
||||
|
||||
// Config pages
|
||||
$this->config_page_url = array("socialnetworks.php");
|
||||
$this->config_page_url = array(/*"socialnetworks.php"*/);
|
||||
|
||||
// Dependencies
|
||||
$this->hidden = ! empty($conf->global->MODULE_SOCIALNETWORKS_DISABLED); // A condition to hide module
|
||||
|
||||
@ -2209,7 +2209,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$response->label=$langs->trans("SupplierBillsToPay");
|
||||
$response->labelShort=$langs->trans("StatusToPay");
|
||||
|
||||
$response->url=DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=billing&leftmenu=suppliers_bills';
|
||||
$response->url=DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=billing&leftmenu=suppliers_bills';
|
||||
$response->img=img_object($langs->trans("Bills"), "bill");
|
||||
|
||||
$facturestatic = new FactureFournisseur($this->db);
|
||||
|
||||
@ -2194,7 +2194,7 @@ class Holiday extends CommonObject
|
||||
$response->warning_delay=$conf->holiday->approve->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("HolidaysToApprove");
|
||||
$response->labelShort=$langs->trans("ToApprove");
|
||||
$response->url=DOL_URL_ROOT.'/holiday/list.php?search_statut=2&mainmenu=hrm&leftmenu=holiday';
|
||||
$response->url=DOL_URL_ROOT.'/holiday/list.php?search_statut=2&mainmenu=hrm&leftmenu=holiday';
|
||||
$response->img=img_object('', "holiday");
|
||||
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
|
||||
55
htdocs/install/mysql/data/llx_c_socialnetworks.sql
Normal file
55
htdocs/install/mysql/data/llx_c_socialnetworks.sql
Normal file
@ -0,0 +1,55 @@
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
--
|
||||
|
||||
--
|
||||
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
|
||||
-- de l'install et tous les sigles '--' sont supprimés.
|
||||
--
|
||||
|
||||
-- socialnetworks
|
||||
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'facebook', 'Facebook', 'https://www.facebook.com/{socialid}', 'fa-facebook', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'skype', 'Skype', 'https://www.skype.com/{socialid}', 'fa-skype', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'twitter', 'Twitter', 'https://www.twitter.com/{socialid}', 'fa-twitter', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'linkedin', 'LinkedIn', 'https://www.linkedin.com/{socialid}', 'fa-linkedin', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'instagram', 'Instagram', 'https://www.instagram.com/{socialid}', 'fa-instagram', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'snapchat', 'Snapchat', '{socialid}', 'fa-snapchat', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'googleplus', 'GooglePlus', 'https://www.googleplus.com/{socialid}', 'fa-google-plus-g', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'youtube', 'Youtube', 'https://www.youtube.com/{socialid}', 'fa-youtube', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'whatsapp', 'Whatsapp', '{socialid}', 'fa-whatsapp', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'tumblr', 'Tumblr', 'https://www.tumblr.com/{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'vero', 'Vero', 'https://vero.co/{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'viadeo', 'Viadeo', 'https://fr.viadeo.com/fr/{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'slack', 'Slack', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'xing', 'Xing', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'meetup', 'Meetup', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'pinterest', 'Pinterest', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'flickr', 'Flickr', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, '500px', '500px', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'giphy', 'Giphy', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'gifycat', 'Gificat', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'dailymotion', 'Dailymotion', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'vimeo', 'Vimeo', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'periscope', 'Periscope', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'twitch', 'Twitch', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'discord', 'Discord', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'wikipedia', 'Wikipedia', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'reddit', 'Reddit', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'quora', 'Quora', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'tripadvisor', 'Tripadvisor', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'mastodon', 'Mastodon', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'diaspora', 'Diaspora', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'viber', 'Viber', '{socialid}', '', 0);
|
||||
@ -149,7 +149,6 @@ ALTER TABLE llx_oauth_token ADD COLUMN fk_soc integer DEFAULT NULL after token;
|
||||
|
||||
ALTER TABLE llx_adherent_type ADD COLUMN duration varchar(6) DEFAULT NULL after morphy;
|
||||
|
||||
|
||||
ALTER TABLE llx_mailing ADD COLUMN tms timestamp;
|
||||
ALTER TABLE llx_mailing_cibles ADD COLUMN tms timestamp;
|
||||
|
||||
@ -252,18 +251,69 @@ INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, m
|
||||
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('IN-GANDI', 0, 117, '', 0, 10, 2, 1);
|
||||
|
||||
|
||||
create table llx_c_socialnetworks
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
code varchar(100),
|
||||
label varchar(150),
|
||||
url text,
|
||||
icon varchar(20),
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code (code);
|
||||
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'facebook', 'Facebook', 'https://www.facebook.com/{socialid}', 'fa-facebook', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'skype', 'Skype', 'https://www.skype.com/{socialid}', 'fa-skype', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'twitter', 'Twitter', 'https://www.twitter.com/{socialid}', 'fa-twitter', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'linkedin', 'LinkedIn', 'https://www.linkedin.com/{socialid}', 'fa-linkedin', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'instagram', 'Instagram', 'https://www.instagram.com/{socialid}', 'fa-instagram', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'snapchat', 'Snapchat', '{socialid}', 'fa-snapchat', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'googleplus', 'GooglePlus', 'https://www.googleplus.com/{socialid}', 'fa-google-plus-g', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'youtube', 'Youtube', 'https://www.youtube.com/{socialid}', 'fa-youtube', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'whatsapp', 'Whatsapp', '{socialid}', 'fa-whatsapp', 1);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'tumblr', 'Tumblr', 'https://www.tumblr.com/{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'vero', 'Vero', 'https://vero.co/{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'viadeo', 'Viadeo', 'https://fr.viadeo.com/fr/{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'slack', 'Slack', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'xing', 'Xing', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'meetup', 'Meetup', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'pinterest', 'Pinterest', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'flickr', 'Flickr', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, '500px', '500px', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'giphy', 'Giphy', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'gifycat', 'Gificat', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'dailymotion', 'Dailymotion', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'vimeo', 'Vimeo', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'periscope', 'Periscope', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'twitch', 'Twitch', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'discord', 'Discord', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'wikipedia', 'Wikipedia', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'reddit', 'Reddit', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'quora', 'Quora', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'tripadvisor', 'Tripadvisor', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'mastodon', 'Mastodon', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'diaspora', 'Diaspora', '{socialid}', '', 0);
|
||||
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'viber', 'Viber', '{socialid}', '', 0);
|
||||
|
||||
ALTER TABLE llx_adherent ADD COLUMN socialnetworks text DEFAULT NULL AFTER email;
|
||||
ALTER TABLE llx_societe ADD COLUMN socialnetworks text DEFAULT NULL AFTER email;
|
||||
ALTER TABLE llx_socpeople ADD COLUMN socialnetworks text DEFAULT NULL AFTER email;
|
||||
ALTER TABLE llx_user ADD COLUMN socialnetworks text DEFAULT NULL AFTER personal_email;
|
||||
|
||||
ALTER TABLE llx_product ADD COLUMN net_measure float;
|
||||
ALTER TABLE llx_product ADD COLUMN net_measure_units tinyint;
|
||||
|
||||
create table llx_adherent_type_lang
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_type integer DEFAULT 0 NOT NULL,
|
||||
lang varchar(5) DEFAULT 0 NOT NULL,
|
||||
label varchar(255) NOT NULL,
|
||||
description text,
|
||||
email text,
|
||||
import_key varchar(14) DEFAULT NULL
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_type integer DEFAULT 0 NOT NULL,
|
||||
lang varchar(5) DEFAULT 0 NOT NULL,
|
||||
label varchar(255) NOT NULL,
|
||||
description text,
|
||||
email text,
|
||||
import_key varchar(14) DEFAULT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
create table llx_fichinter_rec
|
||||
|
||||
@ -48,6 +48,7 @@ create table llx_adherent
|
||||
country integer,
|
||||
email varchar(255),
|
||||
|
||||
socialnetworks text DEFAULT NULL, -- json with socialnetworks
|
||||
skype varchar(255),
|
||||
twitter varchar(255), --
|
||||
facebook varchar(255), --
|
||||
|
||||
19
htdocs/install/mysql/tables/llx_c_socialnetworks.key.sql
Normal file
19
htdocs/install/mysql/tables/llx_c_socialnetworks.key.sql
Normal file
@ -0,0 +1,19 @@
|
||||
-- ========================================================================
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ========================================================================
|
||||
|
||||
|
||||
ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code (code);
|
||||
27
htdocs/install/mysql/tables/llx_c_socialnetworks.sql
Normal file
27
htdocs/install/mysql/tables/llx_c_socialnetworks.sql
Normal file
@ -0,0 +1,27 @@
|
||||
-- ========================================================================
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ========================================================================
|
||||
|
||||
create table llx_c_socialnetworks
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
code varchar(100),
|
||||
label varchar(150),
|
||||
url text,
|
||||
icon varchar(20),
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
)ENGINE=innodb;
|
||||
@ -34,7 +34,7 @@ create table llx_societe
|
||||
statut tinyint DEFAULT 0, -- statut
|
||||
parent integer,
|
||||
|
||||
status tinyint DEFAULT 1, -- cessation d'activité ( 1 -- en activité, 0 -- cessation d'activité)
|
||||
status tinyint DEFAULT 1, -- cessation d'activité ( 1 -- en activité, 0 -- cessation d'activité)
|
||||
|
||||
code_client varchar(24), -- code client
|
||||
code_fournisseur varchar(24), -- code founisseur
|
||||
@ -50,7 +50,8 @@ create table llx_societe
|
||||
fax varchar(20), -- fax number
|
||||
url varchar(255), --
|
||||
email varchar(128), --
|
||||
|
||||
|
||||
socialnetworks text DEFAULT NULL, -- json with socialnetworks
|
||||
skype varchar(255), --
|
||||
twitter varchar(255), --
|
||||
facebook varchar(255), --
|
||||
@ -60,7 +61,7 @@ create table llx_societe
|
||||
googleplus varchar(255), --
|
||||
youtube varchar(255), --
|
||||
whatsapp varchar(255), --
|
||||
|
||||
|
||||
fk_effectif integer DEFAULT 0, --
|
||||
fk_typent integer DEFAULT 0, --
|
||||
fk_forme_juridique integer DEFAULT 0, -- juridical status
|
||||
@ -112,7 +113,7 @@ create table llx_societe
|
||||
fk_entrepot integer DEFAULT 0, -- if we need a link between third party and warehouse
|
||||
webservices_url varchar(255), -- supplier webservice url
|
||||
webservices_key varchar(128), -- supplier webservice key
|
||||
|
||||
|
||||
tms timestamp, -- last modification date
|
||||
datec datetime, -- creation date
|
||||
fk_user_creat integer NULL, -- utilisateur qui a cree l'info
|
||||
|
||||
@ -41,7 +41,8 @@ create table llx_socpeople
|
||||
phone_mobile varchar(30),
|
||||
fax varchar(30),
|
||||
email varchar(255),
|
||||
|
||||
|
||||
socialnetworks text DEFAULT NULL, -- json with socialnetworks
|
||||
jabberid varchar(255),
|
||||
skype varchar(255),
|
||||
twitter varchar(255), --
|
||||
@ -52,7 +53,7 @@ create table llx_socpeople
|
||||
googleplus varchar(255), --
|
||||
youtube varchar(255), --
|
||||
whatsapp varchar(255), --
|
||||
|
||||
|
||||
photo varchar(255),
|
||||
no_email smallint NOT NULL DEFAULT 0, -- deprecated. Use table llx_mailing_unsubscribe instead
|
||||
priv smallint NOT NULL DEFAULT 0,
|
||||
|
||||
@ -24,7 +24,7 @@ create table llx_user
|
||||
|
||||
ref_ext varchar(50), -- reference into an external system (not used by dolibarr)
|
||||
ref_int varchar(50), -- reference into an internal system (deprecated)
|
||||
|
||||
|
||||
employee tinyint DEFAULT 1, -- 1 if user is an employee
|
||||
fk_establishment integer DEFAULT 0,
|
||||
|
||||
@ -48,14 +48,15 @@ create table llx_user
|
||||
fk_state integer DEFAULT 0,
|
||||
fk_country integer DEFAULT 0,
|
||||
birth date, -- birthday
|
||||
job varchar(128),
|
||||
job varchar(128),
|
||||
office_phone varchar(20),
|
||||
office_fax varchar(20),
|
||||
user_mobile varchar(20),
|
||||
personal_mobile varchar(20),
|
||||
email varchar(255),
|
||||
personal_email varchar(255),
|
||||
|
||||
|
||||
socialnetworks text DEFAULT NULL, -- json with socialnetworks
|
||||
jabberid varchar(255),
|
||||
skype varchar(255),
|
||||
twitter varchar(255), --
|
||||
@ -66,7 +67,7 @@ create table llx_user
|
||||
googleplus varchar(255), --
|
||||
youtube varchar(255), --
|
||||
whatsapp varchar(255), --
|
||||
|
||||
|
||||
signature text DEFAULT NULL,
|
||||
admin smallint DEFAULT 0,
|
||||
module_comm smallint DEFAULT 1,
|
||||
|
||||
@ -451,6 +451,16 @@ if (! GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'a
|
||||
{
|
||||
migrate_user_photospath();
|
||||
}
|
||||
|
||||
// Scripts for 11.0
|
||||
$afterversionarray=explode('.', '10.0.9');
|
||||
$beforeversionarray=explode('.', '11.0.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
migrate_users_socialnetworks();
|
||||
migrate_members_socialnetworks();
|
||||
migrate_contacts_socialnetworks();
|
||||
migrate_thirdparties_socialnetworks();
|
||||
}
|
||||
}
|
||||
|
||||
// Code executed only if migration is LAST ONE. Must always be done.
|
||||
@ -4926,3 +4936,369 @@ On les corrige:
|
||||
update llx_facture set paye=1, fk_statut=2 where close_code is null
|
||||
and rowid in (...)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Migrate users fields facebook and co to socialnetworks
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function migrate_users_socialnetworks()
|
||||
{
|
||||
global $db, $langs;
|
||||
// skype,twitter,facebook,linkedin,instagram,snapchat,googleplus,youtube,whatsapp
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
print '<tr><td colspan="4">';
|
||||
$sql = 'SELECT rowid, socialnetworks';
|
||||
$sql .= ', skype, twitter, facebook, linkedin, instagram, snapchat, googleplus, youtube, whatsapp FROM '.MAIN_DB_PREFIX.'user WHERE ';
|
||||
$sql .= ' skype IS NOT NULL OR skype !=""';
|
||||
$sql .= ' OR twitter IS NOT NULL OR twitter !=""';
|
||||
$sql .= ' OR facebook IS NOT NULL OR facebook!=""';
|
||||
$sql .= ' OR linkedin IS NOT NULL OR linkedin!=""';
|
||||
$sql .= ' OR instagram IS NOT NULL OR instagram!=""';
|
||||
$sql .= ' OR snapchat IS NOT NULL OR snapchat!=""';
|
||||
$sql .= ' OR googleplus IS NOT NULL OR googleplus!=""';
|
||||
$sql .= ' OR youtube IS NOT NULL OR youtube!=""';
|
||||
$sql .= ' OR whatsapp IS NOT NULL OR whatsapp!=""';
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$arraysocialnetworks = array();
|
||||
if (!empty($obj->skype)) {
|
||||
$arraysocialnetworks['skype'] = $obj->skype;
|
||||
}
|
||||
if (!empty($obj->twitter)) {
|
||||
$arraysocialnetworks['twitter'] = $obj->twitter;
|
||||
}
|
||||
if (!empty($obj->facebook)) {
|
||||
$arraysocialnetworks['facebook'] = $obj->facebook;
|
||||
}
|
||||
if (!empty($obj->linkedin)) {
|
||||
$arraysocialnetworks['linkedin'] = $obj->linkedin;
|
||||
}
|
||||
if (!empty($obj->instagram)) {
|
||||
$arraysocialnetworks['instagram'] = $obj->instagram;
|
||||
}
|
||||
if (!empty($obj->snapchat)) {
|
||||
$arraysocialnetworks['snapchat'] = $obj->snapchat;
|
||||
}
|
||||
if (!empty($obj->googleplus)) {
|
||||
$arraysocialnetworks['googleplus'] = $obj->googleplus;
|
||||
}
|
||||
if (!empty($obj->youtube)) {
|
||||
$arraysocialnetworks['youtube'] = $obj->youtube;
|
||||
}
|
||||
if (!empty($obj->whatsapp)) {
|
||||
$arraysocialnetworks['whatsapp'] = $obj->whatsapp;
|
||||
}
|
||||
if ($obj->socialnetworks == '' || is_null($obj->socialnetworks)) {
|
||||
$obj->socialnetworks = '[]';
|
||||
}
|
||||
$socialnetworks = array_merge($arraysocialnetworks, json_decode($obj->socialnetworks, true));
|
||||
$sqlupd = 'UPDATE '.MAIN_DB_PREFIX.'user SET socialnetworks="'.$db->escape(json_encode($socialnetworks, true)).'"';
|
||||
$sqlupd.= ', skype=null';
|
||||
$sqlupd.= ', twitter=null';
|
||||
$sqlupd.= ', facebook=null';
|
||||
$sqlupd.= ', linkedin=null';
|
||||
$sqlupd.= ', instagram=null';
|
||||
$sqlupd.= ', snapchat=null';
|
||||
$sqlupd.= ', googleplus=null';
|
||||
$sqlupd.= ', youtube=null';
|
||||
$sqlupd.= ', whatsapp=null';
|
||||
$sqlupd.= ' WHERE rowid='.$obj->rowid;
|
||||
//print $sqlupd."<br>";
|
||||
$resqlupd = $db->query($sqlupd);
|
||||
if (! $resqlupd) {
|
||||
dol_print_error($db);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
$db->rollback();
|
||||
}
|
||||
print '<b>'.$langs->trans('MigrationUsersSocialNetworks')."</b><br>\n";
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate members fields facebook and co to socialnetworks
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function migrate_members_socialnetworks()
|
||||
{
|
||||
global $db, $langs;
|
||||
|
||||
print '<tr><td colspan="4">';
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
print '<tr><td colspan="4">';
|
||||
$sql = 'SELECT rowid, socialnetworks';
|
||||
$sql .= ', skype, twitter, facebook, linkedin, instagram, snapchat, googleplus, youtube, whatsapp FROM '.MAIN_DB_PREFIX.'adherent WHERE ';
|
||||
$sql .= ' skype IS NOT NULL OR skype!=""';
|
||||
$sql .= ' OR twitter IS NOT NULL OR twitter!=""';
|
||||
$sql .= ' OR facebook IS NOT NULL OR facebook!=""';
|
||||
$sql .= ' OR linkedin IS NOT NULL OR linkedin!=""';
|
||||
$sql .= ' OR instagram IS NOT NULL OR instagram!=""';
|
||||
$sql .= ' OR snapchat IS NOT NULL OR snapchat!=""';
|
||||
$sql .= ' OR googleplus IS NOT NULL OR googleplus!=""';
|
||||
$sql .= ' OR youtube IS NOT NULL OR youtube!=""';
|
||||
$sql .= ' OR whatsapp IS NOT NULL OR whatsapp!=""';
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$arraysocialnetworks = array();
|
||||
if (!empty($obj->skype)) {
|
||||
$arraysocialnetworks['skype'] = $obj->skype;
|
||||
}
|
||||
if (!empty($obj->twitter)) {
|
||||
$arraysocialnetworks['twitter'] = $obj->twitter;
|
||||
}
|
||||
if (!empty($obj->facebook)) {
|
||||
$arraysocialnetworks['facebook'] = $obj->facebook;
|
||||
}
|
||||
if (!empty($obj->linkedin)) {
|
||||
$arraysocialnetworks['linkedin'] = $obj->linkedin;
|
||||
}
|
||||
if (!empty($obj->instagram)) {
|
||||
$arraysocialnetworks['instagram'] = $obj->instagram;
|
||||
}
|
||||
if (!empty($obj->snapchat)) {
|
||||
$arraysocialnetworks['snapchat'] = $obj->snapchat;
|
||||
}
|
||||
if (!empty($obj->googleplus)) {
|
||||
$arraysocialnetworks['googleplus'] = $obj->googleplus;
|
||||
}
|
||||
if (!empty($obj->youtube)) {
|
||||
$arraysocialnetworks['youtube'] = $obj->youtube;
|
||||
}
|
||||
if (!empty($obj->whatsapp)) {
|
||||
$arraysocialnetworks['whatsapp'] = $obj->whatsapp;
|
||||
}
|
||||
if ($obj->socialnetworks == '' || is_null($obj->socialnetworks)) {
|
||||
$obj->socialnetworks = '[]';
|
||||
}
|
||||
$socialnetworks = array_merge($arraysocialnetworks, json_decode($obj->socialnetworks, true));
|
||||
$sqlupd = 'UPDATE '.MAIN_DB_PREFIX.'adherent SET socialnetworks="'.$db->escape(json_encode($socialnetworks, true)).'"';
|
||||
$sqlupd.= ', skype=null';
|
||||
$sqlupd.= ', twitter=null';
|
||||
$sqlupd.= ', facebook=null';
|
||||
$sqlupd.= ', linkedin=null';
|
||||
$sqlupd.= ', instagram=null';
|
||||
$sqlupd.= ', snapchat=null';
|
||||
$sqlupd.= ', googleplus=null';
|
||||
$sqlupd.= ', youtube=null';
|
||||
$sqlupd.= ', whatsapp=null';
|
||||
$sqlupd.= ' WHERE rowid='.$obj->rowid;
|
||||
//print $sqlupd."<br>";
|
||||
$resqlupd = $db->query($sqlupd);
|
||||
if (! $resqlupd) {
|
||||
dol_print_error($db);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
$db->rollback();
|
||||
}
|
||||
print '<b>'.$langs->trans('MigrationMembersSocialNetworks')."</b><br>\n";
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate contacts fields facebook and co to socialnetworks
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function migrate_contacts_socialnetworks()
|
||||
{
|
||||
global $db, $langs;
|
||||
// jabberid,skype,twitter,facebook,linkedin,instagram,snapchat,googleplus,youtube,whatsapp
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
print '<tr><td colspan="4">';
|
||||
$sql = 'SELECT rowid, socialnetworks';
|
||||
$sql .= ', jabberid, skype, twitter, facebook, linkedin, instagram, snapchat, googleplus, youtube, whatsapp FROM '.MAIN_DB_PREFIX.'socpeople WHERE ';
|
||||
$sql .= ' jabberid IS NOT NULL OR jabberid!=""';
|
||||
$sql .= ' OR skype IS NOT NULL OR skype!=""';
|
||||
$sql .= ' OR twitter IS NOT NULL OR twitter!=""';
|
||||
$sql .= ' OR facebook IS NOT NULL OR facebook!=""';
|
||||
$sql .= ' OR linkedin IS NOT NULL OR linkedin!=""';
|
||||
$sql .= ' OR instagram IS NOT NULL OR instagram!=""';
|
||||
$sql .= ' OR snapchat IS NOT NULL OR snapchat!=""';
|
||||
$sql .= ' OR googleplus IS NOT NULL OR googleplus!=""';
|
||||
$sql .= ' OR youtube IS NOT NULL OR youtube!=""';
|
||||
$sql .= ' OR whatsapp IS NOT NULL OR whatsapp!=""';
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$arraysocialnetworks = array();
|
||||
if (!empty($obj->jabberid)) {
|
||||
$arraysocialnetworks['jabber'] = $obj->jabberid;
|
||||
}
|
||||
if (!empty($obj->skype)) {
|
||||
$arraysocialnetworks['skype'] = $obj->skype;
|
||||
}
|
||||
if (!empty($obj->twitter)) {
|
||||
$arraysocialnetworks['twitter'] = $obj->twitter;
|
||||
}
|
||||
if (!empty($obj->facebook)) {
|
||||
$arraysocialnetworks['facebook'] = $obj->facebook;
|
||||
}
|
||||
if (!empty($obj->linkedin)) {
|
||||
$arraysocialnetworks['linkedin'] = $obj->linkedin;
|
||||
}
|
||||
if (!empty($obj->instagram)) {
|
||||
$arraysocialnetworks['instagram'] = $obj->instagram;
|
||||
}
|
||||
if (!empty($obj->snapchat)) {
|
||||
$arraysocialnetworks['snapchat'] = $obj->snapchat;
|
||||
}
|
||||
if (!empty($obj->googleplus)) {
|
||||
$arraysocialnetworks['googleplus'] = $obj->googleplus;
|
||||
}
|
||||
if (!empty($obj->youtube)) {
|
||||
$arraysocialnetworks['youtube'] = $obj->youtube;
|
||||
}
|
||||
if (!empty($obj->whatsapp)) {
|
||||
$arraysocialnetworks['whatsapp'] = $obj->whatsapp;
|
||||
}
|
||||
if ($obj->socialnetworks == '' || is_null($obj->socialnetworks)) {
|
||||
$obj->socialnetworks = '[]';
|
||||
}
|
||||
$socialnetworks = array_merge($arraysocialnetworks, json_decode($obj->socialnetworks, true));
|
||||
$sqlupd = 'UPDATE '.MAIN_DB_PREFIX.'socpeople SET socialnetworks="'.$db->escape(json_encode($socialnetworks, true)).'"';
|
||||
$sqlupd.= ', jabberid=null';
|
||||
$sqlupd.= ', skype=null';
|
||||
$sqlupd.= ', twitter=null';
|
||||
$sqlupd.= ', facebook=null';
|
||||
$sqlupd.= ', linkedin=null';
|
||||
$sqlupd.= ', instagram=null';
|
||||
$sqlupd.= ', snapchat=null';
|
||||
$sqlupd.= ', googleplus=null';
|
||||
$sqlupd.= ', youtube=null';
|
||||
$sqlupd.= ', whatsapp=null';
|
||||
$sqlupd.= ' WHERE rowid='.$obj->rowid;
|
||||
//print $sqlupd."<br>";
|
||||
$resqlupd = $db->query($sqlupd);
|
||||
if (! $resqlupd) {
|
||||
dol_print_error($db);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
$db->rollback();
|
||||
}
|
||||
print '<b>'.$langs->trans('MigrationContactsSocialNetworks')."</b><br>\n";
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate thirdparties fields facebook and co to socialnetworks
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function migrate_thirdparties_socialnetworks()
|
||||
{
|
||||
global $db, $langs;
|
||||
// skype,twitter,facebook,linkedin,instagram,snapchat,googleplus,youtube,whatsapp
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
print '<tr><td colspan="4">';
|
||||
$sql = 'SELECT rowid, socialnetworks';
|
||||
$sql .= ', skype, twitter, facebook, linkedin, instagram, snapchat, googleplus, youtube, whatsapp FROM '.MAIN_DB_PREFIX.'societe WHERE ';
|
||||
$sql .= ' skype IS NOT NULL OR skype!=""';
|
||||
$sql .= ' OR twitter IS NOT NULL OR twitter!=""';
|
||||
$sql .= ' OR facebook IS NOT NULL OR facebook!=""';
|
||||
$sql .= ' OR linkedin IS NOT NULL OR linkedin!=""';
|
||||
$sql .= ' OR instagram IS NOT NULL OR instagram!=""';
|
||||
$sql .= ' OR snapchat IS NOT NULL OR snapchat!=""';
|
||||
$sql .= ' OR googleplus IS NOT NULL OR googleplus!=""';
|
||||
$sql .= ' OR youtube IS NOT NULL OR youtube!=""';
|
||||
$sql .= ' OR whatsapp IS NOT NULL OR whatsapp!=""';
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$arraysocialnetworks = array();
|
||||
if (!empty($obj->skype)) {
|
||||
$arraysocialnetworks['skype'] = $obj->skype;
|
||||
}
|
||||
if (!empty($obj->twitter)) {
|
||||
$arraysocialnetworks['twitter'] = $obj->twitter;
|
||||
}
|
||||
if (!empty($obj->facebook)) {
|
||||
$arraysocialnetworks['facebook'] = $obj->facebook;
|
||||
}
|
||||
if (!empty($obj->linkedin)) {
|
||||
$arraysocialnetworks['linkedin'] = $obj->linkedin;
|
||||
}
|
||||
if (!empty($obj->instagram)) {
|
||||
$arraysocialnetworks['instagram'] = $obj->instagram;
|
||||
}
|
||||
if (!empty($obj->snapchat)) {
|
||||
$arraysocialnetworks['snapchat'] = $obj->snapchat;
|
||||
}
|
||||
if (!empty($obj->googleplus)) {
|
||||
$arraysocialnetworks['googleplus'] = $obj->googleplus;
|
||||
}
|
||||
if (!empty($obj->youtube)) {
|
||||
$arraysocialnetworks['youtube'] = $obj->youtube;
|
||||
}
|
||||
if (!empty($obj->whatsapp)) {
|
||||
$arraysocialnetworks['whatsapp'] = $obj->whatsapp;
|
||||
}
|
||||
if ($obj->socialnetworks == '' || is_null($obj->socialnetworks)) {
|
||||
$obj->socialnetworks = '[]';
|
||||
}
|
||||
$socialnetworks = array_merge($arraysocialnetworks, json_decode($obj->socialnetworks, true));
|
||||
$sqlupd = 'UPDATE '.MAIN_DB_PREFIX.'societe SET socialnetworks="'.$db->escape(json_encode($socialnetworks, true)).'"';
|
||||
$sqlupd.= ', skype=null';
|
||||
$sqlupd.= ', twitter=null';
|
||||
$sqlupd.= ', facebook=null';
|
||||
$sqlupd.= ', linkedin=null';
|
||||
$sqlupd.= ', instagram=null';
|
||||
$sqlupd.= ', snapchat=null';
|
||||
$sqlupd.= ', googleplus=null';
|
||||
$sqlupd.= ', youtube=null';
|
||||
$sqlupd.= ', whatsapp=null';
|
||||
$sqlupd.= ' WHERE rowid='.$obj->rowid;
|
||||
//print $sqlupd."<br>";
|
||||
$resqlupd = $db->query($sqlupd);
|
||||
if (! $resqlupd) {
|
||||
dol_print_error($db);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
$db->rollback();
|
||||
}
|
||||
print '<b>'.$langs->trans('MigrationThirdpartiesSocialNetworks')."</b><br>\n";
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ SystemToolsAreaDesc=This area provides administration functions. Use the menu to
|
||||
Purge=Purge
|
||||
PurgeAreaDesc=This page allows you to delete all files generated or stored by Dolibarr (temporary files or all files in <b>%s</b> directory). Using this feature is not normally necessary. It is provided as a workaround for users whose Dolibarr is hosted by a provider that does not offer permissions to delete files generated by the web server.
|
||||
PurgeDeleteLogFile=Delete log files, including <b>%s</b> defined for Syslog module (no risk of losing data)
|
||||
PurgeDeleteTemporaryFiles=Delete all temporary files (no risk of losing data). Note: Deletion is done only if the temp directory was created 24 hours ago.
|
||||
PurgeDeleteTemporaryFiles=Delete all temporary files (no risk of losing data). Note: Deletion is done only if the temp directory was created 24 hours ago.
|
||||
PurgeDeleteTemporaryFilesShort=Delete temporary files
|
||||
PurgeDeleteAllFilesInDocumentsDir=Delete all files in directory: <b>%s</b>.<br>This will delete all generated documents related to elements (third parties, invoices etc...), files uploaded into the ECM module, database backup dumps and temporary files.
|
||||
PurgeRunNow=Purge now
|
||||
@ -476,7 +476,7 @@ TheKeyIsTheNameOfHtmlField=This is the name of the HTML field. Technical knowled
|
||||
PageUrlForDefaultValues=You must enter the relative path of the page URL. If you include parameters in URL, the default values will be effective if all parameters are set to same value.
|
||||
PageUrlForDefaultValuesCreate=<br>Example:<br>For the form to create a new third party, it is <strong>%s</strong>.<br>For URL of external modules installed into custom directory, do not include the "custom/", so use path like <strong>mymodule/mypage.php</strong> and not custom/mymodule/mypage.php.<br>If you want default value only if url has some parameter, you can use <strong>%s</strong>
|
||||
PageUrlForDefaultValuesList=<br>Example:<br>For the page that lists third parties, it is <strong>%s</strong>.<br>For URL of external modules installed into custom directory, do not include the "custom/" so use a path like <strong>mymodule/mypagelist.php</strong> and not custom/mymodule/mypagelist.php.<br>If you want default value only if url has some parameter, you can use <strong>%s</strong>
|
||||
AlsoDefaultValuesAreEffectiveForActionCreate=Also note that overwritting default values for form creation works only for pages that were correctly designed (so with parameter action=create or presend...)
|
||||
AlsoDefaultValuesAreEffectiveForActionCreate=Also note that overwritting default values for form creation works only for pages that were correctly designed (so with parameter action=create or presend...)
|
||||
EnableDefaultValues=Enable customization of default values
|
||||
EnableOverwriteTranslation=Enable usage of overwritten translation
|
||||
GoIntoTranslationMenuToChangeThis=A translation has been found for the key with this code. To change this value, you must edit it from Home-Setup-translation.
|
||||
@ -964,6 +964,7 @@ DictionaryAccountancyJournal=Accounting journals
|
||||
DictionaryEMailTemplates=Email Templates
|
||||
DictionaryUnits=Units
|
||||
DictionaryMeasuringUnits=Measuring Units
|
||||
DictionarySocialNetworks=Social Networks
|
||||
DictionaryProspectStatus=Prospect status
|
||||
DictionaryHolidayTypes=Types of leave
|
||||
DictionaryOpportunityStatus=Lead status for project/lead
|
||||
|
||||
@ -205,6 +205,10 @@ MigrationRemiseExceptEntity=Update entity field value of llx_societe_remise_exce
|
||||
MigrationUserRightsEntity=Update entity field value of llx_user_rights
|
||||
MigrationUserGroupRightsEntity=Update entity field value of llx_usergroup_rights
|
||||
MigrationUserPhotoPath=Migration of photo paths for users
|
||||
MigrationUsersSocialNetworks=Migration of users fields social networks
|
||||
MigrationMembersSocialNetworks=Migration of members fields social networks
|
||||
MigrationContactsSocialNetworks=Migration of contacts fields social networks
|
||||
MigrationThirdpartiesSocialNetworks=Migration of thirdparties fields social networks
|
||||
MigrationReloadModule=Reload module %s
|
||||
MigrationResetBlockedLog=Reset module BlockedLog for v7 algorithm
|
||||
ShowNotAvailableOptions=Show unavailable options
|
||||
|
||||
@ -70,6 +70,8 @@ $extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$socialnetworks = getArrayOfSocialNetworks();
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('thirdpartycard','globalcard'));
|
||||
|
||||
@ -147,7 +149,7 @@ if (empty($reshook))
|
||||
$object->client = $object->client | $soc_origin->client;
|
||||
$object->fournisseur = $object->fournisseur | $soc_origin->fournisseur;
|
||||
$listofproperties=array(
|
||||
'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'twitter', 'facebook', 'linkedin', 'url', 'barcode',
|
||||
'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'twitter', 'facebook', 'linkedin', 'socialnetworks', 'url', 'barcode',
|
||||
'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6',
|
||||
'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'remise_supplier_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis',
|
||||
'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency',
|
||||
@ -407,11 +409,19 @@ if (empty($reshook))
|
||||
$object->town = GETPOST('town', 'alpha');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
$object->skype = GETPOST('skype', 'alpha');
|
||||
$object->twitter = GETPOST('twitter', 'alpha');
|
||||
$object->facebook = GETPOST('facebook', 'alpha');
|
||||
$object->linkedin = GETPOST('linkedin', 'alpha');
|
||||
$object->phone = GETPOST('phone', 'alpha');
|
||||
//$object->skype = GETPOST('skype', 'alpha');
|
||||
//$object->twitter = GETPOST('twitter', 'alpha');
|
||||
//$object->facebook = GETPOST('facebook', 'alpha');
|
||||
//$object->linkedin = GETPOST('linkedin', 'alpha');
|
||||
$object->socialnetworks = array();
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') {
|
||||
$object->socialnetworks[$key] = GETPOST($key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
}
|
||||
$object->phone = GETPOST('phone', 'alpha');
|
||||
$object->fax = GETPOST('fax', 'alpha');
|
||||
$object->email = trim(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL));
|
||||
$object->url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
|
||||
@ -974,10 +984,18 @@ else
|
||||
$object->zip = GETPOST('zipcode', 'alpha');
|
||||
$object->town = GETPOST('town', 'alpha');
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
$object->skype = GETPOST('skype', 'alpha');
|
||||
$object->twitter = GETPOST('twitter', 'alpha');
|
||||
$object->facebook = GETPOST('facebook', 'alpha');
|
||||
$object->linkedin = GETPOST('linkedin', 'alpha');
|
||||
//$object->skype = GETPOST('skype', 'alpha');
|
||||
//$object->twitter = GETPOST('twitter', 'alpha');
|
||||
//$object->facebook = GETPOST('facebook', 'alpha');
|
||||
//$object->linkedin = GETPOST('linkedin', 'alpha');
|
||||
$object->socialnetworks = array();
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') {
|
||||
$object->socialnetworks[$key] = GETPOST($key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
}
|
||||
$object->phone = GETPOST('phone', 'alpha');
|
||||
$object->fax = GETPOST('fax', 'alpha');
|
||||
$object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL);
|
||||
@ -1304,42 +1322,57 @@ else
|
||||
print '<tr><td>'.img_picto('', 'globe').' '.$form->editfieldkey('Web', 'url', '', $object, 0).'</td>';
|
||||
print '<td colspan="3"><input type="text" name="url" id="url" value="'.$object->url.'"></td></tr>';
|
||||
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
// Skype
|
||||
if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
|
||||
{
|
||||
print '<tr><td>'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<input type="text" name="skype" class="minwidth100" maxlength="80" id="skype" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype", 'alpha'):$object->skype).'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Twitter
|
||||
if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
|
||||
{
|
||||
print '<tr><td>'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<input type="text" name="twitter" class="minwidth100" maxlength="80" id="twitter" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter", 'alpha'):$object->twitter).'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Facebook
|
||||
if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
|
||||
{
|
||||
print '<tr><td>'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<input type="text" name="facebook" class="minwidth100" maxlength="80" id="facebook" value="'.dol_escape_htmltag(GETPOSTISSET("facebook")?GETPOST("facebook", 'alpha'):$object->facebook).'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
// LinkedIn
|
||||
if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN))
|
||||
{
|
||||
print '<tr><td>'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<input type="text" name="linkedin" class="minwidth100" maxlength="80" id="linkedin" value="'.dol_escape_htmltag(GETPOSTISSET("linkedin")?GETPOST("linkedin", 'alpha'):$object->linkedin).'">';
|
||||
print '</td></tr>';
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
print '<tr>';
|
||||
print '<td><label for="'.$value['label'].'">'.$form->editfieldkey($value['label'], $key, '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3">';
|
||||
print '<input type="text" name="'.$key.'" id="'.$key.'" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET($key)?GETPOST($key, 'alphanohtml'):$object->socialnetworks[$key]).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
} elseif (!empty($object->socialnetworks[$key])) {
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$object->socialnetworks[$key].'">';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (! empty($conf->socialnetworks->enabled))
|
||||
// {
|
||||
// // Skype
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
|
||||
// {
|
||||
// print '<tr><td>'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'</td>';
|
||||
// print '<td colspan="3">';
|
||||
// print '<input type="text" name="skype" class="minwidth100" maxlength="80" id="skype" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype", 'alpha'):$object->skype).'">';
|
||||
// print '</td></tr>';
|
||||
// }
|
||||
// // Twitter
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
|
||||
// {
|
||||
// print '<tr><td>'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'</td>';
|
||||
// print '<td colspan="3">';
|
||||
// print '<input type="text" name="twitter" class="minwidth100" maxlength="80" id="twitter" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter", 'alpha'):$object->twitter).'">';
|
||||
// print '</td></tr>';
|
||||
// }
|
||||
// // Facebook
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
|
||||
// {
|
||||
// print '<tr><td>'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'</td>';
|
||||
// print '<td colspan="3">';
|
||||
// print '<input type="text" name="facebook" class="minwidth100" maxlength="80" id="facebook" value="'.dol_escape_htmltag(GETPOSTISSET("facebook")?GETPOST("facebook", 'alpha'):$object->facebook).'">';
|
||||
// print '</td></tr>';
|
||||
// }
|
||||
// // LinkedIn
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN))
|
||||
// {
|
||||
// print '<tr><td>'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'</td>';
|
||||
// print '<td colspan="3">';
|
||||
// print '<input type="text" name="linkedin" class="minwidth100" maxlength="80" id="linkedin" value="'.dol_escape_htmltag(GETPOSTISSET("linkedin")?GETPOST("linkedin", 'alpha'):$object->linkedin).'">';
|
||||
// print '</td></tr>';
|
||||
// }
|
||||
// }
|
||||
|
||||
// Prof ids
|
||||
$i=1; $j=0;
|
||||
while ($i <= 6)
|
||||
@ -1612,10 +1645,18 @@ else
|
||||
$object->town = GETPOST('town', 'alpha');
|
||||
$object->country_id = GETPOST('country_id')?GETPOST('country_id', 'int'):$mysoc->country_id;
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
$object->skype = GETPOST('skype', 'alpha');
|
||||
$object->twitter = GETPOST('twitter', 'alpha');
|
||||
$object->facebook = GETPOST('facebook', 'alpha');
|
||||
$object->linkedin = GETPOST('linkedin', 'alpha');
|
||||
//$object->skype = GETPOST('skype', 'alpha');
|
||||
//$object->twitter = GETPOST('twitter', 'alpha');
|
||||
//$object->facebook = GETPOST('facebook', 'alpha');
|
||||
//$object->linkedin = GETPOST('linkedin', 'alpha');
|
||||
$object->socialnetworks = array();
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') {
|
||||
$object->socialnetworks[$key] = GETPOST($key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
}
|
||||
$object->phone = GETPOST('phone', 'alpha');
|
||||
$object->fax = GETPOST('fax', 'alpha');
|
||||
$object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL);
|
||||
@ -1927,33 +1968,47 @@ else
|
||||
print '<tr><td>'.img_picto('', 'globe').' '.$form->editfieldkey('Web', 'url', GETPOST('url', 'alpha'), $object, 0).'</td>';
|
||||
print '<td colspan="3"><input type="text" name="url" id="url" class="maxwidth100onsmartphone quatrevingtpercent" value="'.(GETPOSTISSET('url')?GETPOST('url', 'alpha'):$object->irl).'"></td></tr>';
|
||||
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
// Skype
|
||||
if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
|
||||
{
|
||||
print '<tr><td>'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'</td>';
|
||||
print '<td colspan="3"><input type="text" name="skype" id="skype" value="'.$object->skype.'"></td></tr>';
|
||||
}
|
||||
// Twitter
|
||||
if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
|
||||
{
|
||||
print '<tr><td>'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'</td>';
|
||||
print '<td colspan="3"><input type="text" name="twitter" id="twitter" value="'.$object->twitter.'"></td></tr>';
|
||||
}
|
||||
// Facebook
|
||||
if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
|
||||
{
|
||||
print '<tr><td>'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'</td>';
|
||||
print '<td colspan="3"><input type="text" name="facebook" id="facebook" value="'.$object->facebook.'"></td></tr>';
|
||||
}
|
||||
// LinkedIn
|
||||
if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN))
|
||||
{
|
||||
print '<tr><td>'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'</td>';
|
||||
print '<td colspan="3"><input type="text" name="linkedin" id="linkedin" value="'.$object->linkedin.'"></td></tr>';
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
print '<tr>';
|
||||
print '<td><label for="'.$value['label'].'">'.$form->editfieldkey($value['label'], $key, '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3">';
|
||||
print '<input type="text" name="'.$key.'" id="'.$key.'" class="minwidth100" maxlength="80" value="'.$object->socialnetworks[$key].'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
} elseif (!empty($object->socialnetworks[$key])) {
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$object->socialnetworks[$key].'">';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (! empty($conf->socialnetworks->enabled))
|
||||
// {
|
||||
// // Skype
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
|
||||
// {
|
||||
// print '<tr><td>'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'</td>';
|
||||
// print '<td colspan="3"><input type="text" name="skype" id="skype" value="'.$object->skype.'"></td></tr>';
|
||||
// }
|
||||
// // Twitter
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
|
||||
// {
|
||||
// print '<tr><td>'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'</td>';
|
||||
// print '<td colspan="3"><input type="text" name="twitter" id="twitter" value="'.$object->twitter.'"></td></tr>';
|
||||
// }
|
||||
// // Facebook
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
|
||||
// {
|
||||
// print '<tr><td>'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'</td>';
|
||||
// print '<td colspan="3"><input type="text" name="facebook" id="facebook" value="'.$object->facebook.'"></td></tr>';
|
||||
// }
|
||||
// // LinkedIn
|
||||
// if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN))
|
||||
// {
|
||||
// print '<tr><td>'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'</td>';
|
||||
// print '<td colspan="3"><input type="text" name="linkedin" id="linkedin" value="'.$object->linkedin.'"></td></tr>';
|
||||
// }
|
||||
// }
|
||||
|
||||
// Prof ids
|
||||
$i=1; $j=0;
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
||||
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -200,24 +201,35 @@ class Societe extends CommonObject
|
||||
* @var string
|
||||
*/
|
||||
public $email;
|
||||
|
||||
/**
|
||||
* @var array array of socialnetworks
|
||||
*/
|
||||
public $socialnetworks;
|
||||
|
||||
/**
|
||||
* Skype username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $skype;
|
||||
|
||||
/**
|
||||
* Twitter username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $twitter;
|
||||
/**
|
||||
* Facebook username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $facebook;
|
||||
/**
|
||||
* LinkedIn username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $linkedin;
|
||||
/**
|
||||
@ -873,10 +885,6 @@ class Societe extends CommonObject
|
||||
$this->fax = preg_replace("/\s/", "", $this->fax);
|
||||
$this->fax = preg_replace("/\./", "", $this->fax);
|
||||
$this->email = trim($this->email);
|
||||
$this->skype = trim($this->skype);
|
||||
$this->twitter = trim($this->twitter);
|
||||
$this->facebook = trim($this->facebook);
|
||||
$this->linkedin = trim($this->linkedin);
|
||||
$this->url = $this->url?clean_url($this->url, 0):'';
|
||||
$this->note_private = trim($this->note_private);
|
||||
$this->note_public = trim($this->note_public);
|
||||
@ -1016,11 +1024,8 @@ class Societe extends CommonObject
|
||||
|
||||
$sql .= ",phone = ".(! empty($this->phone)?"'".$this->db->escape($this->phone)."'":"null");
|
||||
$sql .= ",fax = ".(! empty($this->fax)?"'".$this->db->escape($this->fax)."'":"null");
|
||||
$sql .= ",email = ".(! empty($this->email)?"'".$this->db->escape($this->email)."'":"null");
|
||||
$sql .= ",skype = ".(! empty($this->skype)?"'".$this->db->escape($this->skype)."'":"null");
|
||||
$sql .= ",twitter = ".(! empty($this->twitter)?"'".$this->db->escape($this->twitter)."'":"null");
|
||||
$sql .= ",facebook = ".(! empty($this->facebook)?"'".$this->db->escape($this->facebook)."'":"null");
|
||||
$sql .= ",linkedin = ".(! empty($this->linkedin)?"'".$this->db->escape($this->linkedin)."'":"null");
|
||||
$sql .= ",email = ".(! empty($this->email)?"'".$this->db->escape($this->email)."'":"null");
|
||||
$sql .= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'";
|
||||
$sql .= ",url = ".(! empty($this->url)?"'".$this->db->escape($this->url)."'":"null");
|
||||
|
||||
$sql .= ",parent = " . ($this->parent > 0 ? $this->parent : "null");
|
||||
@ -1162,10 +1167,7 @@ class Societe extends CommonObject
|
||||
$lmember->zip=$this->zip;
|
||||
$lmember->town=$this->town;
|
||||
$lmember->email=$this->email;
|
||||
$lmember->skype=$this->skype;
|
||||
$lmember->twitter=$this->twitter;
|
||||
$lmember->facebook=$this->facebook;
|
||||
$lmember->linkedin=$this->linkedin;
|
||||
$lmember->socialnetworks=$this->socialnetworks;
|
||||
$lmember->phone=$this->phone;
|
||||
$lmember->state_id=$this->state_id;
|
||||
$lmember->country_id=$this->country_id;
|
||||
@ -1272,7 +1274,9 @@ class Societe extends CommonObject
|
||||
$sql .= ', s.status';
|
||||
$sql .= ', s.price_level';
|
||||
$sql .= ', s.tms as date_modification, s.fk_user_creat, s.fk_user_modif';
|
||||
$sql .= ', s.phone, s.fax, s.email, s.skype, s.twitter, s.facebook, s.linkedin, s.url, s.zip, s.town, s.note_private, s.note_public, s.model_pdf, s.client, s.fournisseur';
|
||||
$sql .= ', s.phone, s.fax, s.email';
|
||||
$sql .= ', s.socialnetworks';
|
||||
$sql .= ', s.url, s.zip, s.town, s.note_private, s.note_public, s.model_pdf, s.client, s.fournisseur';
|
||||
$sql .= ', s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6';
|
||||
$sql .= ', s.capital, s.tva_intra';
|
||||
$sql .= ', s.fk_typent as typent_id';
|
||||
@ -1324,7 +1328,7 @@ class Societe extends CommonObject
|
||||
$num=$this->db->num_rows($resql);
|
||||
if ($num > 1)
|
||||
{
|
||||
$this->error='Fetch found several records. Rename one of tirdparties to avoid duplicate.';
|
||||
$this->error='Fetch found several records. Rename one of thirdparties to avoid duplicate.';
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
$result = -2;
|
||||
}
|
||||
@ -1365,11 +1369,9 @@ class Societe extends CommonObject
|
||||
$this->stcomm_id = $obj->fk_stcomm; // id status prospect
|
||||
$this->status_prospect_label = $label; // label status prospect
|
||||
|
||||
$this->email = $obj->email;
|
||||
$this->skype = $obj->skype;
|
||||
$this->twitter = $obj->twitter;
|
||||
$this->facebook = $obj->facebook;
|
||||
$this->linkedin = $obj->linkedin;
|
||||
$this->email = $obj->email;
|
||||
$this->socialnetworks = (array) json_decode($obj->socialnetworks, true);
|
||||
|
||||
$this->url = $obj->url;
|
||||
$this->phone = $obj->phone;
|
||||
$this->fax = $obj->fax;
|
||||
@ -3391,10 +3393,7 @@ class Societe extends CommonObject
|
||||
$this->country_id=$member->country_id;
|
||||
$this->phone=$member->phone; // Prof phone
|
||||
$this->email=$member->email;
|
||||
$this->skype=$member->skype;
|
||||
$this->twitter=$member->twitter;
|
||||
$this->facebook=$member->facebook;
|
||||
$this->linkedin=$member->linkedin;
|
||||
$this->socialnetworks = $member->socialnetworks;
|
||||
|
||||
$this->client = 1; // A member is a customer by default
|
||||
$this->code_client = ($customercode?$customercode:-1);
|
||||
@ -3562,10 +3561,12 @@ class Societe extends CommonObject
|
||||
$this->country_id=1;
|
||||
$this->country_code='FR';
|
||||
$this->email='specimen@specimen.com';
|
||||
$this->skype='tom.hanson';
|
||||
$this->twitter='tomhanson';
|
||||
$this->facebook='tomhanson';
|
||||
$this->linkedin='tomhanson';
|
||||
$this->socialnetworks = array(
|
||||
'skype' => 'tom.hanson',
|
||||
'twitter' => 'tomhanson',
|
||||
'facebook' => 'tomhanson',
|
||||
'linkedin' => 'tomhanson',
|
||||
);
|
||||
$this->url='http://www.specimen.com';
|
||||
|
||||
$this->phone='0909090901';
|
||||
|
||||
@ -99,6 +99,8 @@ $extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$socialnetworks = getArrayOfSocialNetworks();
|
||||
|
||||
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
|
||||
$hookmanager->initHooks(array('usercard', 'globalcard'));
|
||||
|
||||
@ -107,7 +109,6 @@ $hookmanager->initHooks(array('usercard', 'globalcard'));
|
||||
/**
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array('id' => $id, 'socid' => $socid, 'group' => $group, 'caneditgroup' => $caneditgroup);
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
@ -211,10 +212,16 @@ if (empty($reshook)) {
|
||||
$object->office_fax = GETPOST("office_fax", 'alphanohtml');
|
||||
$object->user_mobile = GETPOST("user_mobile", 'alphanohtml');
|
||||
|
||||
$object->skype = GETPOST("skype", 'alphanohtml');
|
||||
$object->twitter = GETPOST("twitter", 'alphanohtml');
|
||||
$object->facebook = GETPOST("facebook", 'alphanohtml');
|
||||
$object->linkedin = GETPOST("linkedin", 'alphanohtml');
|
||||
//$object->skype = GETPOST("skype", 'alphanohtml');
|
||||
//$object->twitter = GETPOST("twitter", 'alphanohtml');
|
||||
//$object->facebook = GETPOST("facebook", 'alphanohtml');
|
||||
//$object->linkedin = GETPOST("linkedin", 'alphanohtml');
|
||||
$object->socialnetworks = array();
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
$object->socialnetworks[$key] = GETPOST($key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
|
||||
$object->email = preg_replace('/\s+/', '', GETPOST("email", 'alphanohtml'));
|
||||
$object->job = GETPOST("job", 'nohtml');
|
||||
@ -366,12 +373,16 @@ if (empty($reshook)) {
|
||||
$object->office_phone = GETPOST("office_phone", 'alphanohtml');
|
||||
$object->office_fax = GETPOST("office_fax", 'alphanohtml');
|
||||
$object->user_mobile = GETPOST("user_mobile", 'alphanohtml');
|
||||
|
||||
$object->skype = GETPOST("skype", 'alphanohtml');
|
||||
$object->twitter = GETPOST("twitter", 'alphanohtml');
|
||||
$object->facebook = GETPOST("facebook", 'alphanohtml');
|
||||
$object->linkedin = GETPOST("linkedin", 'alphanohtml');
|
||||
|
||||
//$object->skype = GETPOST("skype", 'alphanohtml');
|
||||
//$object->twitter = GETPOST("twitter", 'alphanohtml');
|
||||
//$object->facebook = GETPOST("facebook", 'alphanohtml');
|
||||
//$object->linkedin = GETPOST("linkedin", 'alphanohtml');
|
||||
$object->socialnetworks = array();
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
$object->socialnetworks[$key] = GETPOST($key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
$object->email = preg_replace('/\s+/', '', GETPOST("email", 'alphanohtml'));
|
||||
$object->job = GETPOST("job", 'nohtml');
|
||||
$object->signature = GETPOST("signature", 'none');
|
||||
@ -630,10 +641,10 @@ if (empty($reshook)) {
|
||||
$ldap_phone = $attribute[$conf->global->LDAP_FIELD_PHONE];
|
||||
$ldap_fax = $attribute[$conf->global->LDAP_FIELD_FAX];
|
||||
$ldap_mobile = $attribute[$conf->global->LDAP_FIELD_MOBILE];
|
||||
$ldap_skype = $attribute[$conf->global->LDAP_FIELD_SKYPE];
|
||||
$ldap_twitter = $attribute[$conf->global->LDAP_FIELD_TWITTER];
|
||||
$ldap_facebook = $attribute[$conf->global->LDAP_FIELD_FACEBOOK];
|
||||
$ldap_linkedin = $attribute[$conf->global->LDAP_FIELD_LINKEDIN];
|
||||
$ldap_social['skype'] = $attribute[$conf->global->LDAP_FIELD_SKYPE];
|
||||
$ldap_social['twitter'] = $attribute[$conf->global->LDAP_FIELD_TWITTER];
|
||||
$ldap_social['facebook'] = $attribute[$conf->global->LDAP_FIELD_FACEBOOK];
|
||||
$ldap_social['linkedin'] = $attribute[$conf->global->LDAP_FIELD_LINKEDIN];
|
||||
$ldap_mail = $attribute[$conf->global->LDAP_FIELD_MAIL];
|
||||
$ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID];
|
||||
}
|
||||
@ -1085,73 +1096,95 @@ if ($action == 'create' || $action == 'adduserldap')
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Skype
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Skype").'</td>';
|
||||
print '<td>';
|
||||
if (! empty($ldap_skype))
|
||||
{
|
||||
print '<input type="hidden" name="skype" value="'.$ldap_skype.'">';
|
||||
print $ldap_skype;
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
print '<tr><td>'.$langs->trans($value['label']).'</td>';
|
||||
print '<td>';
|
||||
if (! empty($ldap_social[$key])) {
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$ldap_social[$key].'">';
|
||||
print $ldap_social[$key];
|
||||
} else {
|
||||
print '<input class="maxwidth200" type="text" name="'.$key.'" value="'.GETPOST($key, 'alphanohtml').'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
// if social network is not active but value exist we do not want to loose it
|
||||
if (! empty($ldap_social[$key])) {
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$ldap_social[$key].'">';
|
||||
} else {
|
||||
print '<input type="hidden" name="'.$key.'" value="'.GETPOST($key, 'alphanohtml').'">';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input class="maxwidth200" type="text" name="skype" value="'.GETPOST('skype', 'alpha').'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
// // Skype
|
||||
// if (! empty($conf->socialnetworks->enabled))
|
||||
// {
|
||||
// print '<tr><td>'.$langs->trans("Skype").'</td>';
|
||||
// print '<td>';
|
||||
// if (! empty($ldap_skype))
|
||||
// {
|
||||
// print '<input type="hidden" name="skype" value="'.$ldap_skype.'">';
|
||||
// print $ldap_skype;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// print '<input class="maxwidth200" type="text" name="skype" value="'.GETPOST('skype', 'alpha').'">';
|
||||
// }
|
||||
// print '</td></tr>';
|
||||
// }
|
||||
|
||||
// Twitter
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Twitter").'</td>';
|
||||
print '<td>';
|
||||
if (! empty($ldap_twitter))
|
||||
{
|
||||
print '<input type="hidden" name="twitter" value="'.$ldap_twitter.'">';
|
||||
print $ldap_twitter;
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input class="maxwidth200" type="text" name="twitter" value="'.GETPOST('twitter', 'alpha').'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
// // Twitter
|
||||
// if (! empty($conf->socialnetworks->enabled))
|
||||
// {
|
||||
// print '<tr><td>'.$langs->trans("Twitter").'</td>';
|
||||
// print '<td>';
|
||||
// if (! empty($ldap_twitter))
|
||||
// {
|
||||
// print '<input type="hidden" name="twitter" value="'.$ldap_twitter.'">';
|
||||
// print $ldap_twitter;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// print '<input class="maxwidth200" type="text" name="twitter" value="'.GETPOST('twitter', 'alpha').'">';
|
||||
// }
|
||||
// print '</td></tr>';
|
||||
// }
|
||||
|
||||
// Facebook
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Facebook").'</td>';
|
||||
print '<td>';
|
||||
if (! empty($ldap_facebook))
|
||||
{
|
||||
print '<input type="hidden" name="facebook" value="'.$ldap_facebook.'">';
|
||||
print $ldap_facebook;
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input class="maxwidth200" type="text" name="facebook" value="'.GETPOST('facebook', 'alpha').'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
// // Facebook
|
||||
// if (! empty($conf->socialnetworks->enabled))
|
||||
// {
|
||||
// print '<tr><td>'.$langs->trans("Facebook").'</td>';
|
||||
// print '<td>';
|
||||
// if (! empty($ldap_facebook))
|
||||
// {
|
||||
// print '<input type="hidden" name="facebook" value="'.$ldap_facebook.'">';
|
||||
// print $ldap_facebook;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// print '<input class="maxwidth200" type="text" name="facebook" value="'.GETPOST('facebook', 'alpha').'">';
|
||||
// }
|
||||
// print '</td></tr>';
|
||||
// }
|
||||
|
||||
// LinkedIn
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LinkedIn").'</td>';
|
||||
print '<td>';
|
||||
if (! empty($ldap_linkedin))
|
||||
{
|
||||
print '<input type="hidden" name="linkedin" value="'.$ldap_linkedin.'">';
|
||||
print $ldap_linkedin;
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input class="maxwidth200" type="text" name="linkedin" value="'.GETPOST('linkedin', 'alpha').'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
// // LinkedIn
|
||||
// if (! empty($conf->socialnetworks->enabled))
|
||||
// {
|
||||
// print '<tr><td>'.$langs->trans("LinkedIn").'</td>';
|
||||
// print '<td>';
|
||||
// if (! empty($ldap_linkedin))
|
||||
// {
|
||||
// print '<input type="hidden" name="linkedin" value="'.$ldap_linkedin.'">';
|
||||
// print $ldap_linkedin;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// print '<input class="maxwidth200" type="text" name="linkedin" value="'.GETPOST('linkedin', 'alpha').'">';
|
||||
// }
|
||||
// print '</td></tr>';
|
||||
// }
|
||||
|
||||
// Accountancy code
|
||||
if ($conf->accounting->enabled)
|
||||
@ -2431,73 +2464,92 @@ else
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Skype
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Skype").'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield && empty($object->ldap_sid))
|
||||
{
|
||||
print '<input size="40" type="text" name="skype" class="flat" value="'.$object->skype.'">';
|
||||
if (! empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active']) {
|
||||
print '<tr><td>'.$langs->trans($value['label']).'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield && empty($object->ldap_sid)) {
|
||||
print '<input size="40" type="text" name="'.$key.'" class="flat" value="'.$object->socialnetworks[$key].'">';
|
||||
} else {
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$object->socialnetworks[$key].'">';
|
||||
print $object->socialnetworks[$key];
|
||||
}
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
// if social network is not active but value exist we do not want to loose it
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$object->socialnetworks[$key].'">';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="skype" value="'.$object->skype.'">';
|
||||
print $object->skype;
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Twitter
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Twitter").'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield && empty($object->ldap_sid))
|
||||
{
|
||||
print '<input size="40" type="text" name="twitter" class="flat" value="'.$object->twitter.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="twitter" value="'.$object->twitter.'">';
|
||||
print $object->twitter;
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
// // Skype
|
||||
// if (! empty($conf->socialnetworks->enabled))
|
||||
// {
|
||||
// print '<tr><td>'.$langs->trans("Skype").'</td>';
|
||||
// print '<td>';
|
||||
// if ($caneditfield && empty($object->ldap_sid))
|
||||
// {
|
||||
// print '<input size="40" type="text" name="skype" class="flat" value="'.$object->skype.'">';
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// print '<input type="hidden" name="skype" value="'.$object->skype.'">';
|
||||
// print $object->skype;
|
||||
// }
|
||||
// print '</td></tr>';
|
||||
// }
|
||||
|
||||
// Facebook
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Facebook").'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield && empty($object->ldap_sid))
|
||||
{
|
||||
print '<input size="40" type="text" name="facebook" class="flat" value="'.$object->facebook.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="facebook" value="'.$object->facebook.'">';
|
||||
print $object->facebook;
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
// // Twitter
|
||||
// if (! empty($conf->socialnetworks->enabled))
|
||||
// {
|
||||
// print '<tr><td>'.$langs->trans("Twitter").'</td>';
|
||||
// print '<td>';
|
||||
// if ($caneditfield && empty($object->ldap_sid))
|
||||
// {
|
||||
// print '<input size="40" type="text" name="twitter" class="flat" value="'.$object->twitter.'">';
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// print '<input type="hidden" name="twitter" value="'.$object->twitter.'">';
|
||||
// print $object->twitter;
|
||||
// }
|
||||
// print '</td></tr>';
|
||||
// }
|
||||
|
||||
// LinkedIn
|
||||
if (! empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LinkedIn").'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield && empty($object->ldap_sid))
|
||||
{
|
||||
print '<input size="40" type="text" name="linkedin" class="flat" value="'.$object->linkedin.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="linkedin" value="'.$object->linkedin.'">';
|
||||
print $object->linkedin;
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
// // Facebook
|
||||
// if (! empty($conf->socialnetworks->enabled))
|
||||
// {
|
||||
// print '<tr><td>'.$langs->trans("Facebook").'</td>';
|
||||
// print '<td>';
|
||||
// if ($caneditfield && empty($object->ldap_sid))
|
||||
// {
|
||||
// print '<input size="40" type="text" name="facebook" class="flat" value="'.$object->facebook.'">';
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// print '<input type="hidden" name="facebook" value="'.$object->facebook.'">';
|
||||
// print $object->facebook;
|
||||
// }
|
||||
// print '</td></tr>';
|
||||
// }
|
||||
|
||||
// // LinkedIn
|
||||
// if (! empty($conf->socialnetworks->enabled))
|
||||
// {
|
||||
// print '<tr><td>'.$langs->trans("LinkedIn").'</td>';
|
||||
// print '<td>';
|
||||
// if ($caneditfield && empty($object->ldap_sid))
|
||||
// {
|
||||
// print '<input size="40" type="text" name="linkedin" class="flat" value="'.$object->linkedin.'">';
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// print '<input type="hidden" name="linkedin" value="'.$object->linkedin.'">';
|
||||
// print $object->linkedin;
|
||||
// }
|
||||
// print '</td></tr>';
|
||||
// }
|
||||
|
||||
// OpenID url
|
||||
if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER))
|
||||
|
||||
@ -74,9 +74,35 @@ class User extends CommonObject
|
||||
public $email;
|
||||
public $personal_email;
|
||||
|
||||
|
||||
/**
|
||||
* @var array array of socialnetworks
|
||||
*/
|
||||
public $socialnetworks;
|
||||
|
||||
/**
|
||||
* Skype username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $skype;
|
||||
/**
|
||||
* Twitter username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $twitter;
|
||||
/**
|
||||
* Facebook username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $facebook;
|
||||
/**
|
||||
* Linkedin username
|
||||
* @var string
|
||||
* @deprecated
|
||||
*/
|
||||
public $linkedin;
|
||||
|
||||
public $job; // job position
|
||||
@ -255,7 +281,8 @@ class User extends CommonObject
|
||||
$login=trim($login);
|
||||
|
||||
// Get user
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.birth, u.email, u.personal_email, u.job, u.skype, u.twitter, u.facebook, u.linkedin,";
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.birth, u.email, u.personal_email, u.job,";
|
||||
$sql.= " u.socialnetworks,";
|
||||
$sql.= " u.signature, u.office_phone, u.office_fax, u.user_mobile, u.personal_mobile,";
|
||||
$sql.= " u.address, u.zip, u.town, u.fk_state as state_id, u.fk_country as country_id,";
|
||||
$sql.= " u.admin, u.login, u.note as note_private, u.note_public,";
|
||||
@ -366,11 +393,8 @@ class User extends CommonObject
|
||||
$this->user_mobile = $obj->user_mobile;
|
||||
$this->personal_mobile = $obj->personal_mobile;
|
||||
$this->email = $obj->email;
|
||||
$this->personal_email = $obj->personal_email;
|
||||
$this->skype = $obj->skype;
|
||||
$this->twitter = $obj->twitter;
|
||||
$this->facebook = $obj->facebook;
|
||||
$this->linkedin = $obj->linkedin;
|
||||
$this->personal_email = $obj->personal_email;
|
||||
$this->socialnetworks = (array) json_decode($obj->socialnetworks, true);
|
||||
$this->job = $obj->job;
|
||||
$this->signature = $obj->signature;
|
||||
$this->admin = $obj->admin;
|
||||
@ -1292,10 +1316,7 @@ class User extends CommonObject
|
||||
$this->firstname = $contact->firstname;
|
||||
$this->gender = $contact->gender;
|
||||
$this->email = $contact->email;
|
||||
$this->skype = $contact->skype;
|
||||
$this->twitter = $contact->twitter;
|
||||
$this->facebook = $contact->facebook;
|
||||
$this->linkedin = $contact->linkedin;
|
||||
$this->socialnetworks = $contact->socialnetworks;
|
||||
$this->office_phone = $contact->phone_pro;
|
||||
$this->office_fax = $contact->fax;
|
||||
$this->user_mobile = $contact->phone_mobile;
|
||||
@ -1511,11 +1532,6 @@ class User extends CommonObject
|
||||
$this->email = trim($this->email);
|
||||
$this->personal_email = trim($this->personal_email);
|
||||
|
||||
$this->skype = trim($this->skype);
|
||||
$this->twitter = trim($this->twitter);
|
||||
$this->facebook = trim($this->facebook);
|
||||
$this->linkedin = trim($this->linkedin);
|
||||
|
||||
$this->job = trim($this->job);
|
||||
$this->signature = trim($this->signature);
|
||||
$this->note_public = trim($this->note_public);
|
||||
@ -1568,10 +1584,7 @@ class User extends CommonObject
|
||||
$sql.= ", personal_mobile = '".$this->db->escape($this->personal_mobile)."'";
|
||||
$sql.= ", email = '".$this->db->escape($this->email)."'";
|
||||
$sql.= ", personal_email = '".$this->db->escape($this->personal_email)."'";
|
||||
$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.= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'";
|
||||
$sql.= ", job = '".$this->db->escape($this->job)."'";
|
||||
$sql.= ", signature = '".$this->db->escape($this->signature)."'";
|
||||
$sql.= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'";
|
||||
@ -1661,10 +1674,7 @@ class User extends CommonObject
|
||||
|
||||
$adh->email=$this->email;
|
||||
|
||||
$adh->skype=$this->skype;
|
||||
$adh->twitter=$this->twitter;
|
||||
$adh->facebook=$this->facebook;
|
||||
$adh->linkedin=$this->linkedin;
|
||||
$adh->socialnetworks=$this->socialnetworks;
|
||||
|
||||
$adh->phone=$this->office_phone;
|
||||
$adh->phone_mobile=$this->user_mobile;
|
||||
@ -1714,10 +1724,7 @@ class User extends CommonObject
|
||||
|
||||
$tmpobj->email=$this->email;
|
||||
|
||||
$tmpobj->skype=$this->skype;
|
||||
$tmpobj->twitter=$this->twitter;
|
||||
$tmpobj->facebook=$this->facebook;
|
||||
$tmpobj->linkedin=$this->linkedin;
|
||||
$tmpobj->socialnetworks=$this->socialnetworks;
|
||||
|
||||
$tmpobj->phone_pro=$this->office_phone;
|
||||
$tmpobj->phone_mobile=$this->user_mobile;
|
||||
@ -2701,10 +2708,12 @@ class User extends CommonObject
|
||||
$this->note_private='This is a note private';
|
||||
$this->email='email@specimen.com';
|
||||
$this->personal_email='personalemail@specimen.com';
|
||||
$this->skype='skypepseudo';
|
||||
$this->twitter='twitterpseudo';
|
||||
$this->facebook='facebookpseudo';
|
||||
$this->linkedin='linkedinpseudo';
|
||||
$this->socialnetworks = array(
|
||||
'skype' => 'skypepseudo',
|
||||
'twitter' => 'twitterpseudo',
|
||||
'facebook' => 'facebookpseudo',
|
||||
'linkedin' => 'linkedinpseudo',
|
||||
);
|
||||
$this->office_phone='0999999999';
|
||||
$this->office_fax='0999999998';
|
||||
$this->user_mobile='0999999997';
|
||||
|
||||
@ -207,7 +207,7 @@ class ContactTest extends PHPUnit\Framework\TestCase
|
||||
$localobject->phone_mobile='New tel mobile';
|
||||
$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);
|
||||
@ -257,8 +257,8 @@ class ContactTest extends PHPUnit\Framework\TestCase
|
||||
$this->assertEquals($localobject->fax, $newobject->fax);
|
||||
print __METHOD__." old=".$localobject->email." new=".$newobject->email."\n";
|
||||
$this->assertEquals($localobject->email, $newobject->email);
|
||||
print __METHOD__." old=".$localobject->jabberid." new=".$newobject->jabberid."\n";
|
||||
$this->assertEquals($localobject->jabberid, $newobject->jabberid);
|
||||
print __METHOD__." old=".$localobject->socialnetworks['jabber']." new=".$newobject->socialnetworks['jabber']."\n";
|
||||
$this->assertEquals($localobject->socialnetworks['jabber'], $newobject->socialnetworks['jabber']);
|
||||
print __METHOD__." old=".$localobject->default_lang." new=".$newobject->default_lang."\n";
|
||||
$this->assertEquals($localobject->default_lang, $newobject->default_lang);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user