diff --git a/actions.php b/actions.php index d14e04b47..5a8b7d2bf 100644 --- a/actions.php +++ b/actions.php @@ -2,11 +2,11 @@ include_once __DIR__.'/core.php'; -use Models\MailTemplate; use Models\Note; use Models\OperationLog; use Modules\Checklists\Check; use Modules\Checklists\Checklist; +use Modules\Emails\Template; if (empty($structure) || empty($structure['enabled'])) { die(tr('Accesso negato')); @@ -207,12 +207,11 @@ elseif (filter('op') == 'sort_checks') { // Inizializzazione email elseif (post('op') == 'send-email') { - $template = MailTemplate::find(post('template')); + $template = Template::find(post('template')); - $mail = \Models\Mail::build($user, $template, $id_record); + $mail = \Modules\Emails\Mail::build($user, $template, $id_record); // Rimozione allegati predefiniti - $mail->resetAttachments(); $mail->resetPrints(); // Destinatari @@ -236,9 +235,9 @@ elseif (post('op') == 'send-email') { } // Allegati originali - $files = post('attachments'); + $files = post('uploads'); foreach ($files as $file) { - $mail->addAttachment($file); + $mail->addUpload($file); } $mail->save(); diff --git a/lib/functions.php b/lib/functions.php index 6d208e143..eb0046b7c 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -5,7 +5,6 @@ * * @since 2.3 */ - use Models\OperationLog; /** diff --git a/mail.php b/mail.php index fd1ced26f..1df3bc4ee 100644 --- a/mail.php +++ b/mail.php @@ -1,10 +1,10 @@ module; $smtp = $template->account; @@ -81,7 +81,7 @@ echo ' '; // Stampe -$selected_prints = $dbo->fetchArray('SELECT id_print FROM em_template_print WHERE id_email = '.prepare($template['id'])); +$selected_prints = $dbo->fetchArray('SELECT id_print FROM em_print_template WHERE id_template = '.prepare($template['id'])); $selected = array_column($selected_prints, 'id_print'); echo ' @@ -91,17 +91,17 @@ echo ' {[ "type": "select", "multiple": "1", "label": "'.tr('Stampe').'", "name": "prints[]", "value": "'.implode(',', $selected).'", "values": "query=SELECT id, title AS text FROM zz_prints WHERE id_module = '.prepare($id_module).' AND enabled=1" ]} '; -$attachments = []; +$uploads = []; if ($template['name'] == 'Fattura Elettronica') { - $attachments = $dbo->fetchArray('SELECT id FROM zz_files WHERE id_module = '.prepare($module['id']).' AND id_record = '.prepare($id_record).' AND category = \'Fattura Elettronica\''); - $attachments = array_column($attachments, 'id'); + $uploads = $dbo->fetchArray('SELECT id FROM zz_files WHERE id_module = '.prepare($module['id']).' AND id_record = '.prepare($id_record).' AND category = \'Fattura Elettronica\''); + $uploads = array_column($uploads, 'id'); } // Allegati echo '
- {[ "type": "select", "multiple": "1", "label": "'.tr('Allegati').'", "name": "attachments[]", "value": "'.implode(',', $attachments).'", "values": "query=SELECT id, name AS text FROM zz_files WHERE id_module = '.prepare($id_module).' AND id_record = '.prepare($id_record)." UNION SELECT id, CONCAT(name, ' (Azienda)') AS text FROM zz_files WHERE id_module = ".prepare(Modules::get('Anagrafiche')['id'])." AND id_record = (SELECT valore FROM zz_settings WHERE nome = 'Azienda predefinita')\" ]} + {[ "type": "select", "multiple": "1", "label": "'.tr('Allegati').'", "name": "uploads[]", "value": "'.implode(',', $uploads).'", "values": "query=SELECT id, name AS text FROM zz_files WHERE id_module = '.prepare($id_module).' AND id_record = '.prepare($id_record)." UNION SELECT id, CONCAT(name, ' (Azienda)') AS text FROM zz_files WHERE id_module = ".prepare(Modules::get('Anagrafiche')['id'])." AND id_record = (SELECT valore FROM zz_settings WHERE nome = 'Azienda predefinita')\" ]}
"; diff --git a/modules/emails/actions.php b/modules/emails/actions.php index 97dadd007..8466062d6 100644 --- a/modules/emails/actions.php +++ b/modules/emails/actions.php @@ -7,7 +7,7 @@ switch (post('op')) { $dbo->insert('em_templates', [ 'name' => post('name'), 'id_module' => post('module'), - 'id_smtp' => post('smtp'), + 'id_account' => post('smtp'), 'subject' => post('subject'), ]); @@ -20,7 +20,7 @@ switch (post('op')) { case 'update': $dbo->update('em_templates', [ 'name' => post('name'), - 'id_smtp' => post('smtp'), + 'id_account' => post('smtp'), 'icon' => post('icon'), 'subject' => post('subject'), 'reply_to' => post('reply_to'), @@ -30,7 +30,7 @@ switch (post('op')) { 'read_notify' => post('read_notify'), ], ['id' => $id_record]); - $dbo->sync('em_template_print', ['id_email' => $id_record], ['id_print' => (array) post('prints')]); + $dbo->sync('em_print_template', ['id_template' => $id_record], ['id_print' => (array) post('prints')]); flash()->info(tr('Informazioni salvate correttamente!')); diff --git a/modules/emails/add.php b/modules/emails/add.php index 6b3eac6ec..9647c2678 100644 --- a/modules/emails/add.php +++ b/modules/emails/add.php @@ -25,7 +25,7 @@ include_once __DIR__.'/../../core.php';
- {[ "type": "select", "label": "", "name": "smtp", "value": "$id_smtp$", "ajax-source": "smtp" ]} + {[ "type": "select", "label": "", "name": "smtp", "value": "$id_account$", "ajax-source": "smtp" ]}
diff --git a/modules/emails/edit.php b/modules/emails/edit.php index c70094c45..39c4c8e84 100644 --- a/modules/emails/edit.php +++ b/modules/emails/edit.php @@ -26,7 +26,7 @@ include_once __DIR__.'/../../core.php';
- {[ "type": "select", "label": "", "name": "smtp", "value": "$id_smtp$", "ajax-source": "smtp" ]} + {[ "type": "select", "label": "", "name": "smtp", "value": "$id_account$", "ajax-source": "smtp" ]}
@@ -62,7 +62,7 @@ include_once __DIR__.'/../../core.php'; fetchArray('SELECT id_print FROM em_template_print WHERE id_email = '.prepare($id_record)); +$selected_prints = $dbo->fetchArray('SELECT id_print FROM em_print_template WHERE id_template = '.prepare($id_record)); $selected = array_column($selected_prints, 'id_print'); echo ' diff --git a/modules/emails/init.php b/modules/emails/init.php index ecad92ee3..cd509545b 100644 --- a/modules/emails/init.php +++ b/modules/emails/init.php @@ -1,5 +1,7 @@ fetchOne('SELECT * FROM em_templates WHERE id='.prepare($id_record).' AND deleted_at IS NULL'); } diff --git a/src/Models/MailAccount.php b/modules/emails/src/Account.php similarity index 68% rename from src/Models/MailAccount.php rename to modules/emails/src/Account.php index 42003968b..d81a24d5d 100644 --- a/src/Models/MailAccount.php +++ b/modules/emails/src/Account.php @@ -1,12 +1,12 @@ hasMany(MailTemplate::class, 'id_smtp'); + return $this->hasMany(Template::class, 'id_account'); } } diff --git a/modules/emails/src/EmailHook.php b/modules/emails/src/EmailHook.php index 0b02da458..3461e4b5b 100644 --- a/modules/emails/src/EmailHook.php +++ b/modules/emails/src/EmailHook.php @@ -3,15 +3,13 @@ namespace Modules\Emails; use Hooks\Manager; -use Models\Mail; -use Models\MailAccount; use Notifications\EmailNotification; class EmailHook extends Manager { public function execute() { - $accounts = MailAccount::all(); + $accounts = Account::all(); $diff = date('Y-m-d', strtotime('-4 hours')); $list = []; diff --git a/src/Models/Mail.php b/modules/emails/src/Mail.php similarity index 61% rename from src/Models/Mail.php rename to modules/emails/src/Mail.php index 60bc34783..fe5bb7e3d 100644 --- a/src/Models/Mail.php +++ b/modules/emails/src/Mail.php @@ -1,19 +1,17 @@ created_by = $user->id; - $model->id_template = $template->id; + if (!empty($template)) { + $model->id_template = $template->id; + $model->id_account = $template->account->id; + } + $model->id_record = $id_record; + $model->save(); + if (!empty($template)) { $model->resetFromTemplate(); } @@ -43,18 +47,9 @@ class Mail extends Model * * @param string $file_id */ - public function addAttachment($file_id) + public function addUpload($file_id, $name = null) { - if (!isset($this->attachments)) { - $this->attachments = []; - } - - $this->attachments[] = $file_id; - } - - public function resetAttachments() - { - $this->attachments = []; + $this->uploads()->attach($file_id, ['id_email' => $this->id, 'name' => $name]); } /** @@ -65,25 +60,16 @@ class Mail extends Model */ public function addPrint($print_id, $name = null) { - if (!isset($this->prints)) { - $this->prints = []; - } - - $print = PrintTemplate::find($print_id); - - if (empty($name)) { - $name = $print['title'].'.pdf'; - } - - $this->prints[] = [ - 'id' => $print['id'], - 'name' => $name, - ]; + $this->prints()->attach($print_id, ['id_email' => $this->id, 'name' => $name]); } public function resetPrints() { - $this->prints = []; + $prints = $this->prints; + + foreach ($prints as $print) { + $this->prints()->detach($print->id, ['id_email' => $this->id]); + } } /** @@ -98,33 +84,16 @@ class Mail extends Model return; } - if (!isset($this->receivers)) { - $this->receivers = []; - } - $list = explode(';', $value); - foreach ($list as $element) { - $this->receivers[] = [ - 'email' => $element, - 'type' => $type, - ]; + foreach ($list as $address) { + if (!empty($address)) { + $receiver = Receiver::build($this, $address, $type); + } } } public function save(array $options = []) { - if (isset($this->receivers)) { - $this->setReceiversAttribute($this->receivers); - } - - if (isset($this->attachments)) { - $this->setAttachmentsAttribute($this->attachments); - } - - if (isset($this->prints)) { - $this->setPrintsAttribute($this->prints); - } - if (isset($this->options)) { $this->setOptionsAttribute($this->options); } @@ -139,36 +108,6 @@ class Mail extends Model // Attributi Eloquent - public function setReceiversAttribute($value) - { - $this->attributes['receivers'] = json_encode($value); - } - - public function getReceiversAttribute() - { - return json_decode($this->attributes['receivers'], true); - } - - public function setAttachmentsAttribute($value) - { - $this->attributes['attachments'] = json_encode($value); - } - - public function getAttachmentsAttribute() - { - return json_decode($this->attributes['attachments'], true); - } - - public function setPrintsAttribute($value) - { - $this->attributes['prints'] = json_encode($value); - } - - public function getPrintsAttribute() - { - return json_decode($this->attributes['prints'], true); - } - public function setOptionsAttribute($value) { $this->attributes['options'] = json_encode($value); @@ -189,7 +128,17 @@ class Mail extends Model return $this->options['read-notify']; } - public function setSubjecyAttribute($value) + /** + * Imposta il titolo della notifica. + * + * @param bool $value + */ + public function setReadNotifyAttribute($value) + { + $this->options['read-notify'] = boolval($value); + } + + public function setSubjectAttribute($value) { if (isset($this->template)) { $module = $this->template->module; @@ -211,26 +160,16 @@ class Mail extends Model $this->attributes['content'] = $value; } - /** - * Imposta il titolo della notifica. - * - * @param bool $value - */ - public function setReadNotifyAttribute($value) - { - $this->options['read-notify'] = boolval($value); - } - /* Relazioni Eloquent */ public function account() { - return $this->belongsTo(MailAccount::class, 'id_account')->withTrashed(); + return $this->belongsTo(Account::class, 'id_account')->withTrashed(); } public function template() { - return $this->belongsTo(MailTemplate::class, 'id_template')->withTrashed(); + return $this->belongsTo(Template::class, 'id_template')->withTrashed(); } public function user() @@ -240,7 +179,22 @@ class Mail extends Model public function newsletter() { - return $this->belongsTo(Newsletter::class, 'id_campaign'); + return $this->belongsTo(Newsletter::class, 'id_newsletter'); + } + + public function receivers() + { + return $this->hasMany(Receiver::class, 'id_email'); + } + + public function uploads() + { + return $this->belongsToMany(Upload::class, 'em_email_upload', 'id_email', 'id_file')->withPivot('name'); + } + + public function prints() + { + return $this->belongsToMany(PrintTemplate::class, 'em_email_print', 'id_email', 'id_print')->withPivot('name'); } protected function resetFromTemplate() @@ -270,9 +224,9 @@ class Mail extends Model } // Incluesione stampe predefinite - $prints = database()->fetchArray('SELECT id_print FROM em_template_print WHERE id_email = '.prepare($template['id'])); + $prints = $template->prints; foreach ($prints as $print) { - $this->addPrint($print['id_print']); + $this->addPrint($print['id']); } } } diff --git a/modules/emails/src/Receiver.php b/modules/emails/src/Receiver.php new file mode 100644 index 000000000..a3ffc9565 --- /dev/null +++ b/modules/emails/src/Receiver.php @@ -0,0 +1,29 @@ +email()->associate($mail); + + $model->address = $address; + $model->type = $type ?: 'a'; + + $model->save(); + } + + public function email() + { + return $this->belongsTo(Mail::class, 'id_email'); + } +} diff --git a/src/Models/MailTemplate.php b/modules/emails/src/Template.php similarity index 65% rename from src/Models/MailTemplate.php rename to modules/emails/src/Template.php index 845359b23..c50bd66ed 100644 --- a/src/Models/MailTemplate.php +++ b/modules/emails/src/Template.php @@ -1,12 +1,14 @@ belongsTo(MailAccount::class, 'id_smtp')->withTrashed(); + return $this->belongsTo(Account::class, 'id_account')->withTrashed(); + } + + public function prints() + { + return $this->belongsToMany(PrintTemplate::class, 'em_print_template', 'id_template', 'id_print'); } } diff --git a/modules/fatture/bulk.php b/modules/fatture/bulk.php index 3b8e6b6bb..345e32485 100644 --- a/modules/fatture/bulk.php +++ b/modules/fatture/bulk.php @@ -141,7 +141,7 @@ switch (post('op')) { if ($result) { ++$added; - //operationLog('export-xml-bulk', ['id_record' => $r['id']]); + //operationLog('export-xml-bulk', ['id_record' => $r['id']]); } else { $failed[] = $fattura->numero_esterno; } diff --git a/modules/fatture/variables.php b/modules/fatture/variables.php index db5f07269..d011bc69f 100644 --- a/modules/fatture/variables.php +++ b/modules/fatture/variables.php @@ -7,7 +7,7 @@ $r = $dbo->fetchOne('SELECT co_documenti.*, an_anagrafiche.pec, an_anagrafiche.ragione_sociale, co_tipidocumento.descrizione AS tipo_documento, - (SELECT pec FROM em_accounts WHERE em_accounts.id='.prepare($template['id_smtp']).') AS is_pec + (SELECT pec FROM em_accounts WHERE em_accounts.id='.prepare($template['id_account']).') AS is_pec FROM co_documenti INNER JOIN an_anagrafiche ON co_documenti.idanagrafica=an_anagrafiche.idanagrafica INNER JOIN co_tipidocumento ON co_tipidocumento.id=co_documenti.idtipodocumento diff --git a/modules/interventi/actions.php b/modules/interventi/actions.php index 155733d29..f5697ef93 100644 --- a/modules/interventi/actions.php +++ b/modules/interventi/actions.php @@ -2,10 +2,10 @@ include_once __DIR__.'/../../core.php'; -use Models\Mail; -use Models\MailTemplate; use Modules\Anagrafiche\Anagrafica; use Modules\Articoli\Articolo as ArticoloOriginale; +use Modules\Emails\Mail; +use Modules\Emails\Template; use Modules\Interventi\Components\Articolo; use Modules\Interventi\Components\Riga; use Modules\Interventi\Components\Sconto; @@ -51,7 +51,7 @@ switch (post('op')) { // Notifica chiusura intervento $stato = $dbo->selectOne('in_statiintervento', '*', ['idstatointervento' => post('idstatointervento')]); if (!empty($stato['notifica']) && !empty($stato['destinatari']) && $stato['idstatointervento'] != $record['idstatointervento']) { - $template = MailTemplate::find($stato['id_email']); + $template = Template::find($stato['id_email']); $mail = Mail::build(auth()->getUser(), $template, $id_record); $mail->addReceiver($stato['destinatari']); @@ -477,7 +477,7 @@ switch (post('op')) { $stato = $dbo->selectOne('in_statiintervento', '*', ['descrizione' => 'Completato']); // Notifica chiusura intervento if (!empty($stato['notifica']) && !empty($stato['destinatari'])) { - $template = MailTemplate::find($stato['id_email']); + $template = Template::find($stato['id_email']); $mail = Mail::build(auth()->getUser(), $template, $id_record); $mail->addReceiver($stato['destinatari']); @@ -521,7 +521,7 @@ switch (post('op')) { // Notifica rimozione dell' intervento al tecnico if (!empty($tecnico['email'])) { - $template = MailTemplate::get('Notifica rimozione intervento'); + $template = Template::get('Notifica rimozione intervento'); $mail = Mail::build(auth()->getUser(), $template, $id_record); $mail->addReceiver($tecnico['email']); diff --git a/modules/interventi/modutil.php b/modules/interventi/modutil.php index ed6db032b..f750707f6 100644 --- a/modules/interventi/modutil.php +++ b/modules/interventi/modutil.php @@ -2,9 +2,9 @@ include_once __DIR__.'/../../core.php'; -use Models\Mail; -use Models\MailTemplate; use Modules\Anagrafiche\Anagrafica; +use Modules\Emails\Mail; +use Modules\Emails\Template; use Modules\Fatture\Components\Descrizione; use Modules\Fatture\Components\Riga; use Modules\Fatture\Fattura; @@ -63,7 +63,7 @@ function add_tecnico($idintervento, $idtecnico, $inizio, $fine, $idcontratto = n // Notifica nuovo intervento al tecnico if (!empty($tecnico['email'])) { - $template = MailTemplate::get('Notifica intervento'); + $template = Template::get('Notifica intervento'); $mail = Mail::build(auth()->getUser(), $template, $idintervento); $mail->addReceiver($anagrafica['email']); diff --git a/modules/newsletter/actions.php b/modules/newsletter/actions.php index ee733b988..9cc690061 100644 --- a/modules/newsletter/actions.php +++ b/modules/newsletter/actions.php @@ -1,13 +1,13 @@ id; @@ -48,16 +48,16 @@ switch (filter('op')) { continue; } - $mail = \Models\Mail::build($user, $template, $anagrafica->id); + $mail = \Modules\Emails\Mail::build($user, $template, $anagrafica->id); $mail->addReceiver($anagrafica['email']); $mail->subject = $newsletter->subject; $mail->content = $newsletter->content; - $mail->id_campaign = $newsletter->id; + $mail->id_newsletter = $newsletter->id; foreach ($uploads as $upload) { - $mail->addAttachment($upload); + $mail->addUpload($upload); } $mail->save(); diff --git a/modules/newsletter/edit.php b/modules/newsletter/edit.php index 96aa95522..d95bf0988 100644 --- a/modules/newsletter/edit.php +++ b/modules/newsletter/edit.php @@ -1,6 +1,6 @@ belongsToMany(Anagrafica::class, 'em_campaign_anagrafica', 'id_campaign', 'id_anagrafica')->withPivot('id_email'); + return $this->belongsToMany(Anagrafica::class, 'em_newsletter_anagrafica', 'id_newsletter', 'id_anagrafica')->withPivot('id_email'); } public function emails() { - return $this->hasMany(Mail::class, 'id_campaign'); + return $this->hasMany(Mail::class, 'id_newsletter'); } public function account() { - return $this->belongsTo(MailAccount::class, 'id_account'); + return $this->belongsTo(Account::class, 'id_account'); } public function template() { - return $this->belongsTo(MailTemplate::class, 'id_template'); + return $this->belongsTo(Template::class, 'id_template'); } public function user() diff --git a/modules/scadenzario/variables.php b/modules/scadenzario/variables.php index 7ef10cbe8..fb6e1dfa2 100644 --- a/modules/scadenzario/variables.php +++ b/modules/scadenzario/variables.php @@ -5,7 +5,7 @@ $r = $dbo->fetchOne('SELECT co_scadenziario.*, co_documenti.*, an_anagrafiche.pec, an_anagrafiche.ragione_sociale, co_scadenziario.da_pagare - co_scadenziario.pagato AS totale, - (SELECT pec FROM em_accounts WHERE em_accounts.id='.prepare($template['id_smtp']).') AS is_pec, + (SELECT pec FROM em_accounts WHERE em_accounts.id='.prepare($template['id_account']).') AS is_pec, (SELECT descrizione FROM co_pagamenti WHERE co_pagamenti.id = co_documenti.idpagamento) AS pagamento FROM co_scadenziario INNER JOIN co_documenti ON co_documenti.id = co_scadenziario.iddocumento diff --git a/modules/smtp/edit.php b/modules/smtp/edit.php index 266970a94..6216f3e71 100644 --- a/modules/smtp/edit.php +++ b/modules/smtp/edit.php @@ -82,7 +82,7 @@ include_once __DIR__.'/../../core.php'; fetchArray('SELECT `id`, `name` FROM `em_templates` WHERE `id_smtp` = '.prepare($id_record)); +$elementi = $dbo->fetchArray('SELECT `id`, `name` FROM `em_templates` WHERE `id_account` = '.prepare($id_record)); if (!empty($elementi)) { echo ' diff --git a/modules/stato_email/edit.php b/modules/stato_email/edit.php new file mode 100644 index 000000000..1ab1d3a6f --- /dev/null +++ b/modules/stato_email/edit.php @@ -0,0 +1,38 @@ + +
+
+

'.tr('Informazioni').'

+
+ +
+
+
+ {[ "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 ]} +
+ +
+ {[ "type": "span", "label": "'.tr('Data di invio').'", "name": "sent_at", "value": "$sent_at$" ]} +
+ +
+ {[ "type": "span", "label": "'.tr('Ultimo tentativo').'", "name": "failed_at", "value": "$failed_at$" ]} +
+
+ +
+
+ +

'.tr('Oggetto').'

+
+'.$mail->subject.' +
+ +

'.tr('Contenuto').'

+
+'.$mail->content.' +
'; diff --git a/modules/stato_email/init.php b/modules/stato_email/init.php new file mode 100644 index 000000000..ad0d40654 --- /dev/null +++ b/modules/stato_email/init.php @@ -0,0 +1,11 @@ +toArray(); +} diff --git a/reset.php b/reset.php index 35ed2d6df..ae46e038b 100644 --- a/reset.php +++ b/reset.php @@ -3,9 +3,9 @@ $skip_permissions = true; include_once __DIR__.'/core.php'; -use Models\Mail; -use Models\MailTemplate; use Models\User; +use Modules\Emails\Mail; +use Modules\Emails\Template; use Notifications\EmailNotification; $token = get('reset_token'); @@ -26,7 +26,7 @@ switch (post('op')) { $utente->reset_token = secure_random_string(); $utente->save(); - $template = MailTemplate::get('Reset password'); + $template = Template::get('Reset password'); $mail = Mail::build($user, $template, $utente->id); $mail->addReceiver($utente->email); diff --git a/src/Extensions/MessageHandler.php b/src/Extensions/MessageHandler.php index 19df93336..9811556ef 100644 --- a/src/Extensions/MessageHandler.php +++ b/src/Extensions/MessageHandler.php @@ -21,7 +21,9 @@ class MessageHandler extends AbstractProcessingHandler if (auth()->check()) { $message .= ' - '.tr('Se il problema persiste siete pregati di chiedere assistenza tramite la sezione Bug').'. '; + '.tr('Se il problema persiste siete pregati di chiedere assistenza tramite il forum apposito (_LINK_FORUM_)', [ + '_LINK_FORUM_' => 'https://forum.openstamanager.com/', + ]).'.'; if (auth()->isAdmin()) { $message .= ' diff --git a/src/HTMLBuilder/Manager/ButtonManager.php b/src/HTMLBuilder/Manager/ButtonManager.php index 81eaf3f27..ca72c9054 100644 --- a/src/HTMLBuilder/Manager/ButtonManager.php +++ b/src/HTMLBuilder/Manager/ButtonManager.php @@ -2,7 +2,7 @@ namespace HTMLBuilder\Manager; -use Models\MailTemplate; +use Modules\Emails\Template; /** * @since 2.4 @@ -38,7 +38,7 @@ class ButtonManager implements ManagerInterface 'icon' => $print['icon'], ]; } else { - $template = MailTemplate::find($options['id']); + $template = Template::find($options['id']); $result = [ 'link' => ROOTDIR.'/mail.php?id_module='.$options['id_module'].'&id_record='.$options['id_record'].'&id='.$options['id'], @@ -87,7 +87,7 @@ class ButtonManager implements ManagerInterface if ($options['type'] == 'print') { $results = \Prints::getModulePrints($options['id_module']); } else { - $results = MailTemplate::where('id_module', $options['id_module'])->get()->toArray(); + $results = Template::where('id_module', $options['id_module'])->get()->toArray(); } return $results; diff --git a/src/HTMLBuilder/Manager/EmailManager.php b/src/HTMLBuilder/Manager/EmailManager.php index 5f6fbd16d..540b36948 100644 --- a/src/HTMLBuilder/Manager/EmailManager.php +++ b/src/HTMLBuilder/Manager/EmailManager.php @@ -2,9 +2,7 @@ namespace HTMLBuilder\Manager; -use Models\Mail; -use Prints; -use Translator; +use Modules\Emails\Mail; /** * Gestione allegati. @@ -49,28 +47,24 @@ class EmailManager implements ManagerInterface