From f32aeac94776f6fccad31e083a2bc5d3bf1f5820 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Oct 2025 17:00:55 +0100 Subject: [PATCH] NEW Show warning on banner when an email is not valid --- htdocs/core/class/commonpeople.class.php | 2 +- htdocs/core/lib/functions.lib.php | 32 ++++++++++++------------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index 1883a88410f..ac427c583e8 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -316,7 +316,7 @@ trait CommonPeople } $outdone = 0; if (!empty($this->email)) { - $out .= dol_print_email($this->email, $this->id, $object->id, 1, 0, 0, 1); + $out .= dol_print_email($this->email, $this->id, $object->id, 1, 0, 1, 1); $outdone++; } if (!empty($this->url)) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 54de5dbe9e9..d4e4aed501d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4244,7 +4244,7 @@ function dol_print_url($url, $target = '_blank', $max = 32, $withpicto = 0, $mor * Show EMail link formatted for HTML output. * * @param string $email EMail to show (only email, without 'Name of recipient' before) - * @param int $cid Id of contact if known + * @param int $contactid Id of contact if known * @param int $socid Id of third party if known * @param int|string $addlink 0=no link, 1=email has a html email link (+ link to create action if constant AGENDA_ADDACTIONFOREMAIL is on), 'thirdparty'=link to the thirdparty presend email * @param int $max Max number of characters to show. Use -1 to hide the mail text and show only the picto. @@ -4253,7 +4253,7 @@ function dol_print_url($url, $target = '_blank', $max = 32, $withpicto = 0, $mor * @param string $morecss More CSS * @return string HTML Link */ -function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64, $showinvalid = 1, $withpicto = 0, $morecss = 'paddingrightonly') +function dol_print_email($email, $contactid = 0, $socid = 0, $addlink = 0, $max = 64, $showinvalid = 1, $withpicto = 0, $morecss = 'paddingrightonly') { global $user, $langs, $hookmanager; @@ -4291,11 +4291,11 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64, $newemail .= img_warning($langs->trans("ErrorBadEMail", $email), '', 'paddingrightonly'); } - if (($cid || $socid) && isModEnabled('agenda') && $user->hasRight("agenda", "myactions", "create")) { + if (($contactid || $socid) && isModEnabled('agenda') && $user->hasRight("agenda", "myactions", "create")) { $type = 'AC_EMAIL'; $linktoaddaction = ''; if (getDolGlobalString('AGENDA_ADDACTIONFOREMAIL')) { - $linktoaddaction = '' . img_object($langs->trans("AddAction"), "calendar") . ''; + $linktoaddaction = '' . img_object($langs->trans("AddAction"), "calendar") . ''; } if ($linktoaddaction) { $newemail = '
' . $newemail . ' ' . $linktoaddaction . '
'; @@ -4325,7 +4325,7 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64, $rep = $newemail; if ($hookmanager) { - $parameters = array('cid' => $cid, 'socid' => $socid, 'addlink' => $addlink, 'picto' => $withpicto); + $parameters = array('cid' => $contactid, 'socid' => $socid, 'addlink' => $addlink, 'picto' => $withpicto); $reshook = $hookmanager->executeHooks('printEmail', $parameters, $email); if ($reshook > 0) { @@ -4378,13 +4378,13 @@ function getArrayOfSocialNetworks() * Show social network link * * @param string $value Social network ID to show (only skype, without 'Name of recipient' before) - * @param int $cid Id of contact if known + * @param int $contactid Id of contact if known * @param int $socid Id of third party if known - * @param string $type 'skype','facebook',... + * @param string $type Type of social network: 'skype','facebook',... * @param array $dictsocialnetworks List of socialnetworks available * @return string HTML Link */ -function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetworks = array()) +function dol_print_socialnetworks($value, $contactid, $socid, $type, $dictsocialnetworks = array()) { global $hookmanager, $langs, $user; @@ -4409,11 +4409,11 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor $htmllink .= '?chat" alt="' . $langs->trans("Chat") . ' ' . $value . '" title="' . dol_escape_htmltag($langs->trans("Chat") . ' ' . $value) . '">'; $htmllink .= ''; $htmllink .= ''; - if (($cid || $socid) && isModEnabled('agenda') && $user->hasRight('agenda', 'myactions', 'create')) { + if (($contactid || $socid) && isModEnabled('agenda') && $user->hasRight('agenda', 'myactions', 'create')) { $addlink = 'AC_SKYPE'; $link = ''; if (getDolGlobalString('AGENDA_ADDACTIONFORSKYPE')) { - $link = '' . img_object($langs->trans("AddAction"), "calendar") . ''; + $link = '' . img_object($langs->trans("AddAction"), "calendar") . ''; } $htmllink .= ($link ? ' ' . $link : ''); } @@ -4466,7 +4466,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor if ($hookmanager) { $parameters = array( 'value' => $value, - 'cid' => $cid, + 'cid' => $contactid, 'socid' => $socid, 'type' => $type, 'dictsocialnetworks' => $dictsocialnetworks, @@ -4538,7 +4538,7 @@ function dol_print_profids($profID, $profIDtype, $countrycode = '', $addcpButton * * @param string $phone Phone number to format * @param string $countrycode Country code to use for formatting - * @param int $cid Id of contact if known + * @param int $contactid Id of contact if known * @param int $socid Id of third party if known * @param string $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set), 'tel'=Force "tel:..." link * @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx. You can also use 'hidenum' to hide the number, keep only the picto. @@ -4548,7 +4548,7 @@ function dol_print_profids($profID, $profIDtype, $countrycode = '', $addcpButton * @param string $morecss Add more css * @return string Formatted phone number */ -function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addlink = '', $separ = " ", $withpicto = '', $titlealt = '', $adddivfloat = 0, $morecss = 'paddingright') +function dol_print_phone($phone, $countrycode = '', $contactid = 0, $socid = 0, $addlink = '', $separ = " ", $withpicto = '', $titlealt = '', $adddivfloat = 0, $morecss = 'paddingright') { global $conf, $user, $langs, $mysoc, $hookmanager; @@ -4815,7 +4815,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli } } - //if (($cid || $socid) && isModEnabled('agenda') && $user->hasRight('agenda', 'myactions', 'create')) + //if (($contactid || $socid) && isModEnabled('agenda') && $user->hasRight('agenda', 'myactions', 'create')) if (isModEnabled('agenda') && $user->hasRight("agenda", "myactions", "create")) { $type = 'AC_TEL'; $addlinktoagenda = ''; @@ -4823,7 +4823,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli $type = 'AC_FAX'; } if (getDolGlobalString('AGENDA_ADDACTIONFORPHONE')) { - $addlinktoagenda = '' . img_object($langs->trans("AddAction"), "calendar") . ''; + $addlinktoagenda = '' . img_object($langs->trans("AddAction"), "calendar") . ''; } if ($addlinktoagenda) { $newphone = '' . $newphone . ' ' . $addlinktoagenda . ''; @@ -4843,7 +4843,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli $rep = ''; if ($hookmanager) { - $parameters = array('countrycode' => $countrycode, 'cid' => $cid, 'socid' => $socid, 'titlealt' => $titlealt, 'picto' => $withpicto); + $parameters = array('countrycode' => $countrycode, 'cid' => $contactid, 'socid' => $socid, 'titlealt' => $titlealt, 'picto' => $withpicto); $reshook = $hookmanager->executeHooks('printPhone', $parameters, $phone); $rep .= $hookmanager->resPrint; }