1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-03-12 17:20:08 +01:00

Spostamento stampa riepilogo nelle azioni di gruppo

This commit is contained in:
MatteoPistorello 2022-03-07 17:36:41 +01:00
parent 1659d010c2
commit ea580daf48
6 changed files with 48 additions and 64 deletions

View File

@ -243,6 +243,16 @@ switch (post('op')) {
} }
flash()->info(tr('Interventi eliminati!')); flash()->info(tr('Interventi eliminati!'));
break;
case 'stampa-riepilogo':
$_SESSION['superselect']['interventi'] = $id_records;
$id_print = Prints::getPrints()['Riepilogo interventi'];
redirect(base_path().'/pdfgen.php?id_print='.$id_print.'&tipo='.post('tipo'));
exit();
break; break;
} }
@ -302,4 +312,15 @@ if (App::debug()) {
], ],
]; ];
$operations['stampa-riepilogo'] = [
'text' => '<span><i class="fa fa-print"></i> '.tr('Stampa riepilogo'),
'data' => [
'title' => tr('Stampare il riepilogo delle attività selezionate?'),
'msg' => '<br>{[ "type": "select", "label": "'.tr('Stampa riepilogo').'", "name": "tipo", "required": "1", "values": "list=\"cliente\": \"Clienti\", \"interno\": \"Interno\"", "value": "cliente" ]}',
'button' => tr('Stampa'),
'class' => 'btn btn-lg btn-warning',
'blank' => true,
],
];
return $operations; return $operations;

View File

@ -1,46 +0,0 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../../core.php';
// Trovo id_print della stampa
$id_print = $dbo->fetchOne('SELECT zz_prints.id FROM zz_prints INNER JOIN zz_modules ON zz_prints.id_module=zz_modules.id WHERE zz_modules.name="Interventi" AND zz_prints.name="Riepilogo interventi"')['id'];
echo '
<form action="'.base_path().'/pdfgen.php?id_print='.$id_print.'" method="post" target="_blank">
<div class="row">
<div class="col-md-4">
{[ "type": "select", "label": "'.tr('Stampa riepilogo').'", "name": "tipo", "required": "1", "values": "list=\"cliente\": \"'.tr('Clienti').'\", \"interno\": \"'.tr('Interno').'\"", "value": "cliente" ]}
</div>
<div class="col-md-offset-6 col-md-2">
<p style="line-height:14px;">&nbsp;</p>
<button type="submit" class="btn btn-primary btn-block">
<i class="fa fa-print"></i> '.tr('Stampa').'
</button>
</div>
</div>
</form>
<script>$(document).ready(init)</script>';

View File

@ -30,21 +30,16 @@ $total = Util\Query::readQuery($module);
// Lettura parametri modulo // Lettura parametri modulo
$module_query = $total['query']; $module_query = $total['query'];
$search_filters = []; $selected = [];
if (is_array($_SESSION['module_'.$id_module])) { if (is_array($_SESSION['superselect']['interventi'])) {
foreach ($_SESSION['module_'.$id_module] as $field => $value) { foreach ($_SESSION['superselect']['interventi'] as $value) {
if (!empty($value) && string_starts_with($field, 'search_')) { array_push($selected, '`id` = "'.$value.'"');
$field_name = str_replace('search_', '', $field);
$field_name = str_replace('__', ' ', $field_name);
$field_name = str_replace('-', ' ', $field_name);
array_push($search_filters, '`'.$field_name.'` LIKE "%'.$value.'%"');
}
} }
} }
if (!empty($search_filters)) { if (!empty($selected)) {
$module_query = str_replace('2=2', '2=2 AND ('.implode(' AND ', $search_filters).') ', $module_query); $module_query = str_replace('2=2', '2=2 AND ('.implode(' OR ', $selected).') ', $module_query);
} }
// Filtri derivanti dai permessi (eventuali) // Filtri derivanti dai permessi (eventuali)

View File

@ -19,11 +19,10 @@
include_once __DIR__.'/../../core.php'; include_once __DIR__.'/../../core.php';
//$tipo = post('tipo'); $tipo = get('tipo');
$tipo = post('tipo');
echo ' echo '
<h4><b>'.tr('Riepilogo interventi dal _START_ al _END_', [ <h4><b>'.tr('Riepilogo attività dal _START_ al _END_', [
'_START_' => Translator::dateToLocale($date_start), '_START_' => Translator::dateToLocale($date_start),
'_END_' => Translator::dateToLocale($date_end), '_END_' => Translator::dateToLocale($date_end),
], ['upper' => true]).'</b></h4> ], ['upper' => true]).'</b></h4>

12
update/2_4_31.php Normal file
View File

@ -0,0 +1,12 @@
<?php
// File e cartelle deprecate
$files = [
'modules/interventi/widgets/stampa_riepilogo.php',
];
foreach ($files as $key => $value) {
$files[$key] = realpath(base_dir().'/'.$value);
}
delete($files);

View File

@ -92,3 +92,6 @@ UPDATE `zz_settings` SET `tipo` = 'query=SELECT id, CONCAT(codice,\' - \',descri
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `html_format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `html_format`, `search_inside`, `order_by`, `visible`, `summable`, `default`) VALUES
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Listini'), 'Codice', '(SELECT codice_fornitore FROM mg_fornitore_articolo WHERE id_articolo=mg_prezzi_articoli.id_articolo AND id_fornitore=mg_prezzi_articoli.id_anagrafica AND deleted_at IS NULL)', 8, 1, 0, 0, 1, '', '', 0, 0, 1), ((SELECT `id` FROM `zz_modules` WHERE `name` = 'Listini'), 'Codice', '(SELECT codice_fornitore FROM mg_fornitore_articolo WHERE id_articolo=mg_prezzi_articoli.id_articolo AND id_fornitore=mg_prezzi_articoli.id_anagrafica AND deleted_at IS NULL)', 8, 1, 0, 0, 1, '', '', 0, 0, 1),
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Listini'), 'Barcode', '(SELECT barcode_fornitore FROM mg_fornitore_articolo WHERE id_articolo=mg_prezzi_articoli.id_articolo AND id_fornitore=mg_prezzi_articoli.id_anagrafica AND deleted_at IS NULL)', 9, 1, 0, 0, 1, '', '', 0, 0, 1); ((SELECT `id` FROM `zz_modules` WHERE `name` = 'Listini'), 'Barcode', '(SELECT barcode_fornitore FROM mg_fornitore_articolo WHERE id_articolo=mg_prezzi_articoli.id_articolo AND id_fornitore=mg_prezzi_articoli.id_anagrafica AND deleted_at IS NULL)', 9, 1, 0, 0, 1, '', '', 0, 0, 1);
-- Rimozione widget Stampa riepilogo
DELETE FROM `zz_widgets` WHERE `zz_widgets`.`name` = 'Stampa riepilogo';