Skip to content
Snippets Groups Projects
Commit 570194b4 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix validation of email when there is a comma separator.

parent ae8d090e
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,7 @@ $langs->load("orders"); ...@@ -33,6 +33,7 @@ $langs->load("orders");
$langs->load("propal"); $langs->load("propal");
$langs->load("bills"); $langs->load("bills");
$langs->load("errors"); $langs->load("errors");
$langs->load("mails");
// Security check // Security check
if (!$user->admin) if (!$user->admin)
...@@ -76,7 +77,9 @@ if ($action == 'setvalue' && $user->admin) ...@@ -76,7 +77,9 @@ if ($action == 'setvalue' && $user->admin)
* View * View
*/ */
llxHeader(); $form=new Form($db);
llxHeader('',$langs->trans("NotificationSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("NotificationSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("NotificationSetup"),$linkback,'setup');
...@@ -132,9 +135,19 @@ foreach($listofnotifiedevents as $notifiedevent) ...@@ -132,9 +135,19 @@ foreach($listofnotifiedevents as $notifiedevent)
print '<td>'.$elementLabel.'</td>'; print '<td>'.$elementLabel.'</td>';
print '<td>'.$notifiedevent['code'].'</td>'; print '<td>'.$notifiedevent['code'].'</td>';
print '<td>'.$label.'</td>'; print '<td>'.$label.'</td>';
print '<td>';
$param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code']; $param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'];
print '<td><input type="email" size="32" name="'.$param.'" value="'.dol_escape_htmltag(GETPOST($param)?GETPOST($param,'alpha'):$conf->global->$param).'">'; $value=GETPOST($param)?GETPOST($param,'alpha'):$conf->global->$param;
if (! empty($conf->global->$param) && ! isValidEmail($conf->global->$param)) print ' '.img_warning($langs->trans("ErrorBadEMail")); $s='<input type="text" size="32" name="'.$param.'" value="'.dol_escape_htmltag($value).'">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
$arrayemail=explode(',',$value);
$showwarning=0;
foreach($arrayemail as $key=>$valuedet)
{
$valuedet=trim($valuedet);
if (! empty($valuedet) && ! isValidEmail($valuedet)) $showwarning++;
}
if ((! empty($conf->global->$param)) && $showwarning) $s.=' '.img_warning($langs->trans("ErrorBadEMail"));
print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment