Fix query

This commit is contained in:
valentina 2024-07-01 14:43:21 +02:00
parent 8c5a99400d
commit 0dbd5040f0
1 changed files with 16 additions and 15 deletions

View File

@ -43,32 +43,33 @@ UPDATE `zz_plugins` SET `options` = '{ \"main_query\": [ { \"type\": \"table\",
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = '`sottocategorie_lang`.`title`' WHERE `zz_modules`.`name` = 'Articoli' AND `zz_views`.`name` = 'Sottocategoria';
-- Gestione solleciti automatici
INSERT INTO `em_templates` (`id`, `id_module`, `name`, `icon`, `tipo_reply_to`, `reply_to`, `cc`, `bcc`, `read_notify`, `predefined`, `note_aggiuntive`, `deleted_at`, `id_account`, `created_at`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name`='Scadenzario'), 'Secondo sollecito di pagamento', 'fa fa-envelope', '', '', '', '', '0', '1', '', NULL, '1', NULL);
INSERT INTO `em_templates_lang` (`id`, `id_lang`, `id_record`, `title`, `subject`, `body`, `created_at`) VALUES (NULL, (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `em_templates` WHERE `name`='Secondo sollecito di pagamento'), 'Secondo sollecito di pagamento', 'Sollecito di pagamento fattura {numero}', '', NULL);
INSERT INTO `em_templates` (`id_module`, `name`, `icon`, `tipo_reply_to`, `reply_to`, `cc`, `bcc`, `read_notify`, `predefined`, `note_aggiuntive`, `deleted_at`, `id_account`) VALUES ((SELECT `id` FROM `zz_modules` WHERE `name`='Scadenzario'), 'Secondo sollecito di pagamento', 'fa fa-envelope', '', '', '', '', '0', '1', '', NULL, '1');
INSERT INTO `em_templates_lang` (`id_lang`, `id_record`, `title`, `subject`, `body`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `em_templates` WHERE `name`='Secondo sollecito di pagamento'), 'Secondo sollecito di pagamento', 'Sollecito di pagamento fattura {numero}', '');
INSERT INTO `em_templates` (`id`, `id_module`, `name`, `icon`, `tipo_reply_to`, `reply_to`, `cc`, `bcc`, `read_notify`, `predefined`, `note_aggiuntive`, `deleted_at`, `id_account`, `created_at`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name`='Scadenzario'), 'Terzo sollecito di pagamento', 'fa fa-envelope', '', '', '', '', '0', '1', '', NULL, '1', NULL);
INSERT INTO `em_templates_lang` (`id`, `id_lang`, `id_record`, `title`, `subject`, `body`, `created_at`) VALUES (NULL, (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `em_templates` WHERE `name`='Terzo sollecito di pagamento'), 'Terzo sollecito di pagamento', 'Sollecito di pagamento fattura {numero}', '', NULL);
INSERT INTO `em_templates` (`id_module`, `name`, `icon`, `tipo_reply_to`, `reply_to`, `cc`, `bcc`, `read_notify`, `predefined`, `note_aggiuntive`, `deleted_at`, `id_account`) VALUES ((SELECT `id` FROM `zz_modules` WHERE `name`='Scadenzario'), 'Terzo sollecito di pagamento', 'fa fa-envelope', '', '', '', '', '0', '1', '', NULL, '1');
INSERT INTO `em_templates_lang` (`id_lang`, `id_record`, `title`, `subject`, `body`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `em_templates` WHERE `name`='Terzo sollecito di pagamento'), 'Terzo sollecito di pagamento', 'Sollecito di pagamento fattura {numero}', '');
INSERT INTO `em_templates` (`id`, `id_module`, `name`, `icon`, `tipo_reply_to`, `reply_to`, `cc`, `bcc`, `read_notify`, `predefined`, `note_aggiuntive`, `deleted_at`, `id_account`, `created_at`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name`='Scadenzario'), 'Notifica interna sollecito di pagamento', 'fa fa-envelope', '', '', '', '', '0', '1', '', NULL, '1', NULL);
INSERT INTO `em_templates_lang` (`id`, `id_lang`, `id_record`, `title`, `subject`, `body`, `created_at`) VALUES (NULL, (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `em_templates` WHERE `name`='Notifica interna sollecito di pagamento'), 'Notifica interna sollecito di pagamento', 'Notifica interna sollecito di pagamento fattura {numero}', '', NULL);
INSERT INTO `em_templates` (`id_module`, `name`, `icon`, `tipo_reply_to`, `reply_to`, `cc`, `bcc`, `read_notify`, `predefined`, `note_aggiuntive`, `deleted_at`, `id_account`) VALUES ((SELECT `id` FROM `zz_modules` WHERE `name`='Scadenzario'), 'Notifica interna sollecito di pagamento', 'fa fa-envelope', '', '', '', '', '0', '1', '', NULL, '1');
INSERT INTO `em_templates_lang` (`id_lang`, `id_record`, `title`, `subject`, `body`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `em_templates` WHERE `name`='Notifica interna sollecito di pagamento'), 'Notifica interna sollecito di pagamento', 'Notifica interna sollecito di pagamento fattura {numero}', '');
UPDATE `zz_settings` SET `nome` = 'Template email primo sollecito' WHERE `zz_settings`.`nome` = 'Template email invio sollecito';
UPDATE `zz_settings_lang` SET `title` = 'Template email primo sollecito' WHERE `zz_settings_lang`.`id_record` = (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email primo sollecito');
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `created_at`, `order`) VALUES (NULL, 'Template email secondo sollecito', (SELECT `id` FROM `em_templates` WHERE `name`='Secondo sollecito di pagamento'), 'query=SELECT `em_templates`.`id`, `name` AS descrizione FROM `em_templates` LEFT JOIN `em_templates_lang` ON (`em_templates_lang`.`id_record` = `em_templates`.`id` AND `em_templates_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \"Lingua\"))', '1', 'Scadenzario', NULL, '3');
INSERT INTO `zz_settings_lang` (`id`, `id_lang`, `id_record`, `title`, `help`, `created_at`) VALUES (NULL, (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email secondo sollecito'), 'Template email secondo sollecito', '', NULL);
INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES ('Template email secondo sollecito', (SELECT `id` FROM `em_templates` WHERE `name`='Secondo sollecito di pagamento'), 'query=SELECT `em_templates`.`id`, `name` AS descrizione FROM `em_templates` LEFT JOIN `em_templates_lang` ON (`em_templates_lang`.`id_record` = `em_templates`.`id` AND `em_templates_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \"Lingua\"))', '1', 'Scadenzario', '3');
INSERT INTO `zz_settings_lang` (`id_lang`, `id_record`, `title`, `help`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email secondo sollecito'), 'Template email secondo sollecito', '');
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `created_at`, `order`) VALUES (NULL, 'Template email terzo sollecito', (SELECT `id` FROM `em_templates` WHERE `name`='Terzo sollecito di pagamento'), 'query=SELECT `em_templates`.`id`, `name` AS descrizione FROM `em_templates` LEFT JOIN `em_templates_lang` ON (`em_templates_lang`.`id_record` = `em_templates`.`id` AND `em_templates_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \"Lingua\"))', '1', 'Scadenzario', NULL, '4');
INSERT INTO `zz_settings_lang` (`id`, `id_lang`, `id_record`, `title`, `help`, `created_at`) VALUES (NULL, (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email terzo sollecito'), 'Template email terzo sollecito', '', NULL);
INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES ( 'Template email terzo sollecito', (SELECT `id` FROM `em_templates` WHERE `name`='Terzo sollecito di pagamento'), 'query=SELECT `em_templates`.`id`, `name` AS descrizione FROM `em_templates` LEFT JOIN `em_templates_lang` ON (`em_templates_lang`.`id_record` = `em_templates`.`id` AND `em_templates_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \"Lingua\"))', '1', 'Scadenzario', '4');
INSERT INTO `zz_settings_lang` (`id_lang`, `id_record`, `title`, `help`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email terzo sollecito'), 'Template email terzo sollecito', '');
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `created_at`, `order`) VALUES (NULL, 'Template email mancato pagamento dopo i solleciti', (SELECT `id` FROM `em_templates` WHERE `name`='Notifica interna sollecito di pagamento'), 'query=SELECT `em_templates`.`id`, `name` AS descrizione FROM `em_templates` LEFT JOIN `em_templates_lang` ON (`em_templates_lang`.`id_record` = `em_templates`.`id` AND `em_templates_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \"Lingua\"))', '1', 'Scadenzario', NULL, '4');
INSERT INTO `zz_settings_lang` (`id`, `id_lang`, `id_record`, `title`, `help`, `created_at`) VALUES (NULL, (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email mancato pagamento dopo i solleciti'), 'Template email mancato pagamento dopo i solleciti', '', NULL);
INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES ('Template email mancato pagamento dopo i solleciti', (SELECT `id` FROM `em_templates` WHERE `name`='Notifica interna sollecito di pagamento'), 'query=SELECT `em_templates`.`id`, `name` AS descrizione FROM `em_templates` LEFT JOIN `em_templates_lang` ON (`em_templates_lang`.`id_record` = `em_templates`.`id` AND `em_templates_lang`.`id_lang` = (SELECT `valore` FROM `zz_settings` WHERE `nome` = \"Lingua\"))', '1', 'Scadenzario', '4');
INSERT INTO `zz_settings_lang` (`id_lang`, `id_record`, `title`, `help`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Template email mancato pagamento dopo i solleciti'), 'Template email mancato pagamento dopo i solleciti', '');
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `created_at`, `order`) VALUES (NULL, 'Indirizzo email mancato pagamento dopo i solleciti', '', 'string', '1', 'Scadenzario', NULL, '4');
INSERT INTO `zz_settings_lang` (`id`, `id_lang`, `id_record`, `title`, `help`, `created_at`) VALUES (NULL, (SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Indirizzo email mancato pagamento dopo i solleciti'), 'Indirizzo email mancato pagamento dopo i solleciti', '', NULL);
INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES ('Indirizzo email mancato pagamento dopo i solleciti', '', 'string', '1', 'Scadenzario', '4');
INSERT INTO `zz_settings_lang` (`id_lang`, `id_record`, `title`, `help`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Indirizzo email mancato pagamento dopo i solleciti'), 'Indirizzo email mancato pagamento dopo i solleciti', '');
-- Ripristino impostazione per limitare la visualizzazione degli impianti a quelli gestiti dal tecnico
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES (NULL, 'Limita la visualizzazione degli impianti a quelli gestiti dal tecnico', '0', 'boolean', '1', 'Applicazione', '9');
INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES ('Limita la visualizzazione degli impianti a quelli gestiti dal tecnico', '0', 'boolean', '1', 'Applicazione', '9');
INSERT INTO `zz_settings_lang` (`id_lang`, `id_record`, `title`, `help`) VALUES ((SELECT `valore` FROM `zz_settings` WHERE `nome` = 'Lingua'), (SELECT `id` FROM `zz_settings` WHERE `nome`='Limita la visualizzazione degli impianti a quelli gestiti dal tecnico'), 'Limita la visualizzazione degli impianti a quelli gestiti dal tecnico', '');
-- Fix plugin Ddt del cliente
UPDATE `zz_plugins` SET `options` = '{ \"main_query\": [ { \"type\": \"table\", \"fields\": \"Numero, Data, Descrizione, Qtà\", \"query\": \"SELECT `dt_ddt`.`id`, (CASE WHEN `dt_tipiddt`.`dir` = \'entrata\' THEN (SELECT `id` FROM `zz_modules` WHERE `name` = \'Ddt in uscita\') ELSE (SELECT `id` FROM `zz_modules` WHERE `name` = \'Ddt in entrata\') END) AS _link_module_, `dt_ddt`.`id` AS _link_record_, IF(`dt_ddt`.`numero_esterno` = \'\', `dt_ddt`.`numero`, `dt_ddt`.`numero_esterno`) AS Numero, DATE_FORMAT(`dt_ddt`.`data`, \'%d/%m/%Y\') AS Data, `dt_righe_ddt`.`descrizione` AS `Descrizione`, REPLACE(REPLACE(REPLACE(FORMAT(`dt_righe_ddt`.`qta`, 2), \',\', \'#\'), \'.\', \',\'), \'#\', \'.\') AS `Qtà` FROM `dt_ddt` LEFT JOIN `dt_righe_ddt` ON `dt_ddt`.`id`=`dt_righe_ddt`.`idddt` JOIN `dt_tipiddt` ON `dt_ddt`.`idtipoddt` = `dt_tipiddt`.`id` WHERE `dt_ddt`.`idanagrafica`=|id_parent| ORDER BY `dt_ddt`.`id` DESC\"} ]}' WHERE `zz_plugins`.`name` = 'Ddt del cliente';