diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 5b8c708b1b2..00c74544d17 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -967,7 +967,7 @@ while ($i < min($num, $limit))
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
- print '
'.dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key).' | ';
+ print ''.dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks).' | ';
if (!$i) $totalarray['nbfield']++;
}
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index dec15e4db83..f34f39740bd 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -816,9 +816,10 @@ abstract class CommonObject
$outsocialnetwork = '';
if (is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
+ $socialnetworksdict = getArrayOfSocialNetworks();
foreach ($this->socialnetworks as $key => $value) {
if ($value) {
- $outsocialnetwork .= dol_print_socialnetworks($value, $this->id, $object->id, $key);
+ $outsocialnetwork .= dol_print_socialnetworks($value, $this->id, $object->id, $key, $socialnetworksdict);
}
$outdone++;
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 8b9edcd89ba..8a48cdf0906 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2440,13 +2440,14 @@ function getArrayOfSocialNetworks()
/**
* Show social network link
*
- * @param string $value Skype to show (only skype, without 'Name of recipient' before)
- * @param int $cid Id of contact if known
- * @param int $socid Id of third party if known
- * @param string $type 'skype','facebook',...
- * @return string HTML Link
+ * @param string $value Skype to show (only skype, without 'Name of recipient' before)
+ * @param int $cid Id of contact if known
+ * @param int $socid Id of third party if known
+ * @param string $type 'skype','facebook',...
+ * @param array $dictsocialnetworks socialnetworks availables
+ * @return string HTML Link
*/
-function dol_print_socialnetworks($value, $cid, $socid, $type)
+function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetworks = array())
{
global $conf, $user, $langs;
@@ -2454,13 +2455,11 @@ function dol_print_socialnetworks($value, $cid, $socid, $type)
if (empty($value)) return ' ';
- if (!empty($type))
- {
+ if (!empty($type)) {
$htmllink = '';
$htmllink .= img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright', 0);
- $htmllink .= $value;
- if ($type == 'skype')
- {
+ if ($type == 'skype') {
+ $htmllink .= $value;
$htmllink .= ' ';
$htmllink .= '
';
$htmllink .= '
';
$htmllink .= '';
- }
- 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 = '
'.img_object($langs->trans("AddAction"), "calendar").'';
- $htmllink .= ($link ? ' '.$link : '');
+ if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) {
+ $addlink = 'AC_SKYPE';
+ $link = '';
+ if (!empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) $link = '
'.img_object($langs->trans("AddAction"), "calendar").'';
+ $htmllink .= ($link ? ' '.$link : '');
+ }
+ } else {
+ if (!empty($dictsocialnetworks[$type]['url'])) {
+ $link = str_replace('{socialid}', $value, $dictsocialnetworks[$type]['url']);
+ $htmllink .= '
'.$value.'';
+ } else {
+ $htmllink .= $value;
+ }
}
$htmllink .= '
';
} else {