diff --git a/modules/emails/actions.php b/modules/emails/actions.php index 4ad383afa..2f31706dc 100755 --- a/modules/emails/actions.php +++ b/modules/emails/actions.php @@ -31,7 +31,7 @@ switch (post('op')) { $template = Template::build($module, $id_account); $id_record = $dbo->lastInsertedID(); $template->setTranslation('name', $name); - $template->subject = $subject; + $template->setTranslation('subject', $subject); $template->save(); flash()->info(tr('Aggiunto nuovo template per le email!')); @@ -48,8 +48,8 @@ switch (post('op')) { $template->bcc = post('bcc'); $template->read_notify = post('read_notify'); $template->note_aggiuntive = post('note_aggiuntive'); - $template->subject = post('subject'); - $template->body = post('body'); + $template->setTranslation('subject', post('subject')); + $template->setTranslation('body', post('body')); $template->save(); $dbo->sync('em_print_template', ['id_template' => $id_record], ['id_print' => (array) post('prints')]); diff --git a/modules/newsletter/actions.php b/modules/newsletter/actions.php index 558bb25d6..3511148f2 100755 --- a/modules/newsletter/actions.php +++ b/modules/newsletter/actions.php @@ -20,7 +20,6 @@ use Modules\Anagrafiche\Anagrafica; use Modules\Anagrafiche\Referente; use Modules\Anagrafiche\Sede; -use Modules\Emails\Mail; use Modules\Emails\Template; use Modules\ListeNewsletter\Lista; use Modules\Newsletter\Newsletter; @@ -31,9 +30,8 @@ include_once __DIR__.'/../../core.php'; switch (filter('op')) { case 'add': - $template = Template::find(filter('id_template')); + $template = Template::find(post('id_template')); $newsletter = Newsletter::build($user, $template, filter('name')); - $id_record = $newsletter->id; flash()->info(tr('Nuova campagna newsletter creata!')); @@ -41,7 +39,7 @@ switch (filter('op')) { break; case 'update': - $newsletter->setTranslation('name', filter('name')); + $newsletter->name = filter('name'); $newsletter->state = filter('state'); $newsletter->completed_at = filter('completed_at'); diff --git a/modules/newsletter/src/Newsletter.php b/modules/newsletter/src/Newsletter.php index a2de7dd6b..2faafcee6 100755 --- a/modules/newsletter/src/Newsletter.php +++ b/modules/newsletter/src/Newsletter.php @@ -46,10 +46,9 @@ class Newsletter extends Model $model->user()->associate($user); $model->template()->associate($template); - $model->setTranslation('name', $name); - - $model->subject = $template->subject; - $model->content = $template->body; + $model->name = $name; + $model->subject = $template->getTranslation('subject'); + $model->content = $template->getTranslation('body'); $model->state = 'DEV';