Aggiunta possibilità di ordinare e impostare come predefinite le stampe del modulo

Aggiunte colonne modulo stampe
This commit is contained in:
Luca 2021-05-18 12:34:22 +02:00
parent 49e4357960
commit 51d03f02c9
3 changed files with 43 additions and 1 deletions

View File

@ -21,9 +21,21 @@ include_once __DIR__.'/../../core.php';
switch (post('op')) { switch (post('op')) {
case 'update': 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->title = post('title');
$print->filename = post('filename'); $print->filename = post('filename');
$print->options = post('options'); $print->options = post('options');
//$print->id_module = post('module');
//$print->enabled = post('enabled');
$print->order = post('order');
$print->predefined = post('predefined');
$print->save(); $print->save();
flash()->info(tr('Modifiche salvate correttamente')); flash()->info(tr('Modifiche salvate correttamente'));

View File

@ -40,6 +40,31 @@ include_once __DIR__.'/../../core.php';
<div class="col-md-6"> <div class="col-md-6">
{[ "type": "text", "label": "<?php echo tr('Nome del file'); ?>", "name": "filename", "required": 1, "value": "$filename$" ]} {[ "type": "text", "label": "<?php echo tr('Nome del file'); ?>", "name": "filename", "required": 1, "value": "$filename$" ]}
</div> </div>
</div>
<div class="row">
<div class="col-md-3">
{[ "type": "select", "label": "<?php echo tr('Modulo'); ?>", "name": "module", "required": 1, "values": "query=SELECT id, name AS descrizione FROM zz_modules WHERE ( enabled = 1 AND options != 'custom' ) OR id = <?php echo $record['id_module']; ?> ORDER BY name ASC", "value": "<?php echo $record['id_module']; ?>", "disabled": "1" ]}
</div>
<div class="col-md-3">
{[ "type": "checkbox", "label": "<?php echo tr('Attiva'); ?>", "name": "enabled", "value": "$enabled$", "disabled": "1" ]}
</div>
<div class="col-md-3">
{[ "type": "number", "label": "<?php echo tr('Ordine'); ?>", "name": "order", "required": 0, "value": "$order$", "decimals":0 ]}
</div>
<div class="col-md-3">
{[ "type": "checkbox", "label": "<?php echo tr('Predefinito'); ?>", "name": "predefined", "value": "$predefined$", "disabled": "<?php echo intval($record['predefined']); ?>" ]}
</div>
</div> </div>
<div class="row"> <div class="row">

View File

@ -200,3 +200,8 @@ UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM `co_documenti`\nLEFT J
-- Ripristino Fattura di vendita come stampa predefinita -- Ripristino Fattura di vendita come stampa predefinita
UPDATE `zz_prints` SET `predefined` = '0' WHERE `zz_prints`.`name` = 'Fattura elettronica di vendita'; 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);