Fix newsletter

This commit is contained in:
Pek5892 2024-03-26 16:06:18 +01:00
parent d451464911
commit e71ede0641
3 changed files with 8 additions and 11 deletions

View File

@ -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')]);

View File

@ -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');

View File

@ -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';