Skip to content

Commit 6941e44

Browse files
committed
2 parents 9cbd304 + 757d9ab commit 6941e44

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

update/2_10.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,11 @@ ALTER TABLE `zz_users` ADD `session_token` VARCHAR(64) NULL DEFAULT NULL AFTER `
204204

205205
-- Aggiunta risorsa API per la gestione dei movimenti manuali
206206
INSERT INTO `zz_api_resources` (`id`, `version`, `type`, `resource`, `class`, `enabled`, `created_at`, `updated_at`) VALUES (NULL, 'app-v1', 'retrieve', 'movimento-manuale', 'API\\App\\v1\\MovimentiManuali', '1', NULL, NULL)
207+
208+
-- #1628 Colonna sede destinazione in preventivi
209+
SELECT @id_module := `id` FROM `zz_modules` WHERE `name` = 'Preventivi';
210+
211+
UPDATE `zz_modules` SET `options` = 'SELECT\r\n |select|\r\nFROM\r\n `co_preventivi`\r\n LEFT JOIN `an_anagrafiche` ON `co_preventivi`.`idanagrafica` = `an_anagrafiche`.`idanagrafica`\r\n LEFT JOIN `co_statipreventivi` ON `co_preventivi`.`idstato` = `co_statipreventivi`.`id`\r\n LEFT JOIN `co_statipreventivi_lang` ON (`co_statipreventivi`.`id` = `co_statipreventivi_lang`.`id_record` AND co_statipreventivi_lang.id_lang = |lang|)\r\n LEFT JOIN (SELECT `idpreventivo`, SUM(`subtotale` - `sconto`) AS `totale_imponibile`, SUM(`subtotale` - `sconto` + `iva`) AS `totale` FROM `co_righe_preventivi` GROUP BY `idpreventivo`) AS righe ON `co_preventivi`.`id` = `righe`.`idpreventivo`\r\n LEFT JOIN (SELECT `an_anagrafiche`.`idanagrafica`, `an_anagrafiche`.`ragione_sociale` AS nome FROM `an_anagrafiche`) AS agente ON `agente`.`idanagrafica` = `co_preventivi`.`idagente`\r\n LEFT JOIN (SELECT GROUP_CONCAT(DISTINCT `co_documenti`.`numero_esterno` SEPARATOR \', \') AS `info`, `co_righe_documenti`.`original_document_id` AS `idpreventivo` FROM `co_documenti` INNER JOIN `co_righe_documenti` ON `co_documenti`.`id` = `co_righe_documenti`.`iddocumento` WHERE `original_document_type` = \'ModulesPreventiviPreventivo\' GROUP BY `idpreventivo`, `original_document_id`) AS `fattura` ON `fattura`.`idpreventivo` = `co_preventivi`.`id`\r\n LEFT JOIN (SELECT COUNT(em_emails.id) AS emails, em_emails.id_record FROM em_emails INNER JOIN zz_operations ON zz_operations.id_email = em_emails.id WHERE id_module IN (SELECT `id` FROM `zz_modules` WHERE `name` = \'Preventivi\') AND `zz_operations`.`op` = \'send-email\' GROUP BY em_emails.id_record) AS `email` ON `email`.`id_record` = `co_preventivi`.`id`\r\n LEFT JOIN (SELECT `an_sedi`.`id`, CONCAT(`an_sedi`.`nomesede`, \'<br />\', IF(`an_sedi`.`telefono` != \'\', CONCAT(`an_sedi`.`telefono`, \'<br />\'), \'\'), IF(`an_sedi`.`cellulare` != \'\', CONCAT(`an_sedi`.`cellulare`, \'<br />\'), \'\'), `an_sedi`.`citta`, IF(`an_sedi`.`indirizzo` != \'\', CONCAT(\' - \', `an_sedi`.`indirizzo`), \'\')) AS `info` FROM `an_sedi`) AS `sede_destinazione` ON `sede_destinazione`.`id` = `co_preventivi`.`idsede_destinazione`\r\nWHERE\r\n 1=1\r\n |segment(`co_preventivi`.`id_segment`)|\r\n |date_period(custom,\'|period_start|\' >= `data_bozza` AND \'|period_start|\' <= `data_conclusione`,\'|period_end|\' >= `data_bozza` AND \'|period_end|\' <= `data_conclusione`,`data_bozza` >= \'|period_start|\' AND `data_bozza` <= \'|period_end|\',`data_conclusione` >= \'|period_start|\' AND `data_conclusione` <= \'|period_end|\',`data_bozza` >= \'|period_start|\' AND `data_conclusione` = NULL)|\r\n AND `default_revision` = 1\r\nGROUP BY\r\n `co_preventivi`.`id`,\r\n `fattura`.`info`\r\nHAVING\r\n 2=2\r\nORDER BY\r\n `co_preventivi`.`data_bozza` DESC, `numero` ASC', `options2` = '' WHERE `zz_modules`.`id` = @id_module;
212+
213+
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `html_format`, `search_inside`, `order_by`, `visible`, `summable`, `avg`, `default`) VALUES
214+
(@id_module, 'Opt-in newsletter', 'IF(co_preventivi.idsede_destinazione > 0, sede_destinazione.info, CONCAT(\'\', IF(an_anagrafiche.telefono!=\'\',CONCAT(an_anagrafiche.telefono,\'<br>\'),\'\'),IF(an_anagrafiche.cellulare!=\'\',CONCAT(an_anagrafiche.cellulare,\'<br>\'),\'\'),IF(an_anagrafiche.citta!=\'\',an_anagrafiche.citta,\'\'),IF(an_anagrafiche.indirizzo!=\'\',CONCAT(\' - \',an_anagrafiche.indirizzo),\'\')))', '5', '1', '0', '0', '1', NULL, NULL, '0', '0', '0', '1');

0 commit comments

Comments
 (0)