1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-16 11:30:55 +01:00

Aggiunto nome fisico delle stampe

Fix #606.
This commit is contained in:
Thomas Zilio 2019-07-10 11:53:35 +02:00
parent 95a6a8cd78
commit 4755eac00f
37 changed files with 165 additions and 150 deletions

View File

@ -201,6 +201,10 @@ function translateTemplate()
$template = ob_get_clean();
$template = str_replace('$id_module$', $id_module, $template);
$template = str_replace('$id_plugin$', $id_plugin, $template);
$template = str_replace('$id_record$', $id_record, $template);
$template = \HTMLBuilder\HTMLBuilder::replace($template);
$template = str_replace('$id_module$', $id_module, $template);

View File

@ -9,17 +9,8 @@ $smtp = Mail::get($template['id_smtp']);
$body = $template['body'];
$subject = $template['subject'];
$variables = Mail::getTemplateVariables($template['id'], $id_record);
$email = $variables['email'];
// Sostituzione delle variabili di base
$replaces = [];
foreach ($variables as $key => $value) {
$replaces['{'.$key.'}'] = $value;
}
$body = str_replace(array_keys($replaces), array_values($replaces), $body);
$subject = str_replace(array_keys($replaces), array_values($replaces), $subject);
$body = $module->replacePlaceholders($id_record, $template['body']);
$subject = $module->replacePlaceholders($id_record, $template['subject']);
// Campi mancanti
$campi_mancanti = [];

View File

