diff --git a/modules/emails/actions.php b/modules/emails/actions.php index 76914a7b9..926d0d5c4 100755 --- a/modules/emails/actions.php +++ b/modules/emails/actions.php @@ -28,10 +28,7 @@ switch (post('op')) { $name = post('name'); $subject = post('subject'); - $template = Template::build($module, $id_account); - if (Models\Locale::getDefault()->id == Models\Locale::getPredefined()->id) { - $template->name = $descrizione; - } + $template = Template::build($module, $id_account, $name); $id_record = $dbo->lastInsertedID(); $template->setTranslation('title', $name); $template->setTranslation('subject', $subject); @@ -43,9 +40,6 @@ switch (post('op')) { case 'update': $template->setTranslation('title', post('name')); - if (Models\Locale::getDefault()->id == Models\Locale::getPredefined()->id) { - $template->name = $descrizione; - } $template->id_account = post('smtp'); $template->icon = post('icon'); $template->tipo_reply_to = post('tipo_reply_to'); diff --git a/modules/emails/src/Template.php b/modules/emails/src/Template.php index 00daef76b..6b5966c62 100755 --- a/modules/emails/src/Template.php +++ b/modules/emails/src/Template.php @@ -52,11 +52,12 @@ class Template extends Model return (array) $variables; } - public static function build($id_module = null, $id_account = null) + public static function build($id_module = null, $id_account = null, $name = null) { $model = new static(); $model->id_module = $id_module; $model->id_account = $id_account; + $model->name = $name; $model->save(); return $model;