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 . */ + + if ($newsletter->state == 'DEV') { echo ' -'; + '; } elseif ($newsletter->state == 'WAIT') { echo ' -'; + '; } + +// Duplica newsletter +echo ' +'; + +echo ' +
+ + +
'; diff --git a/modules/newsletter/edit.php b/modules/newsletter/edit.php index e68a6f71d..eb5bf12f0 100755 --- a/modules/newsletter/edit.php +++ b/modules/newsletter/edit.php @@ -52,7 +52,8 @@ echo '
- {[ "type": "select", "label": "'.tr('Template email').'", "name": "id_template", "values": "query=SELECT id, name AS descrizione FROM em_templates", "required": 1, "value": "$id_template$", "disabled": 1 ]} + '.Modules::link('Template email', $record['id_template'], null, null, 'class="pull-right"').' + {[ "type": "select", "label": "'.tr('Template email').'", "name": "id_template", "values": "query=SELECT id, name AS descrizione FROM em_templates", "required": 1, "value": "$id_template$", "readonly": 1 ]}
@@ -66,7 +67,7 @@ echo '
- {[ "type": "timestamp", "label": "'.tr('Data di completamento').'", "name": "completed_at", "value": "$completed_at$", "disabled": 1 ]} + {[ "type": "timestamp", "label": "'.tr('Data di completamento').'", "name": "completed_at", "value": "$completed_at$", "readonly": 1 ]}
@@ -156,9 +157,12 @@ if (!$anagrafiche->isEmpty()) { - - + + + + + @@ -169,18 +173,24 @@ if (!$anagrafiche->isEmpty()) { $mail_id = $anagrafica->pivot->id_email; $mail = Mail::find($mail_id); if (!empty($mail) && !empty($mail->sent_at)) { - $data = timestampFormat($mail->sent_at); + $data = ' '. timestampFormat($mail->sent_at).''; } else { - $data = tr('Non ancora inviata'); + $data = ' + '.tr('Non ancora inviata').''; } echo ' email) || empty($anagrafica->enable_newsletter)) ? 'class="bg-danger"' : '').'> - + + + + 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
'.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).'" ]} + - +