Fix gestione template email

This commit is contained in:
valentina 2024-10-07 08:54:37 +02:00
parent 957f585f2c
commit de25f8829d
2 changed files with 3 additions and 8 deletions

View File

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

View File

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