@ -25,16 +25,9 @@ switch (post('op')) {
if (!empty($fatture)) {
foreach ($fatture as $r) {
$numero = !empty($r['numero_esterno']) ? $r['numero_esterno'] : $r['numero'];
$numero = str_replace(['/', '\\'], '-', $numero);
// Gestione della stampa
$rapportino_nome = sanitizeFilename($numero.' '.$r['data'].' '.$r['ragione_sociale'].'.pdf');
$filename = slashes($dir.'tmp/'.$rapportino_nome);
$print = Prints::getModulePredefinedPrint($id_module);
Prints::render($print['id'], $r['id'], $filename);
Prints::render($print['id'], $r['id'], $dir.'tmp/');
}
// Creazione zip

View File

@ -18,8 +18,7 @@ if (get('anteprima') !== null) {
}
// Gestione della stampa
$rapportino_nome = sanitizeFilename('Rapportino'.$rs[0]['codice'].'.pdf');
$filename = $docroot.'/files/interventi/'.$rapportino_nome;
$directory = $docroot.'/files/interventi/';
$id_print = setting('Stampa per anteprima e firma');
// HTML per la visualizzazione
@ -32,7 +31,7 @@ if (get('anteprima') !== null) {
<div class="clearfix"></div>
<iframe src="'.Prints::getPreviewLink($id_print, $id_record, $filename).'" frameborder="0" width="100%" height="550"></iframe>
<iframe src="'.Prints::getPreviewLink($id_print, $id_record, $directory).'" frameborder="0" width="100%" height="550"></iframe>
</div>';
}

View File

@ -36,16 +36,9 @@ switch (post('op')) {
if (!empty($interventi)) {
foreach ($interventi as $r) {
$numero = $r['codice'];
$numero = str_replace(['/', '\\'], '-', $numero);
// Gestione della stampa
$rapportino_nome = sanitizeFilename($numero.' '.date('Y_m_d', strtotime($r['data_richiesta'])).' '.$r['ragione_sociale'].'.pdf');
$filename = slashes($dir.'tmp/'.$rapportino_nome);
$print = Prints::getModulePredefinedPrint($id_module);
Prints::render($print['id'], $r['id'], $filename);
Prints::render($print['id'], $r['id'], $dir.'tmp/');
}
$dir = slashes($dir);

View File

@ -76,4 +76,7 @@ function open_movimento(id_movimento, id_module){
launch_modal("'.tr('Dettagli movimento').'", "'.$structure->fileurl('dettagli_movimento.php').'?id_movimento=" + id_movimento + "&id_module=" + id_module);
}
</script>';
} else {
echo '
<p>'.tr('Nessun movimento presente').'</p>';
}

View File

@ -2,7 +2,7 @@
include_once __DIR__.'/core.php';
$filename = !empty($filename) ? $filename : null;
$directory = !empty($directory) ? $directory : null;
$id_print = get('id_print');
// Retrocompatibilitaà
@ -14,4 +14,4 @@ if (!empty($ptype)) {
$id_record = !empty($id_record) ? $id_record : get($print[0]['previous']);
}
Prints::render($id_print, $id_record, $filename);
Prints::render($id_print, $id_record, $directory);

View File

@ -1197,23 +1197,22 @@ class FatturaElettronica
$data = $fattura->getUploadData();
$dir = static::getDirectory();
$rapportino_nome = sanitizeFilename($documento['numero_esterno'].'.pdf');
$filename = slashes(DOCROOT.'/'.$dir.'/'.$rapportino_nome);
Uploads::delete($rapportino_nome, $data);
$print = Prints::getModulePredefinedPrint($id_module);
Prints::render($print['id'], $documento['id'], $filename);
$info = Prints::render($print['id'], $documento['id'], DOCROOT.'/'.$dir);
Uploads::register(array_merge([
'name' => 'Stampa allegata',
'original' => $rapportino_nome,
], $data));
$name = 'Stampa allegata';
$is_presente = database()->fetchNum('SELECT id FROM zz_files WHERE id_module = '.prepare($id_module).' AND id_record = '.prepare($documento['id']).' AND name = '.prepare($name));
if(empty($is_presente)) {
Uploads::register(array_merge([
'name' => $name,
'original' => basename($info['path']),
], $data));
}
$attachments[] = [
'NomeAttachment' => 'Fattura',
'FormatoAttachment' => 'PDF',
'Attachment' => base64_encode(file_get_contents($filename)),
'Attachment' => base64_encode(file_get_contents($info['path'])),
];
return $attachments;

View File

@ -158,25 +158,6 @@ class Mail extends PHPMailer\PHPMailer\PHPMailer
return $templates[$template];
}
/**
* Restituisce le variabili relative a un singolo template specificato.
*
* @param string|int $template
*
* @return array
*/
public static function getTemplateVariables($template, $id_record)
{
$template = self::getTemplate($template);
$dbo = $database = database();
// Lettura delle variabili nei singoli moduli
$variables = include Modules::filepath($template['id_module'], 'variables.php');
return (array) $variables;
}
/**
* Restituisce le informazioni relative ai template di un singolo modulo specificato.
*

View File

@ -17,6 +17,8 @@ class Module extends Model
protected $main_folder = 'modules';
protected $upload_identifier = 'id_module';
protected $variables = [];
protected $appends = [
'permission',
'option',
@ -27,6 +29,33 @@ class Module extends Model
'options2',
];
public function replacePlaceholders($id_record, $value){
$replaces = $this->getPlaceholders($id_record);
$value = str_replace(array_keys($replaces), array_values($replaces), $value);
return $value;
}
public function getPlaceholders($id_record) {
if(!isset($variables[$id_record])) {
$dbo = $database = database();
// Lettura delle variabili nei singoli moduli
$variables = include $this->filepath('variables.php');
// Sostituzione delle variabili di base
$replaces = [];
foreach ($variables as $key => $value) {
$replaces['{' . $key . '}'] = $value;
}
$this->variables[$id_record] = $replaces;
}
return $this->variables[$id_record];
}
/**
* Restituisce i permessi relativi all'account in utilizzo.
*

View File

@ -6,6 +6,7 @@ use Mail;
use PHPMailer\PHPMailer\Exception as PHPMailerException;
use Prints;
use Uploads;
use Modules;
class EmailNotification extends Notification
{
@ -64,15 +65,10 @@ class EmailNotification extends Notification
$this->setAccount($template['id_smtp']);
if (!empty($id_record)) {
$variables = Mail::getTemplateVariables($template['id'], $id_record);
$module = Modules::get($template['id']);
// Sostituzione delle variabili di base
$replaces = [];
foreach ($variables as $key => $value) {
$replaces['{'.$key.'}'] = $value;
}
$body = replace($template['body'], $replaces);
$subject = replace($template['subject'], $replaces);
$body = $module->replacePlaceholders($id_record, $template['body']);
$subject = $module->replacePlaceholders($id_record, $template['subject']);
$this->setContent($body);
$this->setSubject($subject);
@ -165,11 +161,12 @@ class EmailNotification extends Notification
}
// Utilizzo di una cartella particolare per il salvataggio temporaneo degli allegati
$path = DOCROOT.'/files/notifications/'.$print['title'].' - '.$id_record.'.pdf';
$path = DOCROOT.'/files/notifications/';;
Prints::render($print['id'], $id_record, $path);
$info = Prints::render($print['id'], $id_record, $path);
$name = $name ?: $info['name'];
$this->addAttachment($path, $name);
$this->addAttachment($info['path'], $name);
$this->logs['prints'][] = $print['id'];
}

View File

@ -116,9 +116,9 @@ class Prints
*
* @param string|int $print
* @param int $id_record
* @param string $filename
* @param string $directory
*/
public static function render($print, $id_record, $filename = null)
public static function render($print, $id_record, $directory = null)
{
//ob_end_clean(); // Compatibilità con versioni vecchie delle stampe
@ -131,8 +131,7 @@ class Prints
}
// Individuazione della configurazione
$directory = dirname($filename);
if (!empty($filename) && !directory($directory)) {
if (!empty($directory) && !directory($directory)) {
$error = tr('Non hai i permessi per creare directory e files in _DIRECTORY_', [
'_DIRECTORY_' => $directory,
]);
@ -146,9 +145,9 @@ class Prints
}
if (self::isOldStandard($print)) {
self::oldLoader($infos['id'], $id_record, $filename);
return self::oldLoader($infos['id'], $id_record, $directory);
} else {
self::loader($infos['id'], $id_record, $filename);
return self::loader($infos['id'], $id_record, $directory);
}
}
@ -210,29 +209,27 @@ class Prints
*
* @param string|int $print
* @param int $id_record
* @param string $filename
* @param string $directory
*
* @return string
*/
public static function getPreviewLink($print, $id_record, $filename)
public static function getPreviewLink($print, $id_record, $directory)
{
self::render($print, $id_record, $filename);
$info = self::render($print, $id_record, $directory);
return self::getPDFLink($filename);
return self::getPDFLink($info['path']);
}
/**
* Restituisce il link per la visualizzazione del PDF.
*
* @param string|int $print
* @param int $id_record
* @param string $filename
* @param string $path
*
* @return string
*/
public static function getPDFLink($filename)
public static function getPDFLink($path)
{
return ROOTDIR.'/assets/dist/pdfjs/web/viewer.html?file=../../../../'.ltrim(str_replace(DOCROOT, '', $filename), '/');
return ROOTDIR.'/assets/dist/pdfjs/web/viewer.html?file=../../../../'.ltrim(str_replace(DOCROOT, '', $path), '/');
}
/**
@ -299,10 +296,10 @@ class Prints
*
* @param string|int $id_print
* @param int $id_record
* @param string $filename
* @param string $directory
* @param string $format
*/
protected static function oldLoader($id_print, $id_record, $filename = null, $format = 'A4')
protected static function oldLoader($id_print, $id_record, $directory = null, $format = 'A4')
{
$infos = self::get($id_print);
$options = self::readOptions($infos['options']);
@ -344,17 +341,44 @@ class Prints
// Operazioni di sostituzione
include DOCROOT.'/templates/replace.php';
$mode = !empty($filename) ? 'F' : 'I';
$mode = !empty($directory) ? 'F' : 'I';
$filename = !empty($filename) ? $filename : sanitizeFilename($report_name);
$title = basename($filename);
$file = self::getFile($infos, $id_record, $directory, $replaces);
$title = $file['name'];
$path = $file['path'];
$html2pdf = new Spipu\Html2Pdf\Html2Pdf($orientation, $format, 'it', true, 'UTF-8');
$html2pdf->writeHTML($report);
$html2pdf->pdf->setTitle($title);
$html2pdf->output($filename, $mode);
$html2pdf->output($path, $mode);
return $file;
}
protected static function getFile($record, $id_record, $directory, $original_replaces) {
$module = Modules::get($record['id_module']);
$name = $record['filename'].'.pdf';
$name = $module->replacePlaceholders($id_record, $name);
$replaces = [];
foreach ($original_replaces as $key=>$value){
$key = substr($key, 1, -1);
$replaces['{'.$key.'}'] = $value;
}
$name = replace($name, $replaces);
$filename = sanitizeFilename($name);
$file = rtrim($directory, '/').'/'.$filename;
return [
'name' => $name,
'path' => $file,
];
}
/**
@ -362,9 +386,9 @@ class Prints
*
* @param string|int $id_print
* @param int $id_record
* @param string $filename
* @param string $directory
*/
protected static function loader($id_print, $id_record, $filename = null)
protected static function loader($id_print, $id_record, $directory = null)
{
$infos = self::get($id_print);
$options = self::readOptions($infos['options']);
@ -400,14 +424,6 @@ class Prints
//'PDFAauto' => true,
]);
$mode = !empty($filename) ? 'F' : 'I';
$filename = !empty($filename) ? $filename : sanitizeFilename($report_name);
$title = basename($filename);
// Impostazione del titolo del PDF
$mpdf->SetTitle($title);
// Inclusione dei fogli di stile CSS
$styles = [
'templates/base/bootstrap.css',
@ -505,10 +521,21 @@ class Prints
// Operazioni di sostituzione
include DOCROOT.'/templates/replace.php';
$mode = !empty($directory) ? 'F' : 'I';
$file = self::getFile($infos, $id_record, $directory, $replaces);
$title = $file['name'];
$path = $file['path'];
// Impostazione del titolo del PDF
$mpdf->SetTitle($title);
// Aggiunta dei contenuti
$mpdf->WriteHTML($report);
// Creazione effettiva del PDF
$mpdf->Output($filename, $mode);
$mpdf->Output($path, $mode);
return $file;
}
}

