1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-27 16:23:19 +01:00

Controllo su indirizzi e-mail aggiunti alla newsletter

This commit is contained in:
Luca 2021-06-01 15:17:52 +02:00
parent 290d8bdb7f
commit 0cea33c34d
2 changed files with 27 additions and 3 deletions

View File

@ -119,7 +119,31 @@ switch (filter('op')) {
$newsletter->anagrafiche()->syncWithoutDetaching($receivers);
flash()->info(tr('Aggiunti nuovi destinatari alla newsletter!'));
//Controllo indirizzo e-mail aggiunto
foreach ($newsletter->anagrafiche as $anagrafica) {
$check = Validate::isValidEmail($anagrafica['email']);
if (empty($check['valid-format'])) {
$errors[] = $anagrafica['email'];
}
}
if (!empty($errors)) {
$message = '<ul>';
foreach ($errors as $error) {
$message .= '<li>'.$error.'</li>';
}
$message .= '</ul>';
}
if (!empty($message)) {
flash()->warning(tr('Attenzione questi indirizzi e-mail non sembrano essere validi: _EMAIL_ ', [
'_EMAIL_' => $message,
]));
}else{
flash()->info(tr('Nuovi destinatari aggiunti correttamente alla newsletter!'));
}
break;

View File

@ -162,7 +162,7 @@ if (!$anagrafiche->isEmpty()) {
<th>'.tr('Tipologia').'</th>
<th class="text-center">'.tr('E-mail').'</th>
<th class="text-center">'.tr('Data di invio').'</th>
<th class="text-center" width="200">'.tr('Newsletter').'</th>
<th class="text-center">'.tr('Newsletter').'</th>
<th class="text-center" width="60">#</th>
</tr>
</thead>
@ -188,7 +188,7 @@ if (!$anagrafiche->isEmpty()) {
{[ "type": "text", "name": "email", "id": "email_'.rand(0,99999).'", "readonly": "1", "class": "email-mask", "value": "'.$anagrafica->email.'", "validation": "email" ]}</td>
<td class="text-center">'.$data.'</td>
<td class="text-left">
{[ "type": "checkbox", "readonly": "1","name": "disable_newsletter", "value": "'.!empty($anagrafica->enable_newsletter).'" ]}
'.(!empty($anagrafica->enable_newsletter) ? '<span class="fa fa-check text-success"></span> '.tr('Abilitato') : '<span class="fa fa-close text-danger"></span> '.tr('Disabilitato')).'
</td>
<td class="text-center">
<a class="btn btn-danger ask btn-xs" data-backto="record-edit" data-op="remove_receiver" data-id="'.$anagrafica->id.'">