diff --git a/modules/newsletter/actions.php b/modules/newsletter/actions.php
index 21810e5b7..2e36bc177 100755
--- a/modules/newsletter/actions.php
+++ b/modules/newsletter/actions.php
@@ -131,4 +131,22 @@ switch (filter('op')) {
flash()->info(tr('Destinatario rimosso dalla newsletter!'));
break;
+
+
+ // Duplica newsletter
+ case 'copy':
+
+ $new = $newsletter->replicate();
+ $new->state = 'DEV';
+ $new->completed_at = null;
+ $new->save();
+
+ $id_record = $new->id;
+
+
+ flash()->info(tr('Newsletter duplicata correttamente!'));
+
+ break;
+
+
}
diff --git a/modules/newsletter/buttons.php b/modules/newsletter/buttons.php
index a71d0a662..d12515943 100755
--- a/modules/newsletter/buttons.php
+++ b/modules/newsletter/buttons.php
@@ -17,14 +17,28 @@
* along with this program. If not, see
'.tr('Nome').' | -'.tr('Indirizzo').' | +'.tr('Ragione sociale').' | +'.tr('Tipo').' | +'.tr('Tipologia').' | +'.tr('E-mail').' | '.tr('Data di invio').' | +'.tr('Newsletter').' | # |
---|---|---|---|---|---|---|---|---|
'.Modules::link('Anagrafiche', $anagrafica->id, $anagrafica->ragione_sociale).' | -'.$anagrafica->email.' | +'.$database->fetchOne('SELECT GROUP_CONCAT(an_tipianagrafiche.descrizione) AS descrizione FROM an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica = an_tipianagrafiche.idtipoanagrafica WHERE an_tipianagrafiche_anagrafiche.idanagrafica='.prepare($anagrafica->id))['descrizione'].' | +'.$anagrafica->tipo.' | +'.$anagrafica->email.' | '.$data.' | ++ {[ "type": "checkbox", "readonly": "1","name": "disable_newsletter", "value": "'.!empty($anagrafica->enable_newsletter).'" ]} + | - + | diff --git a/update/2_4_24.sql b/update/2_4_24.sql index 24717adb2..6d02c1f7b 100644 --- a/update/2_4_24.sql +++ b/update/2_4_24.sql @@ -3,4 +3,15 @@ INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, ((SELECT `id` FROM `zz_modules` WHERE name='Fatture di acquisto'), 'N. Prot.', 'co_documenti.numero', 1, 1, 0, 0, '', '', 0, 0, 0); -- Formattazione colonna data modulo Ordini fornitore -UPDATE `zz_views` SET `format`=1 WHERE `zz_views`.`name`='Data' AND `zz_views`.`id_module`=(SELECT `id` FROM `zz_modules` WHERE name='Ordini fornitore'); \ No newline at end of file +UPDATE `zz_views` SET `format`=1 WHERE `zz_views`.`name`='Data' AND `zz_views`.`id_module`=(SELECT `id` FROM `zz_modules` WHERE name='Ordini fornitore'); + +-- Colonna stato per newsletter +INSERT INTO `zz_views` ( `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES +((SELECT `id` FROM `zz_modules` WHERE name='Newsletter'), 'Stato', 'IF(em_newsletters.state = \'DEV\', \'Bozza\', IF(em_newsletters.state = \'WAIT\', \'Invio in corso\', \'Completata\'))', 4, 1, 0, 0, '', '', 1, 0, 0); + +-- Colonna destinatari per newsletter +INSERT INTO `zz_views` ( `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES +((SELECT `id` FROM `zz_modules` WHERE name='Newsletter'), 'Destinatari', '(SELECT COUNT(*) FROM `em_newsletter_anagrafica` WHERE `em_newsletter_anagrafica`.`id_newsletter` = `em_newsletters`.`id`)', 5, 1, 0, 0, '', '', 1, 0, 0); + +-- Aggiorno colonna completato per newsletter +UPDATE `zz_views` SET `query` = 'IF(completed_at IS NULL, \'No\', CONCAT(\'Sì \', \'(\', DATE_FORMAT(completed_at, \'%d/%m/%Y %H:%i:%s\' ), \')\'))', `order` = 6 WHERE `zz_views`.`id_module` = (SELECT `id` FROM `zz_modules` WHERE name='Newsletter') AND `name` = 'Completato'; \ No newline at end of file