New: EMails links are show with function dol_print_email
This commit is contained in:
parent
0bdd1efe2b
commit
d6648b65f2
@ -932,16 +932,16 @@ if ($rowid && $action != 'edit')
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.getCountryLabel($adh->pays_id).'</td></tr>';
|
||||
|
||||
// Tel pro.
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td class="valeur">'.$adh->phone.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td class="valeur">'.dol_print_phone($adh->phone,$adh->pays_code).'</td></tr>';
|
||||
|
||||
// Tel perso
|
||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td class="valeur">'.$adh->phone_perso.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td class="valeur">'.dol_print_phone($adh->phone_perso,$adh->pays_code).'</td></tr>';
|
||||
|
||||
// Tel mobile
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td class="valeur">'.$adh->phone_mobile.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td class="valeur">'.dol_print_phone($adh->phone_mobile,$adh->pays_code).'</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.dol_print_email($adh->email).' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.dol_print_email($adh->email,0,0,1).' </td></tr>';
|
||||
|
||||
// Date naissance
|
||||
print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dolibarr_print_date($adh->naiss,'day').' </td></tr>';
|
||||
|
||||
@ -227,7 +227,7 @@ if ($resql)
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".img_object($langs->trans("ShowAdherent"),"user").' '.stripslashes($objp->prenom)." ".stripslashes($objp->nom)."</a></td>\n";
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".img_object($langs->trans("ShowAdherent"),"user").' '.$objp->prenom." ".$objp->nom."</a></td>\n";
|
||||
}
|
||||
|
||||
// Login
|
||||
@ -244,7 +244,7 @@ if ($resql)
|
||||
print "<td>".$adh->getmorphylib($objp->morphy)."</td>\n";
|
||||
|
||||
// EMail
|
||||
print "<td>".dol_print_email($objp->email)."</td>\n";
|
||||
print "<td>".dol_print_email($objp->email,0,0,1)."</td>\n";
|
||||
|
||||
// Statut
|
||||
print "<td>";
|
||||
|
||||
@ -172,8 +172,8 @@ if ($_GET["socid"])
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$soc->pays.'</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id).'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$soc->url\" target=\"_blank\">".$soc->url."</a> </td></tr>";
|
||||
|
||||
|
||||
@ -413,9 +413,9 @@ else
|
||||
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$livraison->lignes[$i]->pays.'</td>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($livraison->lignes[$i]->tel,$livraison->lignes[$i]->pays_code,0,$livraison->socid).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($livraison->lignes[$i]->tel,$livraison->lignes[$i]->pays_code,0,$livraison->socid,'AC_TEL').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($livraison->lignes[$i]->fax,$livraison->lignes[$i]->pays_code,0,$livraison->socid).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($livraison->lignes[$i]->fax,$livraison->lignes[$i]->pays_code,0,$livraison->socid,'AC_FAX').'</td></tr>';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -167,9 +167,9 @@ if ($resql)
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?type='.$type.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowCompany"),"company").'</a> ';
|
||||
print "<a href=\"".$urlfiche."?socid=".$obj->rowid."\">$obj->nom</a></td>\n";
|
||||
|
||||
print '<td><a href="action/fiche.php?action=create&actioncode=AC_EMAIL&contactid='.$obj->cidp.'&socid='.$obj->rowid.'">'.$obj->email.'</a> </td>';
|
||||
print '<td>'.dol_print_phone($obj->email,$obj->cidp,$obj->rowid,'AC_EMAIL').'</td>';
|
||||
|
||||
print '<td>'.dol_print_phone($obj->phone,$obj->pays_code,$obj->cidp,$obj->rowid).' </td>';
|
||||
print '<td>'.dol_print_phone($obj->phone,$obj->pays_code,$obj->cidp,$obj->rowid,'AC_TEL').' </td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
@ -189,10 +189,10 @@ if ($socid > 0)
|
||||
print '</td></tr>';
|
||||
|
||||
// Phone
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($objsoc->tel,$objsoc->pays_code,0,$objsoc->id).'</td>';
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($objsoc->tel,$objsoc->pays_code,0,$objsoc->id,'AC_TEL').'</td>';
|
||||
|
||||
// Fax
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($objsoc->fax,$objsoc->pays_code,0,$objsoc->id).'</td></tr>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($objsoc->fax,$objsoc->pays_code,0,$objsoc->id,'AC_FAX').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$objsoc->url\" target=\"_blank\">".$objsoc->url."</a> </td></tr>";
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ if ($socid > 0)
|
||||
else print $societe->pays;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Phone").'</td><td>'.dol_print_phone($societe->tel,$societe->pays_code,0,$societe->id).'</td><td>Fax</td><td>'.dol_print_phone($societe->fax,$societe->pays_code).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Phone").'</td><td>'.dol_print_phone($societe->tel,$societe->pays_code,0,$societe->id,'AC_TEL').'</td><td>Fax</td><td>'.dol_print_phone($societe->fax,$societe->pays_code).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$societe->url\">$societe->url</a></td></tr>";
|
||||
|
||||
if ($societe->rubrique)
|
||||
|
||||
@ -140,7 +140,8 @@ if ($socid > 0)
|
||||
else print $societe->pays;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Phone").'</td><td>'.dol_print_phone($societe->tel,$societe->pays_code,0,$societe->id).'</td><td>'.$langs->trans("Fax").'</td><td>'.dol_print_phone($societe->fax,$societe->pays_code,0,$societe->id).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Phone").'</td><td>'.dol_print_phone($societe->tel,$societe->pays_code,0,$societe->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td>'.dol_print_phone($societe->fax,$societe->pays_code,0,$societe->id,'AC_FAX').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$societe->url\" target=\"_blank\">$societe->url</a> </td></tr>";
|
||||
|
||||
// Assujeti a TVA ou pas
|
||||
|
||||
@ -533,22 +533,13 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
|
||||
print $contact->pays;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td>'.dol_print_phone($contact->phone_pro,$contact->pays_code,$contact->id,$contact->socid).'</td>';
|
||||
print '<td>'.$langs->trans("PhonePerso").'</td><td>'.dol_print_phone($contact->phone_perso,$contact->pays_code,$contact->id,$contact->socid).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td>'.dol_print_phone($contact->phone_pro,$contact->pays_code,$contact->id,$contact->socid,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("PhonePerso").'</td><td>'.dol_print_phone($contact->phone_perso,$contact->pays_code,$contact->id,$contact->socid,'AC_TEL').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td>'.dol_print_phone($contact->phone_mobile,$contact->pays_code,$contact->id,$contact->socid).'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td>'.dol_print_phone($contact->fax,$contact->pays_code,$contact->id,$contact->socid).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td>'.dol_print_phone($contact->phone_mobile,$contact->pays_code,$contact->id,$contact->socid,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td>'.dol_print_phone($contact->fax,$contact->pays_code,$contact->id,$contact->socid,'AC_FAX').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td>';
|
||||
if ($contact->email && ! ValidEmail($contact->email))
|
||||
{
|
||||
print '<font class="error">'.$langs->trans("ErrorBadEMail",$contact->email)."</font>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print dol_print_email($contact->email);
|
||||
}
|
||||
print '</td>';
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td>'.dol_print_email($contact->email,$contact->id,$contact->socid,'AC_EMAIL').'</td>';
|
||||
if ($conf->mailing->enabled)
|
||||
{
|
||||
$langs->load("mails");
|
||||
|
||||
@ -314,29 +314,18 @@ if ($result)
|
||||
|
||||
// Phone
|
||||
print '<td>';
|
||||
print dol_print_phone($obj->phone,$obj->pays_code,$obj->cidp,$obj->socid);
|
||||
print dol_print_phone($obj->phone,$obj->pays_code,$obj->cidp,$obj->socid,'AC_TEL');
|
||||
print '</td>';
|
||||
|
||||
if ($_GET["view"] == 'phone')
|
||||
{
|
||||
print '<td>'.dol_print_phone($obj->phone_mobile,$obj->pays_code,$obj->cidp,$obj->socid).' </td>';
|
||||
print '<td>'.dol_print_phone($obj->phone_mobile,$obj->pays_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
|
||||
|
||||
print '<td>'.dol_print_phone($obj->fax,$obj->pays_code,$obj->cidp,$obj->socid).' </td>';
|
||||
print '<td>'.dol_print_phone($obj->fax,$obj->pays_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
if (! $obj->email) {
|
||||
print ' ';
|
||||
}
|
||||
elseif (! ValidEmail($obj->email))
|
||||
{
|
||||
print "Bad email";
|
||||
}
|
||||
else {
|
||||
print dol_print_email($obj->email);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.dol_print_email($obj->email,$obj->cidp,$obj->socid,'AC_EMAIL').'</td>';
|
||||
}
|
||||
|
||||
// Date
|
||||
|
||||
@ -94,7 +94,8 @@ if ( $societe->fetch($socid) )
|
||||
else print $societe->pays;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Phone").'</td><td>'.dol_print_phone($societe->tel,$societe->pays_code,0,$societe->id).'</td><td>'.$langs->trans("Fax").'</td><td>'.dol_print_phone($societe->fax,$societe->pays_code,0,$societe->id).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Phone").'</td><td>'.dol_print_phone($societe->tel,$societe->pays_code,0,$societe->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td>'.dol_print_phone($societe->fax,$societe->pays_code,0,$societe->id,'AC_FAX').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$societe->url\">$societe->url</a> </td></tr>";
|
||||
|
||||
// Assujetti a TVA ou pas
|
||||
|
||||
@ -298,20 +298,14 @@ function show_contacts($conf,$langs,$db,$objsoc)
|
||||
|
||||
// Lien click to dial
|
||||
print '<td>';
|
||||
print dol_print_phone($obj->phone,$obj->pays_code,$obj->rowid,$objsoc->id);
|
||||
print dol_print_phone($obj->phone,$obj->pays_code,$obj->rowid,$objsoc->id,'AC_TEL');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print dol_print_phone($obj->fax,$obj->pays_code,$obj->rowid,$objsoc->id);
|
||||
print dol_print_phone($obj->fax,$obj->pays_code,$obj->rowid,$objsoc->id,'AC_FAX');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&backtopage=1&actioncode=AC_EMAIL&contactid='.$obj->rowid.'&socid='.$objsoc->id.'">';
|
||||
print $obj->email;
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
print '</a>';
|
||||
// \TODO
|
||||
if ($obj->email) print dol_email_link($obj->email);
|
||||
print ' </td>';
|
||||
print dol_print_email($obj->email,$obj->rowid,$objsoc->id,'AC_EMAIL');
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?action=edit&id='.$obj->rowid.'">';
|
||||
|
||||
@ -38,9 +38,9 @@ if (! defined('ADODB_DATE_VERSION')) include_once(DOL_DOCUMENT_ROOT."/includes/a
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoi vrai si l'email est syntaxiquement valide
|
||||
* \param address adresse email (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
|
||||
* \return boolean true si email valide, false sinon
|
||||
* \brief Return true if email syntax is ok
|
||||
* \param address email (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
|
||||
* \return boolean true if email ok, false if ko
|
||||
*/
|
||||
function ValidEmail($address)
|
||||
{
|
||||
@ -650,71 +650,6 @@ function dol_print_object_info($object)
|
||||
}
|
||||
|
||||
|
||||
/* For backward compatibility */
|
||||
function dolibarr_print_phone($phone,$country="FR",$cid=0,$socid=0,$nolinks=false,$separ=" ")
|
||||
{
|
||||
return dol_print_phone($phone,$country,$cid,$socid,$nolinks,$separ);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Format phone numbers according to country
|
||||
* \param phone Phone number to format
|
||||
* \param country Country to use for formatting
|
||||
* \param cid Id of contact if known
|
||||
* \param socid Id of third party if known
|
||||
* \param nolinks true means no HTML links is added
|
||||
* \param separ separation between numbers for a better visibility example : xx.xx.xx.xx.xx
|
||||
* \return string Formated phone number
|
||||
*/
|
||||
function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$nolinks=false,$separ=" ")
|
||||
{
|
||||
global $conf,$user;
|
||||
|
||||
$phone = ereg_replace("[ .-]","",trim($phone));
|
||||
if (empty($phone)) { return ''; }
|
||||
|
||||
$newphone=$phone;
|
||||
if (strtoupper($country) == "FR")
|
||||
{
|
||||
// France
|
||||
if (strlen($phone) == 10) {
|
||||
$newphone=substr($newphone,0,2).$separ.substr($newphone,2,2).$separ.substr($newphone,4,2).$separ.substr($newphone,6,2).$separ.substr($newphone,8,2);
|
||||
}
|
||||
elseif (strlen($newphone) == 7)
|
||||
{
|
||||
$newphone=substr($newphone,0,3).$separ.substr($newphone,3,2).$separ.substr($newphone,5,2);
|
||||
}
|
||||
elseif (strlen($newphone) == 9)
|
||||
{
|
||||
$newphone=substr($newphone,0,2).$separ.substr($newphone,2,3).$separ.substr($newphone,5,2).$separ.substr($newphone,7,2);
|
||||
}
|
||||
elseif (strlen($newphone) == 11)
|
||||
{
|
||||
$newphone=substr($newphone,0,3).$separ.substr($newphone,3,2).$separ.substr($newphone,5,2).$separ.substr($newphone,7,2).$separ.substr($newphone,9,2);
|
||||
}
|
||||
elseif (strlen($newphone) == 12)
|
||||
{
|
||||
$newphone=substr($newphone,0,4).$separ.substr($newphone,4,2).$separ.substr($newphone,6,2).$separ.substr($newphone,8,2).$separ.substr($newphone,10,2);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($nolinks))
|
||||
{
|
||||
if (($cid || $socid) && $conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
$newphone='<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&backtopage=1&actioncode=AC_TEL&contactid='.$cid.'&socid='.$socid.'">'.$newphone.'</a>';
|
||||
}
|
||||
$clicktodiallink=dol_print_phone_link($phone);
|
||||
if ($clicktodiallink)
|
||||
{
|
||||
$newphone='<table class="nobordernopadding"><tr><td>'.$newphone.' </td><td>'.$clicktodiallink.'</td></tr></table>';
|
||||
}
|
||||
}
|
||||
|
||||
return $newphone;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return string with formated size
|
||||
* \param size Size to print
|
||||
@ -751,41 +686,111 @@ function dol_print_url($url,$target='_blank',$max=32)
|
||||
/**
|
||||
* \brief Show EMail link
|
||||
* \param email EMail to show
|
||||
* \param cid Id of contact if known
|
||||
* \param socid Id of third party if known
|
||||
* \param addlink 0=no link to create action
|
||||
* \param max Max number of characters to show
|
||||
* \return string HTML Link
|
||||
*/
|
||||
function dol_print_email($email,$max=32)
|
||||
function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64)
|
||||
{
|
||||
$link='<a href="';
|
||||
if (! eregi('^mailto:',$email)) $link.='mailto:';
|
||||
$link.=$email;
|
||||
$link.='">';
|
||||
$link.=dolibarr_trunc($email,$max);
|
||||
$link.='</a>';
|
||||
return $link;
|
||||
global $conf,$user,$langs;
|
||||
|
||||
$newemail=$email;
|
||||
|
||||
if (empty($email)) return ' ';
|
||||
|
||||
if (! ValidEmail($email)) return "Bad email";
|
||||
|
||||
if (! empty($addlink))
|
||||
{
|
||||
$newemail='<a href="';
|
||||
if (! eregi('^mailto:',$email)) $newemail.='mailto:';
|
||||
$newemail.=$email;
|
||||
$newemail.='">';
|
||||
$newemail.=dol_trunc($email,$max);
|
||||
$newemail.='</a>';
|
||||
|
||||
if (($cid || $socid) && $conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
$type='AC_EMAIL';
|
||||
$link='<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&backtopage=1&actioncode='.$type.'&contactid='.$cid.'&socid='.$socid.'">'.img_object($langs->trans("AddAction"),"calendar").'</a>';
|
||||
$newemail='<table class="nobordernopadding"><tr><td>'.$newemail.' </td><td> '.$link.'</td></tr></table>';
|
||||
}
|
||||
}
|
||||
|
||||
return $newemail;
|
||||
}
|
||||
|
||||
/* For backward compatibility */
|
||||
function dolibarr_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=" ")
|
||||
{
|
||||
return dol_print_phone($phone,$country,$cid,$socid,$addlink,$separ);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Show click to dial link
|
||||
* \param phone Phone to call
|
||||
* \param option Type of picto
|
||||
* \return string Link
|
||||
* \brief Format phone numbers according to country
|
||||
* \param phone Phone number to format
|
||||
* \param country Country to use for formatting
|
||||
* \param cid Id of contact if known
|
||||
* \param socid Id of third party if known
|
||||
* \param addlink 0=no link to create action
|
||||
* \param separ separation between numbers for a better visibility example : xx.xx.xx.xx.xx
|
||||
* \return string Formated phone number
|
||||
*/
|
||||
function dol_print_phone_link($phone,$option=0)
|
||||
function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=" ")
|
||||
{
|
||||
global $conf,$user;
|
||||
global $conf,$user,$langs;
|
||||
|
||||
$link='';
|
||||
//if (! empty($conf->global->CLICKTODIAL_URL))
|
||||
if ($conf->clicktodial->enabled)
|
||||
// Clean phone parameter
|
||||
$phone = ereg_replace("[ .-]","",trim($phone));
|
||||
if (empty($phone)) { return ''; }
|
||||
|
||||
$newphone=$phone;
|
||||
if (strtoupper($country) == "FR")
|
||||
{
|
||||
// Cleaning phone number
|
||||
$phone = ereg_replace("[ .-]","",trim($phone));
|
||||
|
||||
$url = sprintf($conf->global->CLICKTODIAL_URL, urlencode($phone), urlencode($user->clicktodial_poste), urlencode($user->clicktodial_login), urlencode($user->clicktodial_password));
|
||||
$link.='<a href="'.$url.'">'.img_phone("default",0).'</a>';
|
||||
// France
|
||||
if (strlen($phone) == 10) {
|
||||
$newphone=substr($newphone,0,2).$separ.substr($newphone,2,2).$separ.substr($newphone,4,2).$separ.substr($newphone,6,2).$separ.substr($newphone,8,2);
|
||||
}
|
||||
elseif (strlen($newphone) == 7)
|
||||
{
|
||||
$newphone=substr($newphone,0,3).$separ.substr($newphone,3,2).$separ.substr($newphone,5,2);
|
||||
}
|
||||
elseif (strlen($newphone) == 9)
|
||||
{
|
||||
$newphone=substr($newphone,0,2).$separ.substr($newphone,2,3).$separ.substr($newphone,5,2).$separ.substr($newphone,7,2);
|
||||
}
|
||||
elseif (strlen($newphone) == 11)
|
||||
{
|
||||
$newphone=substr($newphone,0,3).$separ.substr($newphone,3,2).$separ.substr($newphone,5,2).$separ.substr($newphone,7,2).$separ.substr($newphone,9,2);
|
||||
}
|
||||
elseif (strlen($newphone) == 12)
|
||||
{
|
||||
$newphone=substr($newphone,0,4).$separ.substr($newphone,4,2).$separ.substr($newphone,6,2).$separ.substr($newphone,8,2).$separ.substr($newphone,10,2);
|
||||
}
|
||||
}
|
||||
return $link;
|
||||
|
||||
if (! empty($addlink))
|
||||
{
|
||||
if ($conf->clicktodial->enabled)
|
||||
{
|
||||
if (empty($conf->global->CLICKTODIAL_URL)) $urlmask='ErrorClickToDialModuleNotConfigured';
|
||||
else $urlmask=$conf->global->CLICKTODIAL_URL;
|
||||
$url = sprintf($urlmask, urlencode($phone), urlencode($user->clicktodial_poste), urlencode($user->clicktodial_login), urlencode($user->clicktodial_password));
|
||||
$newphone='<a href="'.$url.'">'.$newphone.'</a>';
|
||||
}
|
||||
|
||||
if (($cid || $socid) && $conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
$type='AC_TEL';
|
||||
if ($addlink == 'AC_FAX') $type='AC_FAX';
|
||||
$link='<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&backtopage=1&actioncode='.$type.'&contactid='.$cid.'&socid='.$socid.'">'.img_object($langs->trans("AddAction"),"calendar").'</a>';
|
||||
$newphone='<table class="nobordernopadding"><tr><td>'.$newphone.' </td><td> '.$link.'</td></tr></table>';
|
||||
}
|
||||
}
|
||||
|
||||
return $newphone;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1025,8 +1025,8 @@ else
|
||||
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">'.$soc->departement.'</td>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id).'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('EMail').'</td><td>';
|
||||
if ($soc->email) { print '<a href="mailto:'.$soc->email.'" target="_blank">'.$soc->email.'</a>'; }
|
||||
|
||||
@ -116,8 +116,8 @@ if ($_GET["socid"])
|
||||
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$soc->pays.'</td>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id).'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">';
|
||||
if ($soc->url) { print '<a href="http://'.$soc->url.'">http://'.$soc->url.'</a>'; }
|
||||
|
||||
@ -118,8 +118,8 @@ if($_GET["socid"])
|
||||
|
||||
print "<tr><td>".$langs->trans('Country')."</td><td colspan=\"3\">".$soc->pays."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id).'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">';
|
||||
if ($soc->url) { print '<a href="http://'.$soc->url.'">http://'.$soc->url.'</a>'; }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user