diff --git a/htdocs/admin/company_socialnetworks.php b/htdocs/admin/company_socialnetworks.php
index 7787a386d8c..5cbdb948b4a 100644
--- a/htdocs/admin/company_socialnetworks.php
+++ b/htdocs/admin/company_socialnetworks.php
@@ -40,6 +40,7 @@ $langs->loadLangs(array('admin', 'companies'));
if (!$user->admin) {
accessforbidden();
}
+$listofnetworks = getArrayOfSocialNetworks();
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('adminsocialnetworkscompany', 'globaladmin'));
@@ -53,14 +54,26 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
-
if (($action == 'update' && !GETPOST("cancel", 'alpha'))) {
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FACEBOOK_URL", GETPOST("facebookurl", 'alpha'), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TWITTER_URL", GETPOST("twitterurl", 'alpha'), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LINKEDIN_URL", GETPOST("linkedinurl", 'alpha'), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_INSTAGRAM_URL", GETPOST("instagramurl", 'alpha'), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_YOUTUBE_URL", GETPOST("youtubeurl", 'alpha'), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GITHUB_URL", GETPOST("githuburl", 'alpha'), 'chaine', 0, '', $conf->entity);
+ foreach ($listofnetworks as $key => $value) {
+ if (!empty($value['active'])) {
+ $networkconstname = 'MAIN_INFO_SOCIETE_'.strtoupper($key).'_URL';
+ $networkconstid = 'MAIN_INFO_SOCIETE_'.strtoupper($key);
+ if (GETPOSTISSET($key.'url') && GETPOST($key.'url', 'alpha') != '') {
+ dolibarr_set_const($db, $networkconstname, GETPOST($key.'url', 'alpha'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, $networkconstid, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity);
+ } elseif (GETPOSTISSET($key) && GETPOST($key, 'alpha') != '') {
+ if (!empty($listofnetworks[$key]['url'])) {
+ $url = str_replace('{socialid}', GETPOST($key, 'alpha'), $listofnetworks[$key]['url']);
+ dolibarr_set_const($db, $networkconstname, $url, 'chaine', 0, '', $conf->entity);
+ }
+ dolibarr_set_const($db, $networkconstid, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity);
+ } else {
+ dolibarr_del_const($db, $networkconstname, $conf->entity);
+ dolibarr_del_const($db, $networkconstid, $conf->entity);
+ }
+ }
+ }
}
@@ -93,25 +106,24 @@ print '';
print '
';
print '
";
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index f34f39740bd..396aa595062 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -694,17 +694,14 @@ abstract class CommonObject
$contactid = 0;
$thirdpartyid = 0;
$elementforaltlanguage = $this->element;
- if ($this->element == 'societe')
- {
+ if ($this->element == 'societe') {
$thirdpartyid = $this->id;
}
- if ($this->element == 'contact')
- {
+ if ($this->element == 'contact') {
$contactid = $this->id;
$thirdpartyid = $object->fk_soc;
}
- if ($this->element == 'user')
- {
+ if ($this->element == 'user') {
$contactid = $this->contact_id;
$thirdpartyid = $object->fk_soc;
}
@@ -773,46 +770,51 @@ abstract class CommonObject
if (!empty($this->phone) || !empty($this->phone_pro) || !empty($this->phone_mobile) || !empty($this->phone_perso) || !empty($this->fax) || !empty($this->office_phone) || !empty($this->user_mobile) || !empty($this->office_fax)) $out .= ($outdone ? '
' : '');
if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone
- $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++;
+ $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro"));
+ $outdone++;
}
if (!empty($this->phone_pro)) {
- $out .= dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++;
+ $out .= dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro"));
+ $outdone++;
}
if (!empty($this->phone_mobile)) {
- $out .= dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile")); $outdone++;
+ $out .= dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile"));
+ $outdone++;
}
if (!empty($this->phone_perso)) {
- $out .= dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePerso")); $outdone++;
+ $out .= dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePerso"));
+ $outdone++;
}
if (!empty($this->office_phone)) {
- $out .= dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++;
+ $out .= dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro"));
+ $outdone++;
}
if (!empty($this->user_mobile)) {
- $out .= dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile")); $outdone++;
+ $out .= dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile"));
+ $outdone++;
}
if (!empty($this->fax)) {
- $out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax")); $outdone++;
+ $out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax"));
+ $outdone++;
}
if (!empty($this->office_fax)) {
- $out .= dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax")); $outdone++;
+ $out .= dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax"));
+ $outdone++;
}
if ($out) $out .= '';
$outdone = 0;
- if (!empty($this->email))
- {
+ if (!empty($this->email)) {
$out .= dol_print_email($this->email, $this->id, $object->id, 'AC_EMAIL', 0, 0, 1);
$outdone++;
}
- if (!empty($this->url))
- {
+ if (!empty($this->url)) {
//$out.=dol_print_url($this->url,'_goout',0,1);//steve changed to blank
$out .= dol_print_url($this->url, '_blank', 0, 1);
$outdone++;
}
- if (!empty($conf->socialnetworks->enabled))
- {
+ if (!empty($conf->socialnetworks->enabled)) {
$outsocialnetwork = '';
if (is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
@@ -823,7 +825,7 @@ abstract class CommonObject
}
$outdone++;
}
- } else { // Old code
+ } else { // Old code to remove
if ($this->skype) $outsocialnetwork .= dol_print_socialnetworks($this->skype, $this->id, $object->id, 'skype');
$outdone++;
if ($this->jabberid) $outsocialnetwork .= dol_print_socialnetworks($this->jabberid, $this->id, $object->id, 'jabber');
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 784297b4bf9..c2a5aee862e 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1758,21 +1758,17 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
} else {
$morehtmlstatus .= ''.$object->getLibStatut(6, 1).'';
}
- } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan')))
- {
+ } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan'))) {
$tmptxt = $object->getLibStatut(6, $object->totalpaye);
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) $tmptxt = $object->getLibStatut(5, $object->totalpaye);
$morehtmlstatus .= $tmptxt;
- } elseif ($object->element == 'contrat' || $object->element == 'contract')
- {
+ } elseif ($object->element == 'contrat' || $object->element == 'contract') {
if ($object->statut == 0) $morehtmlstatus .= $object->getLibStatut(5);
else $morehtmlstatus .= $object->getLibStatut(4);
- } elseif ($object->element == 'facturerec')
- {
+ } elseif ($object->element == 'facturerec') {
if ($object->frequency == 0) $morehtmlstatus .= $object->getLibStatut(2);
else $morehtmlstatus .= $object->getLibStatut(5);
- } elseif ($object->element == 'project_task')
- {
+ } elseif ($object->element == 'project_task') {
$object->fk_statut = 1;
if ($object->progress > 0) $object->fk_statut = 2;
if ($object->progress >= 100) $object->fk_statut = 3;
@@ -2457,6 +2453,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
if (!empty($type)) {
$htmllink = '';
+ // TODO use dictionary definition for picto $dictsocialnetworks[$type]['icon']
$htmllink .= img_picto($langs->trans(dol_ucfirst($type)), $type.'.png', '', false, 0, 0, '', 'paddingright', 0);
if ($type == 'skype') {
$htmllink .= $value;
@@ -3306,8 +3303,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$fakey = 'fa-'.$convertarray[$pictowithouttext];
if (preg_match('/selected/', $pictowithouttext)) $facolor = '#888';
$marginleftonlyshort = 1;
- } elseif (!empty($arrayconvpictotofa[$pictowithouttext]))
- {
+ } elseif (!empty($arrayconvpictotofa[$pictowithouttext])) {
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
} else {
$fakey = 'fa-'.$pictowithouttext;
diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
index 76fb29197b2..e391787479d 100644
--- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
+++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
@@ -376,7 +376,7 @@ ALTER TABLE llx_facturedet ADD COLUMN ref_ext varchar(255) AFTER multicurrency_t
ALTER TABLE llx_c_ticket_category ADD COLUMN fk_parent integer DEFAULT 0 NOT NULL;
ALTER TABLE llx_c_ticket_category ADD COLUMN force_severity varchar(32) NULL;
-ALTER TABLE llx_c_ticket_severity CHANGE color color VARCHAR(10) NULL;
+ALTER TABLE llx_c_ticket_severity CHANGE color color VARCHAR(10) NULL;
ALTER TABLE llx_expensereport ADD COLUMN fk_user_creat integer NULL;
@@ -421,7 +421,7 @@ ALTER TABLE llx_projet_task_time MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIM
ALTER TABLE llx_projet_task_time MODIFY COLUMN datec datetime;
-DELETE FROM llx_user_rights WHERE fk_id IN (SELECT id FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous');
+DELETE FROM llx_user_rights WHERE fk_id IN (SELECT id FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous');
DELETE FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous';
UPDATE llx_rights_def set perms = 'readall' WHERE perms = 'read_all' and module = 'holiday';
@@ -545,6 +545,7 @@ CREATE TABLE llx_session(
user_agent varchar(128) NULL
)ENGINE=innodb;
+INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'github', 'Github', 'https://github.com/{socialid}', 'fa-github', 1);
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_funnel_of_prospection.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_funnel_of_prospection.php' AND entity = 1);
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_customers_outstanding_bill_reached.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_customers_outstanding_bill_reached.php' AND entity = 1);
diff --git a/htdocs/install/mysql/tables/llx_intracommreport.sql b/htdocs/install/mysql/tables/llx_intracommreport.sql
index 9d89320c1fa..d3d2956e4ab 100644
--- a/htdocs/install/mysql/tables/llx_intracommreport.sql
+++ b/htdocs/install/mysql/tables/llx_intracommreport.sql
@@ -20,7 +20,6 @@
create table llx_intracommreport
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
-
ref varchar(30) NOT NULL, -- report reference number
entity integer DEFAULT 1 NOT NULL, -- multi company id
type_declaration varchar(32),
diff --git a/htdocs/intracommreport/card.php b/htdocs/intracommreport/card.php
index 668eca12674..f0a4bd5f070 100644
--- a/htdocs/intracommreport/card.php
+++ b/htdocs/intracommreport/card.php
@@ -30,54 +30,57 @@ $langs->loadLangs(array("intracommreport"));
$action = GETPOST('action');
$exporttype = GETPOST('exporttype'); // DEB ou DES
-if (empty($exporttype)) $exporttype = 'deb';
+if (empty($exporttype)) {
+ $exporttype = 'deb';
+}
$form = new Form($db);
$formother = new FormOther($db);
$year = GETPOST('year');
$month = GETPOST('month');
-$type_declaration = GETPOST('type');
+$label = (string) GETPOST('label', 'alphanohtml');
+$type_declaration = GETPOSTINT('type');
$backtopage = GETPOST('backtopage', 'alpha');
+$declaration = array(
+ "deb" => $langs->trans("DEB"),
+ "des" => $langs->trans("DES"),
+);
/*
* Actions
*/
-if ($user->rights->intracommreport->delete && $action == 'confirm_delete' && $confirm == 'yes')
-{
+if ($user->rights->intracommreport->delete && $action == 'confirm_delete' && $confirm == 'yes') {
$result = $object->delete($id, $user);
- if ($result > 0)
- {
- if (!empty($backtopage))
- {
+ if ($result > 0) {
+ if (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
- }
- else {
+ } else {
header("Location: list.php");
exit;
}
- }
- else {
+ } else {
$errmesg = $object->error;
}
}
if ($action == 'add' && $user->rights->intracommreport->write) {
$object->label = trim($label);
- $object->type = trim($type);
- $object->type_declaration = (int) $statut;
- $object->subscription = (int) $subscription;
+ $object->type = trim($exporttype);
+ $object->type_declaration = $type_declaration;
+ $object->subscription = (int) $subscription;
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
- if ($ret < 0) $error++;
+ if ($ret < 0) {
+ $error++;
+ }
if (empty($object->label)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
- }
- else {
+ } else {
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'";
$result = $db->query($sql);
if ($result) {
@@ -90,20 +93,16 @@ if ($action == 'add' && $user->rights->intracommreport->write) {
}
}
- if (!$error)
- {
+ if (!$error) {
$id = $object->create($user);
- if ($id > 0)
- {
+ if ($id > 0) {
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
- }
- else {
+ } else {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'create';
}
- }
- else {
+ } else {
$action = 'create';
}
}
@@ -113,15 +112,14 @@ if ($action == 'add' && $user->rights->intracommreport->write) {
*/
// Creation mode
-if ($action == 'create')
-{
+if ($action == 'create') {
$title = $langs->trans("IntracommReportTitle");
llxHeader("", $title);
print load_fiche_titre($langs->trans("IntracommReportTitle"));
print '