diff --git a/modules/categorie_impianti/actions.php b/modules/categorie_impianti/actions.php index 1b11511f9..7edda20ee 100755 --- a/modules/categorie_impianti/actions.php +++ b/modules/categorie_impianti/actions.php @@ -105,7 +105,7 @@ switch (filter('op')) { $id = $id_record; } - if ($dbo->fetchNum('SELECT * FROM `my_impianti` WHERE (`id_categoria`='.prepare($id).' ) AND `deleted_at` IS NULL') == 0) { + if ($dbo->fetchNum('SELECT * FROM `my_impianti` WHERE (`id_categoria`='.prepare($id).' OR `id_sottocategoria`='.prepare($id).' OR `id_sottocategoria` IN (SELECT id FROM `my_impianti_categorie` WHERE `parent`='.prepare($id).')) AND `deleted_at` IS NULL') == 0) { $dbo->query('DELETE FROM `my_impianti_categorie` WHERE `id`='.prepare($id)); flash()->info(tr('_TYPE_ eliminata con successo!', [