diff --git a/actions.php b/actions.php index 7eec92fcb..c7dbfab70 100755 --- a/actions.php +++ b/actions.php @@ -411,12 +411,12 @@ elseif (post('op') == 'send-email') { $visible = filter('visible'); $id_riga = filter('id_vista'); - $dbo->query('UPDATE `zz_views` SET `visible` = '.prepare($visible).' WHERE id = '.prepare($id_riga)); + $dbo->query('UPDATE `zz_views` SET `visible` = '.prepare($visible).' WHERE `id` = '.prepare($id_riga)); } elseif (filter('op') == 'ordina_colonne') { $order = explode(',', post('order', true)); foreach ($order as $i => $id_riga) { - $dbo->query('UPDATE `zz_views` SET `order` = '.prepare($i).' WHERE id='.prepare($id_riga)); + $dbo->query('UPDATE `zz_views` SET `order` = '.prepare($i).' WHERE `id`='.prepare($id_riga)); } } elseif (filter('op') == 'visualizza_righe_riferimenti') { include_once base_dir().'/include/riferimenti/riferimenti.php'; diff --git a/include/colonne.php b/include/colonne.php index a888f3bf6..3a5a7b4b6 100644 --- a/include/colonne.php +++ b/include/colonne.php @@ -27,7 +27,7 @@ echo '

'.tr('Trascina le colonne per ordinare la struttura della tabella principale, seleziona e deseleziona le colonne per renderle visibili o meno').'.

'; -$fields = $dbo->fetchArray('SELECT *, (SELECT GROUP_CONCAT(zz_groups.nome) FROM zz_group_view INNER JOIN zz_groups ON zz_group_view.id_gruppo = zz_groups.id WHERE zz_group_view.id_vista = zz_views.id) AS gruppi_con_accesso FROM zz_views WHERE id_module='.prepare($id_module).' ORDER BY `order` ASC'); +$fields = $dbo->fetchArray('SELECT *, (SELECT GROUP_CONCAT(`zz_groups`.`nome`) FROM `zz_group_view` INNER JOIN `zz_groups` ON `zz_group_view`.`id_gruppo` = `zz_groups`.`id` WHERE `zz_group_view`.`id_vista` = `zz_views`.`id`) AS gruppi_con_accesso FROM `zz_views` LEFT JOIN `zz_views_lang` ON (`zz_views`.`id` = `zz_views_lang`.`id_record` AND `zz_views_lang`.`id_lang` = '.prepare(setting('Lingua')).') WHERE `id_module`='.prepare($id_module).' ORDER BY `order` ASC'); foreach ($fields as $field) { echo '
diff --git a/modules/aggiornamenti/src/Controlli/ColonneDuplicateViste.php b/modules/aggiornamenti/src/Controlli/ColonneDuplicateViste.php index 51646c4fe..8bb3bd764 100644 --- a/modules/aggiornamenti/src/Controlli/ColonneDuplicateViste.php +++ b/modules/aggiornamenti/src/Controlli/ColonneDuplicateViste.php @@ -20,7 +20,7 @@ namespace Modules\Aggiornamenti\Controlli; use Models\Module; - +use Models\View; class ColonneDuplicateViste extends Controllo { public function getName() @@ -35,8 +35,8 @@ class ColonneDuplicateViste extends Controllo public function check() { - $duplicati = database()->fetchArray('SELECT `id_module`, `name` FROM `zz_views` GROUP BY `id_module`, `name` HAVING COUNT(`name`) > 1'); - + $duplicati = database()->fetchArray('SELECT `id_module`, `name` FROM `zz_views` LEFT JOIN `zz_views_lang` ON (`zz_views`.`id` = `zz_views_lang`.`id_record` AND `zz_views_lang`.`id_lang` = '.prepare(setting('Lingua')).') GROUP BY `id_module`, `name` HAVING COUNT(`name`) > 1'); + foreach ($duplicati as $colonna) { $modulo = Module::find($colonna['id_module']); diff --git a/modules/viste/actions.php b/modules/viste/actions.php index 63687e6b4..4c011a30d 100755 --- a/modules/viste/actions.php +++ b/modules/viste/actions.php @@ -49,7 +49,6 @@ switch (filter('op')) { foreach ($queries as $c => $query) { if (check_query($query)) { $array = [ - 'name' => post('name')[$c], 'query' => $query, 'visible' => post('visible')[$c], 'search' => post('search')[$c], @@ -62,15 +61,19 @@ switch (filter('op')) { 'id_module' => $id_record, ]; + $name = post('name')[$c]; + if (!empty(post('id')[$c]) && !empty($query)) { $id = post('id')[$c]; $dbo->update('zz_views', $array, ['id' => $id]); + $dbo->update('zz_views_lang', [ + 'name' => $name + ], ['id_record' => $id, 'id_lang' => setting('Lingua')]); + } elseif (!empty($query)) { $array['order'] = orderValue('zz_views', 'id_module', $id_record); - $dbo->insert('zz_views', $array); - $id = $dbo->lastInsertedID(); } @@ -171,7 +174,7 @@ switch (filter('op')) { $order = explode(',', post('order', true)); foreach ($order as $i => $id_riga) { - $dbo->query('UPDATE `zz_views` SET `order` = '.prepare($i).' WHERE id='.prepare($id_riga)); + $dbo->query('UPDATE `zz_views` SET `order` = '.prepare($i).' WHERE `id`='.prepare($id_riga)); } break; @@ -180,7 +183,7 @@ switch (filter('op')) { $visible = filter('visible'); $id_riga = filter('id_vista'); - $dbo->query('UPDATE `zz_views` SET `visible` = '.prepare($visible).' WHERE id = '.prepare($id_riga)); + $dbo->query('UPDATE `zz_views` SET `visible` = '.prepare($visible).' WHERE `id` = '.prepare($id_riga)); break; } diff --git a/modules/viste/edit.php b/modules/viste/edit.php index c1b12c6e7..86ef716c4 100755 --- a/modules/viste/edit.php +++ b/modules/viste/edit.php @@ -101,8 +101,8 @@ if (!empty($options) && $options != 'custom' && $options != 'menu') { echo '