diff --git a/api/index.php b/api/index.php index 3f1ab6338..c7db985e5 100644 --- a/api/index.php +++ b/api/index.php @@ -9,9 +9,6 @@ function serverError() } } -// Impostazioni di Content-Type e Charset Header -header('Content-Type: application/json; charset=UTF-8'); - // Gestione degli errori set_error_handler('serverError'); register_shutdown_function('serverError'); @@ -70,5 +67,14 @@ try { $result = API::error('serverError'); } +json_decode($result); + +// Impostazioni di Content-Type e Charset Header +if (json_last_error() == JSON_ERROR_NONE) { + header('Content-Type: application/json; charset=UTF-8'); +} else { + header('Content-Type: text/plain; charset=UTF-8'); +} + // Stampa dei risultati echo $result; diff --git a/modules/ddt/bulk.php b/modules/ddt/bulk.php index b4427b54c..bf637cdf4 100644 --- a/modules/ddt/bulk.php +++ b/modules/ddt/bulk.php @@ -165,16 +165,6 @@ switch (post('op')) { return [ 'delete-bulk' => tr('Elimina selezionati'), - 'export-bulk' => [ - 'text' => tr('Esporta stampe'), - 'data' => [ - 'msg' => tr('Vuoi davvero esportare tutte le stampe in un archivio?'), - 'button' => tr('Procedi'), - 'class' => 'btn btn-lg btn-warning', - 'blank' => true, - ], - ], - 'creafatturavendita' => [ 'text' => tr('Crea fattura'), 'data' => [ diff --git a/modules/fatture/bulk.php b/modules/fatture/bulk.php index 37efcf0d8..f35e609c4 100644 --- a/modules/fatture/bulk.php +++ b/modules/fatture/bulk.php @@ -25,12 +25,9 @@ switch (post('op')) { $rapportino_nome = sanitizeFilename($numero.' '.$r['data'].' '.$r['ragione_sociale'].'.pdf'); $filename = slashes($dir.'tmp/'.$rapportino_nome); - $ptype = 'fatture'; + $print = Prints::getModuleMainPrint($id_module); - $print = $dbo->fetchArray('SELECT id, previous FROM zz_prints WHERE directory = '.prepare($ptype).' ORDER BY main DESC LIMIT 1'); - $id_print = $print[0]['id']; - - Prints::render($id_print, $r['id'], $filename); + Prints::render($print['id'], $r['id'], $filename); } $dir = slashes($dir); diff --git a/modules/interventi/bulk.php b/modules/interventi/bulk.php index 82fb0dcca..2b3727ee8 100644 --- a/modules/interventi/bulk.php +++ b/modules/interventi/bulk.php @@ -32,12 +32,9 @@ switch (post('op')) { $rapportino_nome = sanitizeFilename($numero.' '.date('Y_m_d', strtotime($r['data_richiesta'])).' '.$r['ragione_sociale'].'.pdf'); $filename = slashes($dir.'tmp/'.$rapportino_nome); - $ptype = 'interventi'; + $print = Prints::getModuleMainPrint($id_module); - $print = $dbo->fetchArray('SELECT id, previous FROM zz_prints WHERE directory = '.prepare($ptype).' ORDER BY main DESC LIMIT 1'); - $id_print = $print[0]['id']; - - Prints::render($id_print, $r['id'], $filename); + Prints::render($print['id'], $r['id'], $filename); } $dir = slashes($dir);