diff --git a/modules/emails/edit.php b/modules/emails/edit.php index 4edaa3575..c86c8ced9 100755 --- a/modules/emails/edit.php +++ b/modules/emails/edit.php @@ -7,7 +7,7 @@ if (!$record['predefined']) { $attr = ''; } else { $attr = 'readonly'; - echo '
'.tr('Alcune impostazioni non possono essere modificate per questo stato template.').'
'; + echo '
'.tr('Alcune impostazioni non possono essere modificate per questo template.').'
'; } diff --git a/modules/interventi/actions.php b/modules/interventi/actions.php index 398443ff4..2ed7e3cc6 100755 --- a/modules/interventi/actions.php +++ b/modules/interventi/actions.php @@ -373,12 +373,16 @@ $riga = $intervento->getRiga($type, $id_riga); $dbo->query('DELETE FROM in_interventi_tecnici WHERE id='.prepare($id_sessione)); // Notifica rimozione dell' intervento al tecnico - if (!empty($tecnico['email'])) { - $template = Template::get('Notifica rimozione intervento'); + if (setting('Notifica al tecnico la rimozione da nuove attività')) { + if (!empty($tecnico['email'])) { + $template = Template::get('Notifica rimozione intervento'); - $mail = Mail::build(auth()->getUser(), $template, $id_record); - $mail->addReceiver($tecnico['email']); - $mail->save(); + if (!empty($template)){ + $mail = Mail::build(auth()->getUser(), $template, $id_record); + $mail->addReceiver($tecnico['email']); + $mail->save(); + } + } } break; diff --git a/modules/interventi/modutil.php b/modules/interventi/modutil.php index 4b1c3141c..fcbf49720 100755 --- a/modules/interventi/modutil.php +++ b/modules/interventi/modutil.php @@ -62,12 +62,16 @@ function add_tecnico($idintervento, $idtecnico, $inizio, $fine, $idcontratto = n $sessione = Sessione::build($intervento, $anagrafica, $inizio, $fine); // Notifica nuovo intervento al tecnico - if (!empty($anagrafica['email'])) { - $template = Template::get('Notifica intervento'); + if (setting('Notifica al tecnico l\'assegnazione a nuove attività')) { + if (!empty($anagrafica['email'])) { + $template = Template::get('Notifica intervento'); - $mail = Mail::build(auth()->getUser(), $template, $idintervento); - $mail->addReceiver($anagrafica['email']); - $mail->save(); + if (!empty($template)){ + $mail = Mail::build(auth()->getUser(), $template, $idintervento); + $mail->addReceiver($anagrafica['email']); + $mail->save(); + } + } } return true; diff --git a/update/2_4_16.sql b/update/2_4_16.sql index f0e2b092f..4eb7bdd07 100644 --- a/update/2_4_16.sql +++ b/update/2_4_16.sql @@ -38,4 +38,10 @@ INSERT INTO `zz_segments` (`id`, `id_module`, `name`, `clause`, `position`, `pat UPDATE `em_templates` SET `predefined` = '1' WHERE `em_templates`.`name` = 'Notifica intervento'; UPDATE `em_templates` SET `predefined` = '1' WHERE `em_templates`.`name` = 'Notifica rimozione intervento'; UPDATE `em_templates` SET `predefined` = '1' WHERE `em_templates`.`name` = 'Reset password'; -UPDATE `em_templates` SET `predefined` = '1' WHERE `em_templates`.`name` = 'Rapportino intervento'; \ No newline at end of file +UPDATE `em_templates` SET `predefined` = '1' WHERE `em_templates`.`name` = 'Rapportino intervento'; + + + +INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, 'Notifica al tecnico l\'assegnazione a nuove attività', '0', 'boolean', '1', 'Interventi', NULL, 'Notifica via email al tecnico nuove sessioni di lavoro che gli sono state assegnate (l\'indirizzo email deve essere specificato nella sua anagrafica)'); + +INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES (NULL, 'Notifica al tecnico la rimozione da nuove attività', '0', 'boolean', '1', 'Interventi', NULL, 'Notifica via email al tecnico la rimozione da sessioni di lavoro (l\'indirizzo email deve essere specificato nella sua anagrafica)'); \ No newline at end of file