Fix per php8.1

This commit is contained in:
Pek5892 2024-04-12 16:25:04 +02:00
parent fc495377d6
commit 8ffe852c19
3 changed files with 17 additions and 5 deletions

View File

@ -52,9 +52,21 @@ switch (post('op')) {
$template->setTranslation('body', post('body'));
$template->save();
$dbo->sync('em_print_template', ['id_template' => $id_record], ['id_print' => (array) post('prints')]);
$dbo->sync('em_mansioni_template', ['id_template' => $id_record], ['idmansione' => (array) post('idmansioni')]);
$prints[] = post('prints');
foreach ($prints as $print) {
if (!empty($print)) {
$dbo->sync('em_print_template', ['id_template' => $id_record], ['id_print' => $print]);
}
}
$mansioni[] = post('idmansioni');
foreach ($mansioni as $mansione) {
if (!empty($mansione)) {
$dbo->sync('em_mansioni_template', ['id_template' => $id_record], ['idmansione' => $mansione]);
}
}
flash()->info(tr('Informazioni salvate correttamente!'));
break;

View File

@ -22,8 +22,8 @@ use Modules\Newsletter\Newsletter;
include_once __DIR__.'/../../core.php';
if (isset($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM em_templates LEFT JOIN `em_templates_lang` ON (`em_templates`.`id` = `em_templates_lang`.`id_record` AND `em_templates_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `em_templates`.`id`='.prepare($id_record).' AND `deleted_at` IS NULL');
if (!empty($id_record)) {
$record = $dbo->fetchOne('SELECT `em_templates`.*, `em_templates_lang`.`name` FROM `em_templates` LEFT JOIN `em_templates_lang` ON (`em_templates`.`id` = `em_templates_lang`.`id_record` AND `em_templates_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `em_templates`.`id`='.prepare($id_record).' AND `deleted_at` IS NULL');
$template = Template::find($id_record);

View File

@ -22,7 +22,7 @@ use Modules\Newsletter\Newsletter;
include_once __DIR__.'/../../core.php';
if (isset($id_record)) {
if (!empty(($id_record))) {
$newsletter = Newsletter::find($id_record);
$record = $newsletter->toArray();