diff --git a/modules/emails/actions.php b/modules/emails/actions.php index 788f08d5f..76914a7b9 100755 --- a/modules/emails/actions.php +++ b/modules/emails/actions.php @@ -58,6 +58,7 @@ switch (post('op')) { $template->setTranslation('body', post('body')); $template->type = post('type'); $template->indirizzi_proposti = post('indirizzi_proposti'); + $template->enabled = post('enabled'); $template->save(); $prints[] = post('prints'); diff --git a/modules/emails/edit.php b/modules/emails/edit.php index 57bd960f7..1dd60b74a 100755 --- a/modules/emails/edit.php +++ b/modules/emails/edit.php @@ -40,13 +40,17 @@ if (!$record['predefined']) {
-
+
{[ "type": "text", "label": "", "name": "name", "value": "$title$", "required": 1, "extra": "" ]}
{[ "type": "span", "label": "", "name": "module", "values": "query=SELECT `zz_modules`.`id`, `title` AS descrizione FROM `zz_modules` LEFT JOIN `zz_modules_lang` ON (`zz_modules`.`id` = `zz_modules_lang`.`id_record` AND `zz_modules_lang`.`id_lang` = id); ?>) WHERE `enabled` = 1", "value": "getTranslation('title'); ?>" ]}
+ +
+ {[ "type": "checkbox", "label": "", "name": "enabled", "value": "$enabled$", "values": "Sì,No" ]} +
diff --git a/src/HTMLBuilder/Manager/ButtonManager.php b/src/HTMLBuilder/Manager/ButtonManager.php index f82388b52..fce2223b4 100755 --- a/src/HTMLBuilder/Manager/ButtonManager.php +++ b/src/HTMLBuilder/Manager/ButtonManager.php @@ -125,7 +125,7 @@ class ButtonManager implements ManagerInterface if ($options['type'] == 'print') { $results = \Prints::getModulePrints($options['id_module']); } elseif ($options['type'] == 'email') { - $results = TemplateEmail::where('id_module', $options['id_module'])->with(['translations' => function ($query) { + $results = TemplateEmail::where('id_module', $options['id_module'])->where('enabled', 1)->with(['translations' => function ($query) { $query->orderBy('title'); }])->get()->toArray(); } elseif ($options['type'] == 'sms') { diff --git a/update/2_5_5.sql b/update/2_5_5.sql index 764173d8b..fe3072bc4 100644 --- a/update/2_5_5.sql +++ b/update/2_5_5.sql @@ -37,4 +37,7 @@ INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione` INSERT INTO `zz_settings_lang` (`id`, `id_lang`, `id_record`, `title`, `help`) VALUES (NULL, '1', (SELECT `zz_settings`.`id` FROM `zz_settings` WHERE `zz_settings`.`nome` = 'Tile server satellite'), 'Tile server satellite', ''), -(NULL, '2', (SELECT `zz_settings`.`id` FROM `zz_settings` WHERE `zz_settings`.`nome` = 'Tile server satellite'), 'Satellite tile server', ''); \ No newline at end of file +(NULL, '2', (SELECT `zz_settings`.`id` FROM `zz_settings` WHERE `zz_settings`.`nome` = 'Tile server satellite'), 'Satellite tile server', ''); + +-- Aggiunto flag Attivo in Template +ALTER TABLE `em_templates` ADD `enabled` BOOLEAN NOT NULL DEFAULT TRUE AFTER `note_aggiuntive`; \ No newline at end of file