NEW Show warning on banner when an email is not valid

This commit is contained in:
Laurent Destailleur
2025-10-29 17:00:55 +01:00
parent d0c4d2d8b4
commit f32aeac947
2 changed files with 17 additions and 17 deletions

View File

@@ -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 = '<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>';
$linktoaddaction = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode=' . urlencode($type) . '&amp;contactid=' . ((int) $contactid) . '&amp;socid=' . ((int) $socid) . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>';
}
if ($linktoaddaction) {
$newemail = '<div>' . $newemail . ' ' . $linktoaddaction . '</div>';
@@ -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<string,array{rowid:int,label:string,url:string,icon:string,active:int}> $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") . '&nbsp;' . $value . '" title="' . dol_escape_htmltag($langs->trans("Chat") . ' ' . $value) . '">';
$htmllink .= '<img class="paddingleft" src="' . DOL_URL_ROOT . '/theme/common/skype_chatbutton.png" border="0">';
$htmllink .= '</a>';
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 = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode=' . $addlink . '&amp;contactid=' . $cid . '&amp;socid=' . $socid . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>';
$link = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode=' . $addlink . '&amp;contactid=' . $contactid . '&amp;socid=' . $socid . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>';
}
$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 = "&nbsp;", $withpicto = '', $titlealt = '', $adddivfloat = 0, $morecss = 'paddingright')
function dol_print_phone($phone, $countrycode = '', $contactid = 0, $socid = 0, $addlink = '', $separ = "&nbsp;", $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 = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;backtopage=' . urlencode($_SERVER['REQUEST_URI']) . '&amp;actioncode=' . $type . ($cid ? '&amp;contactid=' . $cid : '') . ($socid ? '&amp;socid=' . $socid : '') . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>';
$addlinktoagenda = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;backtopage=' . urlencode($_SERVER['REQUEST_URI']) . '&amp;actioncode=' . $type . ($contactid ? '&amp;contactid=' . $contactid : '') . ($socid ? '&amp;socid=' . $socid : '') . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>';
}
if ($addlinktoagenda) {
$newphone = '<span>' . $newphone . ' ' . $addlinktoagenda . '</span>';
@@ -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;
}