Introduzione modulo Stampe

This commit is contained in:
Thomas Zilio 2020-02-24 15:37:27 +01:00
parent 73d627a062
commit cd3349a97d
6 changed files with 78 additions and 8 deletions

View File

@ -22,7 +22,6 @@ if (!empty($id_record)) {
]);
Util\Query::setSegments(true);
}
$query = str_replace(['AND `deleted_at` IS NULL', '`deleted_at` IS NULL AND', '`deleted_at` IS NULL', 'AND deleted_at IS NULL', 'deleted_at IS NULL AND', 'deleted_at IS NULL'], '', $query);
$has_access = !empty($query) ? $dbo->fetchNum($query) !== 0 : true;
@ -150,9 +149,9 @@ if (empty($record) || !$has_access) {
</div>
</div>
</div>
<script>
$(document).ready(function(){
$(document).ready(function(){
$("#restore").click(function(){
$("input[name=op]").attr("value", "restore");
$("#submit").trigger("click");
@ -188,7 +187,7 @@ if (empty($record) || !$has_access) {
$("#save").click(function(){
//submitAjax(form);
$("#submit").trigger("click");
});';
@ -262,9 +261,9 @@ if (empty($record) || !$has_access) {
<script>
$(document).ready(function(){
cleanup_inputs();
var form = $("#module-edit").find("form").first();
// Campi a inizio form
form.prepend($("#custom_fields_top-edit").html());
@ -278,7 +277,7 @@ if (empty($record) || !$has_access) {
if (!last.length) {
last = form.find(".row").eq(-2);
}
last.after($("#custom_fields_bottom-edit").html());
restart_inputs();
});

15
modules/stampe/actions.php Executable file
View File

@ -0,0 +1,15 @@
<?php
include_once __DIR__.'/../../core.php';
switch (post('op')) {
case 'update':
$print->title = post('title');
$print->filename = post('filename');
$print->options = post('options');
$print->save();
flash()->info(tr('Modifiche salvate correttamente'));
break;
}

36
modules/stampe/edit.php Executable file
View File

@ -0,0 +1,36 @@
<?php
include_once __DIR__.'/../../core.php';
?><form action="" method="post" id="edit-form">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="update">
<input type="hidden" name="id_record" value="<?php echo $id_record; ?>">
<!-- DATI SEGMENTO -->
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title"><?php echo tr('Informazioni della stampa'); ?></h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-6">
{[ "type": "text", "label": "<?php echo tr('Titolo'); ?>", "name": "title", "required": 1, "value": "$title$" ]}
</div>
<div class="col-md-6">
{[ "type": "text", "label": "<?php echo tr('Nome del file'); ?>", "name": "filename", "required": 1, "value": "$filename$" ]}
</div>
</div>
<div class="row">
<div class="col-md-12">
{[ "type": "textarea", "label": "<?php echo tr('Opzioni'); ?>", "name": "options", "value": "$options$", "help": "<?php echo tr('Impostazioni personalizzabili della stampa, in formato JSON'); ?>" ]}
</div>
</div>
</div>
</div>
</form>

10
modules/stampe/init.php Executable file
View File

@ -0,0 +1,10 @@
<?php
include_once __DIR__.'/../../core.php';
use Models\PrintTemplate;
if (isset($id_record)) {
$print = PrintTemplate::find($id_record);
$record = $print->toArray();
}

View File

@ -433,6 +433,7 @@ class Prints
// Individuazione delle impostazioni finali
$settings = array_merge($default, (array) $custom);
$settings = array_merge($settings, (array) $options);
// Individuazione delle variabili fondamentali per la sostituzione dei contenuti
include self::filepath($id_print, 'init.php');

View File

@ -179,7 +179,16 @@ INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`
UPDATE `zz_widgets` SET `query` = 'SELECT CONCAT_WS(\" \", REPLACE(REPLACE(REPLACE(FORMAT(SUM(prezzo_acquisto*qta),2), \",\", \"#\"), \".\", \",\"), \"#\", \".\"), \"&euro;\") AS dato FROM mg_articoli WHERE qta>0 AND deleted_at IS NULL AND servizio=0 AND attivo=1' WHERE `zz_widgets`.`name` = 'Valore magazzino';
UPDATE `zz_widgets` SET `query` = 'SELECT CONCAT_WS(\" \", REPLACE(REPLACE(REPLACE(FORMAT(SUM(qta),2), \",\", \"#\"), \".\", \",\"), \"#\", \".\"), \"unit&agrave;\") AS dato FROM mg_articoli WHERE qta>0 AND deleted_at IS NULL AND servizio=0 AND attivo=1' WHERE `zz_widgets`.`name` = 'Articoli in magazzino';
-- Disattivazione totali prezzi articoli --
-- Disattivazione totali prezzi articoli
UPDATE `zz_views` SET `summable` = '0' WHERE `zz_views`.`id_module` = (SELECT `zz_modules`.`id` FROM `zz_modules` WHERE `zz_modules`.`name`='Articoli') AND `zz_views`.`name`='Prezzo di acquisto';
UPDATE `zz_views` SET `summable` = '0' WHERE `zz_views`.`id_module` = (SELECT `zz_modules`.`id` FROM `zz_modules` WHERE `zz_modules`.`name`='Articoli') AND `zz_views`.`name`='Prezzo di vendita';
UPDATE `zz_views` SET `summable` = '0' WHERE `zz_views`.`id_module` = (SELECT `zz_modules`.`id` FROM `zz_modules` WHERE `zz_modules`.`name`='Articoli') AND `zz_views`.`name`='Prezzo vendita ivato';
-- Introduzione modulo Stampe
INSERT INTO `zz_modules` (`id`, `name`, `title`, `directory`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`) VALUES (NULL, 'Stampe', 'Stampe', 'stampe', 'SELECT |select| FROM `zz_prints` WHERE 1=1 HAVING 2=2', '', 'fa fa-print', '2.4.14', '2.4.14', '1', (SELECT `id` FROM `zz_modules` t WHERE t.`name` = 'Strumenti'), '1', '1');
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `default`, `visible`) VALUES
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stampe'), 'Nome del file', 'filename', 3, 1, 0, 0, 1),
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stampe'), 'Titolo', 'title', 2, 1, 0, 0, 1),
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Stampe'), 'id', 'id', 1, 1, 0, 0, 0);