2
0
forked from Wavyzz/dolibarr

Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2024-02-20 14:50:51 +01:00
2 changed files with 25 additions and 12 deletions

View File

@@ -2677,7 +2677,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
// Show address and email
if (method_exists($object, 'getBannerAddress') && !in_array($object->element, array('product', 'bookmark', 'ecm_directories', 'ecm_files'))) {
$moreaddress = $object->getBannerAddress('refaddress', $object);
$moreaddress = $object->getBannerAddress('refaddress', $object); // address, email, url, social networks
if ($moreaddress) {
$morehtmlref .= '<div class="refidno refaddress">';
$morehtmlref .= $moreaddress;
@@ -3379,9 +3379,9 @@ function dol_print_url($url, $target = '_blank', $max = 32, $withpicto = 0, $mor
$linkend = '</a>';
if ($morecss == 'float') { // deprecated
return '<div class="nospan'.($morecss ? ' '.$morecss : '').'" style="margin-right: 10px">'.($withpicto ? img_picto($langs->trans("Url"), 'globe').' ' : '').$link.'</div>';
return '<div class="nospan'.($morecss ? ' '.$morecss : '').'" style="margin-right: 10px">'.($withpicto ? img_picto($langs->trans("Url"), 'globe', 'class="paddingrightonly"') : '').$link.'</div>';
} else {
return $linkstart.'<span class="nospan'.($morecss ? ' '.$morecss : '').'" style="margin-right: 10px">'.($withpicto ? img_picto('', 'globe').' ' : '').$link.'</span>'.$linkend;
return $linkstart.'<span class="nospan'.($morecss ? ' '.$morecss : '').'" style="margin-right: 10px">'.($withpicto ? img_picto('', 'globe', 'class="paddingrightonly"') : '').$link.'</span>'.$linkend;
}
}
@@ -3399,7 +3399,10 @@ function dol_print_url($url, $target = '_blank', $max = 32, $withpicto = 0, $mor
*/
function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64, $showinvalid = 1, $withpicto = 0)
{
global $conf, $user, $langs, $hookmanager;
global $user, $langs, $hookmanager;
//global $conf; $conf->global->AGENDA_ADDACTIONFOREMAIL = 1;
//$showinvalid = 1; $email = 'rrrrr';
$newemail = dol_escape_htmltag($email);
@@ -3412,30 +3415,35 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
}
if (!empty($addlink)) {
$newemail = '<a style="text-overflow: ellipsis;" href="';
$newemail = '<a class="paddingrightonly" style="text-overflow: ellipsis;" href="';
if (!preg_match('/^mailto:/i', $email)) {
$newemail .= 'mailto:';
}
$newemail .= $email;
$newemail .= '">';
$newemail .= ($withpicto ? img_picto($langs->trans("EMail").' : '.$email, (is_numeric($withpicto) ? 'email' : $withpicto), 'class="paddingrightonly"') : '');
$newemail .= dol_trunc($email, $max);
$newemail .= '</a>';
if ($showinvalid && !isValidEmail($email)) {
$langs->load("errors");
$newemail .= img_warning($langs->trans("ErrorBadEMail", $email));
$newemail .= img_warning($langs->trans("ErrorBadEMail", $email), '', 'paddingrightonly');
}
if (($cid || $socid) && isModEnabled('agenda') && $user->hasRight("agenda", "myactions", "create")) {
$type = 'AC_EMAIL';
$link = '';
$linktoaddaction = '';
if (getDolGlobalString('AGENDA_ADDACTIONFOREMAIL')) {
$link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode='.$type.'&amp;contactid='.$cid.'&amp;socid='.$socid.'">'.img_object($langs->trans("AddAction"), "calendar").'</a>';
$linktoaddaction = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode='.urlencode($type).'&amp;contactid='.((int) $cid).'&amp;socid='.((int) $socid).'">'.img_object($langs->trans("AddAction"), "calendar").'</a>';
}
if ($link) {
$newemail = '<div>'.$newemail.' '.$link.'</div>';
if ($linktoaddaction) {
$newemail = '<div>'.$newemail.' '.$linktoaddaction.'</div>';
}
}
} else {
$newemail = ($withpicto ? img_picto($langs->trans("EMail").' : '.$email, (is_numeric($withpicto) ? 'email' : $withpicto), 'class="paddingrightonly"') : '').$newemail;
if ($showinvalid && !isValidEmail($email)) {
$langs->load("errors");
$newemail .= img_warning($langs->trans("ErrorBadEMail", $email));
@@ -3443,8 +3451,10 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
}
//$rep = '<div class="nospan" style="margin-right: 10px">';
$rep = ($withpicto ? img_picto($langs->trans("EMail").' : '.$email, (is_numeric($withpicto) ? 'email' : $withpicto)).' ' : '').$newemail;
//$rep = ($withpicto ? img_picto($langs->trans("EMail").' : '.$email, (is_numeric($withpicto) ? 'email' : $withpicto), 'class="paddingrightonly"') : '').$newemail;
//$rep .= '</div>';
$rep = $newemail;
if ($hookmanager) {
$parameters = array('cid' => $cid, 'socid' => $socid, 'addlink' => $addlink, 'picto' => $withpicto);