1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-01-27 14:09:41 +01:00

Azione di gruppo aggiornamento liste newsletter

This commit is contained in:
Matteo 2021-11-03 12:48:48 +01:00
parent 955bea9ea5
commit c5bc826d3a
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,37 @@
<?php
include_once __DIR__.'/../../core.php';
use Modules\Newsletter\Lista;
switch (post('op')) {
case 'aggiorna-liste':
foreach ($id_records as $id) {
$lista = Lista::find($id);
$query = $lista->query;
if (check_query($query)) {
$lista->query = html_entity_decode($query);
}
$lista->save();
}
flash()->info(tr('Liste aggiornate!'));
break;
}
$operations['aggiorna-liste'] = [
'text' => '<span><i class="fa fa-refresh"></i> '.tr('Aggiorna liste').'</span>',
'data' => [
'msg' => tr(''),
'button' => tr('Procedi'),
'class' => 'btn btn-lg btn-danger',
],
];
return $operations;

View File

@ -26,6 +26,7 @@ use Modules\ListeNewsletter\Lista;
use Modules\Newsletter\Newsletter;
use Notifications\EmailNotification;
use PHPMailer\PHPMailer\Exception;
use Modules\Newsletter\Lista as ListaNewsletter;
include_once __DIR__.'/../../core.php';
@ -175,6 +176,15 @@ switch (filter('op')) {
// Selezione da lista newsletter
$id_list = post('id_list');
if (!empty($id_list)) {
//Aggiornamento della lista
$lista = ListaNewsletter::find($id_list);
$query = $lista->query;
if (check_query($query)) {
$lista->query = html_entity_decode($query);
}
$lista->save();
// Rimozione preventiva dei record duplicati dalla newsletter
$database->query('DELETE em_newsletter_receiver.* FROM em_newsletter_receiver
INNER JOIN em_list_receiver ON em_list_receiver.record_type = em_newsletter_receiver.record_type AND em_list_receiver.record_id = em_newsletter_receiver.record_id