add socialnetworks dictionary

This commit is contained in:
Frédéric FRANCE 2019-09-11 22:27:09 +02:00
parent 5f236fda2e
commit 3fddef0c9e
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
12 changed files with 183 additions and 113 deletions

View File

@ -66,7 +66,19 @@ if (! empty($conf->mailmanspip->enabled))
$object = new Adherent($db);
$extrafields = new ExtraFields($db);
$sql = "SELECT rowid, code, label, url, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
$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,
'active' => $obj->active,
);
}
}
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
@ -302,10 +314,14 @@ 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) {
$object->socialnetworks[$key] = trim(GETPOST($key, '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->birth = $birthdate;
$object->typeid = GETPOST("typeid", 'int');
@ -448,10 +464,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 +494,18 @@ 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 (!$value['active']) continue;
$object->socialnetworks[$key] = GETPOST("member_".$key, 'alpha');
}
}
$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;
@ -1015,29 +1038,12 @@ else
// Mobile phone
print '<tr><td>'.$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']) continue;
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>';
}
}
// Birthday
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
@ -1284,29 +1290,12 @@ else
// Mobile phone
print '<tr><td>'.$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']) continue;
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>';
}
}
// Birthday
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";

View File

@ -566,10 +566,11 @@ 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.= ", skype = '".$this->db->escape($this->skype)."'";
// $sql.= ", twitter = '".$this->db->escape($this->twitter)."'";
// $sql.= ", facebook = '".$this->db->escape($this->facebook)."'";
// $sql.= ", linkedin = '".$this->db->escape($this->linkedin)."'";
$sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null");
$sql.= ", phone_perso = ".($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
$sql.= ", phone_mobile = ".($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
@ -1227,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.skype, d.twitter, d.facebook, d.linkedin, 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,";
@ -1306,10 +1307,38 @@ 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;
$arraysocialnetworks = array();
$updatesocial = false;
if (!empty($obj->skype)) {
$arraysocialnetworks['skype'] = $obj->skype;
$updatesocial = true;
}
if (!empty($obj->twitter)) {
$arraysocialnetworks['twitter'] = $obj->twitter;
$updatesocial = true;
}
if (!empty($obj->facebook)) {
$arraysocialnetworks['facebook'] = $obj->facebook;
$updatesocial = true;
}
if (!empty($obj->linkedin)) {
$arraysocialnetworks['linkedin'] = $obj->linkedin;
$updatesocial = true;
}
$this->socialnetworks = array_merge($arraysocialnetworks, json_decode($obj->socialnetworks, true));
if ($updatesocial) {
$sqlupd = 'UPDATE '.MAIN_DB_PREFIX.'adherent SET skype=null';
$sqlupd .= ', twitter=null';
$sqlupd .= ', facebook=null';
$sqlupd .= ', linkedin=null';
$sqlupd .= ', socialnetworks="'.$this->db->escape(json_encode($this->socialnetworks)).'"';
$sqlupd .= ' WHERE rowid='.$this->id;
$this->db->query($sqlupd);
}
$this->skype = $this->socialnetworks['skype'];
$this->twitter = $this->socialnetworks['twitter'];
$this->facebook = $this->socialnetworks['facebook'];
$this->linkedin = $this->socialnetworks['linkedin'];
$this->photo = $obj->photo;
$this->statut = $obj->statut;

View File

@ -88,7 +88,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 +130,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 +171,7 @@ $tablib[34]= "DictionaryFunction";
$tablib[35]= "DictionaryExpenseTaxCat";
$tablib[36]= "DictionaryExpenseTaxRange";
$tablib[37]= "DictionaryMeasuringUnits";
$tablib[38]= "DictionarySocialNetworks";
// Requests to extract data
$tabsql=array();
@ -210,6 +212,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, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
// Criteria to sort dictionaries
$tabsqlsort=array();
@ -250,6 +253,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";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
@ -290,6 +294,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";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
@ -330,6 +335,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";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
@ -371,6 +377,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]= "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 +420,7 @@ $tabrowid[34]= "rowid";
$tabrowid[35]= "";
$tabrowid[36]= "";
$tabrowid[37]= "";
$tabrowid[38]= "";
// Condition to show dictionary in setup page
$tabcond=array();
@ -453,6 +461,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 +502,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 +543,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);

View File

