diff --git a/actions.php b/actions.php index 3cc77d122..1a80f06ce 100644 --- a/actions.php +++ b/actions.php @@ -244,7 +244,7 @@ if (Modules::getPermission($permesso) == 'rw') { // Esecuzione delle operazioni di gruppo $id_records = post('id_records'); - $id_records = is_array($id_records) ? $id_records : explode(',', $id_records); + $id_records = is_array($id_records) ? $id_records : explode(';', $id_records); $id_records = array_filter($id_records, function ($var) {return !empty($var); }); $id_records = array_unique($id_records); diff --git a/lib/functions.js b/lib/functions.js index 6c58b6e11..5bb86ad6f 100644 --- a/lib/functions.js +++ b/lib/functions.js @@ -622,7 +622,7 @@ function start_datatables() { }); }, rowCallback: function (row, data, index) { - if ($(data[0]).data('id') && $.inArray($(data[0]).data('id'), $this.data('selected').split(',')) !== -1) { + if ($(data[0]).data('id') && $.inArray($(data[0]).data('id'), $this.data('selected').split(';')) !== -1) { table.row(index).select(); } }, @@ -698,7 +698,7 @@ function start_datatables() { table.on('select deselect', function (e, dt, type, indexes) { if (type === 'row') { - var selected = $this.data('selected').split(','); + var selected = $this.data('selected').split(';'); var data = table.rows(indexes).data(); @@ -721,7 +721,7 @@ function start_datatables() { return entry != ''; }); - $this.data('selected', selected.join(',')); + $this.data('selected', selected.join(';')); var container = $(document).find('[data-target=' + $this.attr('id') + ']'); diff --git a/modules/fatture/bulk.php b/modules/fatture/bulk.php index 827af3b15..bd52f3390 100644 --- a/modules/fatture/bulk.php +++ b/modules/fatture/bulk.php @@ -16,33 +16,35 @@ switch (post('op')) { // Selezione delle fatture da stampare $records = $dbo->fetchArray('SELECT co_documenti.id, numero_esterno, data, ragione_sociale, co_tipidocumento.descrizione FROM co_documenti INNER JOIN an_anagrafiche ON co_documenti.idanagrafica=an_anagrafiche.idanagrafica INNER JOIN co_tipidocumento ON co_documenti.idtipodocumento=co_tipidocumento.id WHERE co_documenti.id IN('.implode(',', $id_records).')'); - foreach ($records as $r) { - $numero = !empty($r['numero_esterno']) ? $r['numero_esterno'] : $r['numero']; - $numero = str_replace(['/', '\\'], '-', $numero); + if (!empty($records)) { + foreach ($records 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); + // Gestione della stampa + $rapportino_nome = sanitizeFilename($numero.' '.$r['data'].' '.$r['ragione_sociale'].'.pdf'); + $filename = slashes($dir.'tmp/'.$rapportino_nome); - $_GET['iddocumento'] = $r['id']; // Fix temporaneo per la stampa - $iddocumento = $r['id']; // Fix temporaneo per la stampa - $ptype = ($r['descrizione'] == 'Fattura accompagnatoria di vendita') ? 'fatture_accompagnatorie' : 'fatture'; + $_GET['iddocumento'] = $r['id']; // Fix temporaneo per la stampa + $iddocumento = $r['id']; // Fix temporaneo per la stampa + $ptype = ($r['descrizione'] == 'Fattura accompagnatoria di vendita') ? 'fatture_accompagnatorie' : 'fatture'; - require DOCROOT.'/pdfgen.php'; - } + require DOCROOT.'/pdfgen.php'; + } - $dir = slashes($dir); - $file = slashes($dir.'fatture_'.time().'.zip'); + $dir = slashes($dir); + $file = slashes($dir.'fatture_'.time().'.zip'); - // Creazione zip - if (extension_loaded('zip')) { - create_zip($dir.'tmp/', $file); + // Creazione zip + if (extension_loaded('zip')) { + create_zip($dir.'tmp/', $file); - // Invio al browser dello zip - download($file); + // Invio al browser dello zip + download($file); - // Rimozione dei contenuti - delete($dir.'tmp/'); + // Rimozione dei contenuti + delete($dir.'tmp/'); + } } break;