From 0319cf06fb6a41cfdc2b6124bdb526e2379be377 Mon Sep 17 00:00:00 2001 From: Pek5892 Date: Wed, 22 Feb 2023 10:53:55 +0100 Subject: [PATCH] Correzione vista scadenzario --- update/2_4_41.sql | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 update/2_4_41.sql diff --git a/update/2_4_41.sql b/update/2_4_41.sql new file mode 100644 index 000000000..1a8316bfd --- /dev/null +++ b/update/2_4_41.sql @@ -0,0 +1,21 @@ +-- Correzione vista Scadenzario +UPDATE `zz_modules` SET `options` = " +SELECT + |select| +FROM + `co_scadenziario` + LEFT JOIN `co_documenti` ON `co_scadenziario`.`iddocumento` = `co_documenti`.`id` + LEFT JOIN (SELECT `co_banche`.`nome`AS nome, `co_banche`.`id` FROM `co_banche` INNER JOIN `co_documenti` ON `co_documenti`.`id_banca_azienda` = `co_banche`.`id`)AS banca ON `co_scadenziario`.`iddocumento` = `co_documenti`.`id` + LEFT JOIN `an_anagrafiche` ON `co_scadenziario`.`idanagrafica` = `an_anagrafiche`.`idanagrafica` + LEFT JOIN `co_pagamenti` ON `co_documenti`.`idpagamento` = `co_pagamenti`.`id` + LEFT JOIN `co_tipidocumento` ON `co_documenti`.`idtipodocumento` = `co_tipidocumento`.`id` + LEFT JOIN `co_statidocumento` ON `co_documenti`.`idstatodocumento` = `co_statidocumento`.`id` + LEFT JOIN (SELECT `zz_operations`.`id_email`, `zz_operations`.`id_record` FROM `zz_operations` INNER JOIN `em_emails` ON `zz_operations`.`id_email` = `em_emails`.`id` INNER JOIN `em_templates` ON `em_emails`.`id_template` = `em_templates`.`id` INNER JOIN `zz_modules` ON `zz_operations`.`id_module` = `zz_modules`.`id` WHERE `zz_modules`.`name` = 'Scadenzario' AND `zz_operations`.`op` = 'send-email' GROUP BY `zz_operations`.`id_record`) AS `email` ON `email`.`id_record` = `co_scadenziario`.`id` +WHERE + 1=1 AND (`co_statidocumento`.`descrizione` IS NULL OR `co_statidocumento`.`descrizione` IN('Emessa','Parzialmente pagato','Pagato')) +GROUP BY + id +HAVING + 2=2 +ORDER BY + `scadenza` ASC" WHERE `name` = 'Scadenzario'; \ No newline at end of file