From c1bf18cd8b7a4d2787d45c1edc5e33d99b4936cd Mon Sep 17 00:00:00 2001 From: valentina Date: Fri, 21 Jun 2024 15:27:14 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20creazione=20attivit=C3=A0=20collegate=20a?= =?UTF-8?q?=20impianti?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/interventi/actions.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/interventi/actions.php b/modules/interventi/actions.php index a233cc886..6302ece26 100644 --- a/modules/interventi/actions.php +++ b/modules/interventi/actions.php @@ -252,9 +252,9 @@ switch (post('op')) { // Collegamenti intervento/impianti $impianti = post('idimpianti'); - if (!empty($impianti)) { - $impianti = array_unique([$impianti]); - foreach ($impianti as $impianto) { + foreach ($impianti as $impianto) { + if (!empty($impianto)) { + $dbo->insert('my_impianti_interventi', [ 'idintervento' => $id_record, 'idimpianto' => $impianto, @@ -274,10 +274,12 @@ switch (post('op')) { $check->save(); } } + } - // Collegamenti intervento/componenti - $componenti = (array) post('componenti'); - foreach ($componenti as $componente) { + // Collegamenti intervento/componenti + $componenti = (array) post('componenti'); + foreach ($componenti as $componente) { + if ($componente) { $dbo->insert('my_componenti_interventi', [ 'id_intervento' => $id_record, 'id_componente' => $componente,