View File

@ -2,8 +2,6 @@
include_once __DIR__.'/../../core.php';
$report_name = 'contratto_'.$records[0]['numero'].'.pdf';
$autofill = [
'count' => 0, // Conteggio delle righe
'words' => 70, // Numero di parolo dopo cui contare una riga nuova

View File

@ -2,8 +2,6 @@
include_once __DIR__.'/../../core.php';
$report_name = 'contratto_'.$records[0]['numero'].'_cons.pdf';
echo '
<div class="row">
<div class="col-xs-6">

View File

@ -62,7 +62,9 @@ if (isset($_SESSION['period']['week'])) {
$where = ' (in_interventi_tecnici.orario_inizio) <= '.prepare($maxdate).' AND (in_interventi_tecnici.orario_inizio) >= '.prepare($mindate).' AND ';
}
$report_name = sanitizeFilename('dashboard_'.$year.'_'.$month.'.pdf');
$custom = [
'periodo' => $month.'-'.$year,
];
//$date_start = $_SESSION['period_start'];
//$date_end = $_SESSION['period_end'];

View File

@ -2,8 +2,6 @@
include_once __DIR__.'/../../core.php';
$report_name = 'ddt_'.$numero.'.pdf';
$autofill = [
'count' => 0,
'words' => 70,

View File

@ -16,7 +16,7 @@ $default_header$
<tr>
<td valign="top" class="border-full text-center">
<p class="small-bold">'.tr('Nr. documento', [], ['upper' => true]).'</p>
<p>$numero_doc$</p>
<p>$numero$</p>
</td>
<td class="border-right border-bottom border-top text-center">

View File

@ -55,7 +55,7 @@ if (!empty($records[0]['idsede_destinazione'])) {
// Sostituzioni specifiche
$custom = [
'tipo_doc' => $tipo_doc,
'numero_doc' => $numero,
'numero' => $numero,
'data' => Translator::dateToLocale($records[0]['data']),
'pagamento' => $records[0]['tipo_pagamento'],
'c_destinazione' => $destinazione,

View File

@ -68,5 +68,3 @@ $body .= " <td class='table_cell text-right cell-padded'><b>".moneyFormat($total
$body .= "</tr>\n";
$body .= "</table>\n";
$report_name = 'fatturato.pdf';

View File

@ -2,8 +2,6 @@
include_once __DIR__.'/../../core.php';
$report_name = 'fattura_'.$numero.'.pdf';
$autofill = [
'count' => 0, // Conteggio delle righe
'words' => 70, // Numero di parole dopo cui contare una riga nuova

View File

@ -28,7 +28,7 @@ echo '
<tr>
<td valign="top" class="border-full text-center">
<p class="small-bold">'.tr('Nr. documento', [], ['upper' => true]).'</p>
<p>$numero_doc$</p>
<p>$numero$</p>
</td>
<td class="border-right border-bottom border-top text-center">

View File

@ -71,10 +71,11 @@ if (!empty($record['idsede_destinazione'])) {
$destinazione .= ' ('.$rsd[0]['provincia'].')';
}
}
// Sostituzioni specifiche
$custom = [
'tipo_doc' => Stringy\Stringy::create($tipo_doc)->toUpperCase(),
'numero_doc' => $numero,
'numero' => $numero,
'data' => Translator::dateToLocale($record['data']),
'pagamento' => $record['tipo_pagamento'],
'c_destinazione' => $destinazione,

View File

@ -2,8 +2,6 @@
include_once __DIR__.'/../../core.php';
$report_name = 'intervento_'.$records[0]['codice'].'.pdf';
/*
Dati intervento
*/

View File

@ -12,11 +12,3 @@ $costi_intervento = get_costi_intervento($id_record);
$id_cliente = $records[0]['idanagrafica'];
$id_sede = $records[0]['idsede'];
// Sostituzioni specifiche
// Imposta numerointervento-data-numerocommessa su intestazione
$custom = [
'intervento_numero' => $records[0]['codice'],
'intervento_data' => Translator::dateToLocale($records[0]['data_richiesta']),
'commessa_numero' => !empty($records[0]['numero_preventivo']) ? $records[0]['codice'] : '&nbsp;',
];

View File

@ -195,5 +195,3 @@ $body .= ' <br/>In data '.Translator::dateToLocale($data_intervento)." l'impiant
$body .= "</td></tr>\n";
$body .= "</table>\n\n\n";
$report_name = 'ordine_servizio_intervento_'.$idintervento.'.pdf';

View File

@ -93,5 +93,3 @@ $body .= "<td bgcolor='#dddddd' class='first_cell text-right cell-padded'></td>\
$body .= "<td bgcolor='#dddddd' class='table_cell text-right cell-padded'><b>".moneyFormat($totale_acquisto)."</b></td>\n";
$body .= "</tr>\n";
$body .= "</table>\n";
$report_name = 'inventario.pdf';

View File

@ -17,7 +17,6 @@ function findKey($array, $keySearch)
return false;
}
$report_name = 'ordine_'.$numero_ord.'.pdf';
$has_image = false;
// RIGHE ORDINE

View File

@ -16,7 +16,7 @@ $default_header$
<tr>
<td class="border-full text-center">
<p class="small-bold">'.tr('Nr. documento', [], ['upper' => true]).'</p>
<p>$numero_doc$</p>
<p>$numero$</p>
</td>
<td class="border-right border-bottom border-top text-center">

View File

@ -16,7 +16,7 @@ $numero = !empty($records[0]['numero_esterno']) ? $records[0]['numero_esterno']
// Sostituzioni specifiche
$custom = [
'tipo_doc' => Stringy\Stringy::create($records[0]['tipo_doc'])->toUpperCase(),
'numero_doc' => $numero,
'numero' => $numero,
'data' => Translator::dateToLocale($records[0]['data']),
'pagamento' => $records[0]['tipo_pagamento'],
];

View File

@ -320,5 +320,3 @@ elseif (get('lev') == '1') {
$body .= " </tbody>
</table>\n";
}
$report_name = 'mastrino.pdf';

View File

@ -2,8 +2,6 @@
include_once __DIR__.'/../../core.php';
$report_name = 'preventivo_'.$records[0]['numero'].'.pdf';
$autofill = [
'count' => 0, // Conteggio delle righe
'words' => 70, // Numero di parolo dopo cui contare una riga nuova

View File

@ -2,8 +2,6 @@
include_once __DIR__.'/../../core.php';
$report_name = 'preventivo_'.$records[0]['numero'].'_cons.pdf';
echo '
<div class="row">
<div class="col-xs-6">

View File

@ -8,7 +8,6 @@ $date_start = $_SESSION['period_start'];
$date_end = $_SESSION['period_end'];
$tipo = $dir == 'entrata' ? 'vendite' : 'acquisti';
$report_name = 'registro_iva_'.$tipo.'.pdf';
$v_iva = [];
$v_totale = [];
@ -29,3 +28,8 @@ WHERE dir = '.prepare($dir).' AND idstatodocumento NOT IN (SELECT id FROM co_sta
GROUP BY co_documenti.id, co_righe_documenti.idiva
ORDER BY co_documenti.id, co_documenti.'.(($dir == 'entrata') ? 'data' : 'numero');
$records = $dbo->fetchArray($query);
// Sostituzioni specifiche
$custom = [
'tipo' => $tipo,
];

View File

@ -396,5 +396,3 @@ if (sizeof($rs2) > 0) {
$body .= "<p align=\"right\">\n";
$body .= '<big><b>TOTALE INTERVENTI: '.moneyFormat($totale_intervento_scontato + $totale_articoli + $totale_spese)."</b></big>\n";
$body .= "</p>\n";
$report_name = 'riepilogo_interventi.pdf';

View File

@ -2,8 +2,6 @@
include_once __DIR__.'/../../core.php';
$report_name = 'Scadenzario_Totale.pdf';
$module_name = 'Scadenzario';
$date_start = $_SESSION['period_start'];
$date_end = $_SESSION['period_end'];

View File

@ -2,8 +2,6 @@
include_once __DIR__.'/../../core.php';
$report_name = 'spesometro.pdf';
$date_start = $_SESSION['period_start'];
$date_end = $_SESSION['period_end'];

View File

@ -222,3 +222,32 @@ ORDER BY `scadenza` ASC' WHERE `name` = 'Scadenzario';
-- Plugin Statistiche per Articoli
INSERT INTO `zz_plugins` (`id`, `name`, `title`, `idmodule_from`, `idmodule_to`, `position`, `script`, `enabled`, `default`, `order`, `compatibility`, `version`, `options2`, `options`, `directory`, `help`) VALUES (NULL, 'Statistiche', 'Statistiche', (SELECT `id` FROM `zz_modules` WHERE `name` = 'Articoli'), (SELECT `id` FROM `zz_modules` WHERE `name` = 'Articoli'), 'tab', '', 1, 0, 0, '', '', NULL, 'custom', 'statistiche_articoli', '');
-- Aggiunta nome file per le stampe
ALTER TABLE `zz_prints` ADD `filename` VARCHAR(255) NOT NULL AFTER `title`;
UPDATE `zz_prints` SET `filename` = 'Fattura num. {numero} del {data}' WHERE `name` = 'Fattura di vendita';
UPDATE `zz_prints` SET `filename` = 'Fatturato' WHERE `name` = 'Fatturato';
UPDATE `zz_prints` SET `filename` = 'DDT num. {numero} del {data}' WHERE `name` = 'Ddt di vendita (senza costi)';
UPDATE `zz_prints` SET `filename` = 'DDT num. {numero} del {data}' WHERE `name` = 'Ddt di vendita';
UPDATE `zz_prints` SET `filename` = 'Ordine fornitore num. {numero} del {data}' WHERE `name` = 'Ordine fornitore (senza costi)';
UPDATE `zz_prints` SET `filename` = 'Ordine cliente num. {numero} del {data}' WHERE `name` = 'Ordine cliente (senza costi)';
UPDATE `zz_prints` SET `filename` = 'Ordine fornitore num. {numero} del {data}' WHERE `name` = 'Ordine fornitore';
UPDATE `zz_prints` SET `filename` = 'Ordine cliente num. {numero} del {data}' WHERE `name` = 'Ordine cliente';
UPDATE `zz_prints` SET `filename` = 'Ordine cliente num. {numero} del {data}' WHERE `name` = 'Ordine cliente';
UPDATE `zz_prints` SET `filename` = 'Contratto num. {numero} del {data}' WHERE `name` = 'Contratto (senza costi)';
UPDATE `zz_prints` SET `filename` = 'Contratto num. {numero} del {data}' WHERE `name` = 'Contratto';
UPDATE `zz_prints` SET `filename` = 'Intervento num. {numero} del {data}' WHERE `name` = 'Intervento (senza costi)';
UPDATE `zz_prints` SET `filename` = 'Intervento num. {numero} del {data}' WHERE `name` = 'Intervento';
UPDATE `zz_prints` SET `filename` = 'Preventivo num. {numero} del {data}' WHERE `name` = 'Preventivo (senza costi)';
UPDATE `zz_prints` SET `filename` = 'Preventivo num. {numero} del {data}' WHERE `name` = 'Preventivo';
UPDATE `zz_prints` SET `filename` = 'Registro IVA {tipo}' WHERE `name` = 'Registro IVA';
UPDATE `zz_prints` SET `filename` = 'Scadenzario' WHERE `name` = 'Scadenzario';
UPDATE `zz_prints` SET `filename` = 'Spesometro' WHERE `name` = 'Spesometro';
UPDATE `zz_prints` SET `filename` = 'Mastrino' WHERE `name` = 'Mastrino';
UPDATE `zz_prints` SET `filename` = 'Inventario' WHERE `name` = 'Inventario magazzino';
UPDATE `zz_prints` SET `filename` = 'Riepilogo interventi' WHERE `name` = 'Riepilogo interventi';
UPDATE `zz_prints` SET `filename` = 'Consuntivo contratto num. {numero} del {data}' WHERE `name` = 'Consuntivo contratto (senza costi)';
UPDATE `zz_prints` SET `filename` = 'Consuntivo contratto num. {numero} del {data}' WHERE `name` = 'Consuntivo contratto';
UPDATE `zz_prints` SET `filename` = 'Consuntivo preventivo num. {numero} del {data}' WHERE `name` = 'Consuntivo preventivo (senza costi)';
UPDATE `zz_prints` SET `filename` = 'Consuntivo preventivo num. {numero} del {data}' WHERE `name` = 'Consuntivo preventivo';
UPDATE `zz_prints` SET `filename` = 'Stampa calendario {periodo}' WHERE `name` = 'Stampa calendario';