diff --git a/modules/stampe/actions.php b/modules/stampe/actions.php index e0f245879..52c22a545 100755 --- a/modules/stampe/actions.php +++ b/modules/stampe/actions.php @@ -21,9 +21,21 @@ include_once __DIR__.'/../../core.php'; switch (post('op')) { case 'update': + + $predefined = post('predefined'); + if (!empty($predefined) && !empty(post('module'))) { + $dbo->query('UPDATE zz_prints SET predefined = 0 WHERE id_module = '.post('module')); + } + $print->title = post('title'); $print->filename = post('filename'); $print->options = post('options'); + //$print->id_module = post('module'); + //$print->enabled = post('enabled'); + $print->order = post('order'); + $print->predefined = post('predefined'); + + $print->save(); flash()->info(tr('Modifiche salvate correttamente')); diff --git a/modules/stampe/edit.php b/modules/stampe/edit.php index 60d1705fe..7a2fd0e5c 100755 --- a/modules/stampe/edit.php +++ b/modules/stampe/edit.php @@ -40,8 +40,33 @@ include_once __DIR__.'/../../core.php';
{[ "type": "text", "label": "", "name": "filename", "required": 1, "value": "$filename$" ]}
+ + + +
+ +
+ {[ "type": "select", "label": "", "name": "module", "required": 1, "values": "query=SELECT id, name AS descrizione FROM zz_modules WHERE ( enabled = 1 AND options != 'custom' ) OR id = ORDER BY name ASC", "value": "", "disabled": "1" ]} +
+ +
+ {[ "type": "checkbox", "label": "", "name": "enabled", "value": "$enabled$", "disabled": "1" ]} +
+ +
+ {[ "type": "number", "label": "", "name": "order", "required": 0, "value": "$order$", "decimals":0 ]} +
+ +
+ {[ "type": "checkbox", "label": "", "name": "predefined", "value": "$predefined$", "disabled": "" ]} +
+ + + +
+
diff --git a/update/2_4_23.sql b/update/2_4_23.sql index a29d25262..d9c089a8c 100644 --- a/update/2_4_23.sql +++ b/update/2_4_23.sql @@ -199,4 +199,9 @@ UPDATE `zz_settings` SET `valore` = IF(`valore` ='', (SELECT `id` FROM `co_iva` UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM `co_documenti`\nLEFT JOIN `an_anagrafiche` ON `co_documenti`.`idanagrafica` = `an_anagrafiche`.`idanagrafica`\nLEFT JOIN `co_tipidocumento` ON `co_documenti`.`idtipodocumento` = `co_tipidocumento`.`id`\nLEFT JOIN `co_statidocumento` ON `co_documenti`.`idstatodocumento` = `co_statidocumento`.`id`\nLEFT JOIN (\n SELECT `iddocumento`,\n SUM(`subtotale` - `sconto`) AS `totale_imponibile`,\n SUM(`subtotale` - `sconto` + `iva`) AS `totale`\n FROM `co_righe_documenti`\n GROUP BY `iddocumento`\n) AS righe ON `co_documenti`.`id` = `righe`.`iddocumento`\nLEFT JOIN (\n SELECT COUNT(`d`.`id`) AS `conteggio`,\n IF(`d`.`numero_esterno`=\'\', `d`.`numero`, `d`.`numero_esterno`) AS `numero_documento`,\n `d`.`idanagrafica` AS `anagrafica`\n FROM `co_documenti` AS `d`\n LEFT JOIN `co_tipidocumento` AS `d_tipo` ON `d`.`idtipodocumento` = `d_tipo`.`id`\n WHERE 1=1\n AND `d_tipo`.`dir` = \'uscita\'\n AND (\'|period_start|\' <= `d`.`data` AND \'|period_end|\' >= `d`.`data` OR \'|period_start|\' <= `d`.`data_competenza` AND \'|period_end|\' >= `d`.`data_competenza`)\n GROUP BY `numero_documento`, `d`.`idanagrafica`\n) AS `d` ON (`d`.`numero_documento` = IF(`co_documenti`.`numero_esterno`=\'\', `co_documenti`.`numero`, `co_documenti`.`numero_esterno`) AND `d`.`anagrafica`=`co_documenti`.`idanagrafica`)\nWHERE 1=1 AND `dir` = \'uscita\' |segment(`co_documenti`.`id_segment`)||date_period(custom, \'|period_start|\' <= `co_documenti`.`data` AND \'|period_end|\' >= `co_documenti`.`data`, \'|period_start|\' <= `co_documenti`.`data_competenza` AND \'|period_end|\' >= `co_documenti`.`data_competenza` )|\nHAVING 2=2\nORDER BY `co_documenti`.`data` DESC, CAST(IF(`co_documenti`.`numero` = \'\', `co_documenti`.`numero_esterno`, `co_documenti`.`numero`) AS UNSIGNED) DESC' WHERE `zz_modules`.`name` = 'Fatture di acquisto'; -- Ripristino Fattura di vendita come stampa predefinita -UPDATE `zz_prints` SET `predefined` = '0' WHERE `zz_prints`.`name` = 'Fattura elettronica di vendita'; \ No newline at end of file +UPDATE `zz_prints` SET `predefined` = '0' WHERE `zz_prints`.`name` = 'Fattura elettronica di vendita'; + +INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `default`, `visible`) VALUES +((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stampe'), 'Modulo', '(SELECT name FROM zz_modules WHERE zz_modules.id= zz_prints.id_module)', 4, 1, 0, 0, 1), +((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stampe'), 'Predefinita', 'zz_prints.predefined', 5, 1, 0, 0, 1), +((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stampe'), 'Ordine', 'zz_prints.order', 6, 1, 0, 0, 1); \ No newline at end of file