@ -680,16 +680,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>';
@ -4517,7 +4524,7 @@ abstract class CommonObject
$parameters = array('modelspath'=>$modelspath,'modele'=>$modele,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'hidedesc'=>$hidedesc,'hideref'=>$hideref, 'moreparams'=>$moreparams);
$reshook = $hookmanager->executeHooks('commonGenerateDocument', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if(empty($reshook))
{
dol_syslog("commonGenerateDocument modele=".$modele." outputlangs->defaultlang=".(is_object($outputlangs)?$outputlangs->defaultlang:'null'));

View File

@ -2199,42 +2199,42 @@ function dol_print_socialnetworks($value, $cid, $socid, $type)
{
global $conf,$user,$langs;
$newskype=$value;
$htmllink=$value;
if (empty($value)) return '&nbsp;';
if (! empty($type))
{
$newskype ='<div class="divsocialnetwork inline-block valignmiddle">';
$newskype.=img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright');
$newskype.=$value;
$htmllink ='<div class="divsocialnetwork inline-block valignmiddle">';
$htmllink.=img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright');
$htmllink.=$value;
if ($type == 'skype')
{
$newskype.= '&nbsp;';
$newskype.='<a href="skype:';
$newskype.=$value;
$newskype.='?call" alt="'.$langs->trans("Call").'&nbsp;'.$value.'" title="'.$langs->trans("Call").'&nbsp;'.$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").'&nbsp;'.$value.'" title="'.$langs->trans("Chat").'&nbsp;'.$value.'">';
$newskype.='<img class="paddingleft" src="'.DOL_URL_ROOT.'/theme/common/skype_chatbutton.png" border="0">';
$newskype.='</a>';
$htmllink.= '&nbsp;';
$htmllink.='<a href="skype:';
$htmllink.=$value;
$htmllink.='?call" alt="'.$langs->trans("Call").'&nbsp;'.$value.'" title="'.$langs->trans("Call").'&nbsp;'.$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").'&nbsp;'.$value.'" title="'.$langs->trans("Chat").'&nbsp;'.$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='';
if (! empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) $link='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode='.$addlink.'&amp;contactid='.$cid.'&amp;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;
}
/**

View File

@ -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

View File

@ -94,13 +94,13 @@ ALTER TABLE llx_accounting_account MODIFY COLUMN rowid bigint AUTO_INCREMENT;
ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_start datetime DEFAULT NULL;
ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_end datetime DEFAULT NULL;
create table llx_c_hrm_public_holiday
(
id integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 0 NOT NULL, -- multi company id, 0 = all
fk_country integer,
fk_country integer,
code varchar(62),
dayrule varchar(64) DEFAULT '', -- 'easter', 'eastermonday', ...
day integer,
@ -163,4 +163,30 @@ 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-REPUBLICDAY', 0, 117, '', 0, 1, 26, 1);
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,
code varchar(100),
label varchar(150),
url text,
icon varchar(15),
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 (code, label, url, icon, active) VALUES('facebook', 'Facebook', 'https://www.facebook.com/{socialid}', 'fa-facebook', 1);
INSERT INTO llx_c_socialnetworks (code, label, url, icon, active) VALUES('skype', 'Skype', 'https://www.skype.com/{socialid}', 'fa-skype', 1);
INSERT INTO llx_c_socialnetworks (code, label, url, icon, active) VALUES('twitter', 'Twitter', 'https://www.twitter.com/{socialid}', 'fa-twitter', 1);
INSERT INTO llx_c_socialnetworks (code, label, url, icon, active) VALUES('linkedin', 'LinkedIn', 'https://www.linkedin.com/{socialid}', 'fa-linkedin', 1);
INSERT INTO llx_c_socialnetworks (code, label, url, icon, active) VALUES('instagram', 'Instagram', 'https://www.instagram.com/{socialid}', 'fa-instagram', 1);
INSERT INTO llx_c_socialnetworks (code, label, url, icon, active) VALUES('snapchat', 'Snapchat', '{socialid}', 'fa-snapchat', 1);
INSERT INTO llx_c_socialnetworks (code, label, url, icon, active) VALUES('googleplus', 'GooglePlus', 'https://www.googleplus.com/{socialid}', 'fa-googleplus', 1);
INSERT INTO llx_c_socialnetworks (code, label, url, icon, active) VALUES('youtube', 'Youtube', 'https://www.youtube.com/{socialid}', 'fa-youtube', 1);
INSERT INTO llx_c_socialnetworks (code, label, url, icon, active) VALUES('whatsapp', 'Whatsapp', '{socialid}', 'fa-whatsapp', 1);
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;

View File

@ -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), --

View File

@ -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
@ -111,7 +112,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

View File

@ -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,

View File

@ -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,

View File

@ -1257,7 +1257,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, s.skype, s.twitter, s.facebook, s.linkedin';
$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';
@ -1309,7 +1311,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;
}
@ -1355,6 +1357,8 @@ class Societe extends CommonObject
$this->twitter = $obj->twitter;
$this->facebook = $obj->facebook;
$this->linkedin = $obj->linkedin;
$this->socialnetworks = json_decode($obj->socialnetworks);
$this->url = $obj->url;
$this->phone = $obj->phone;
$this->fax = $obj->fax;