diff --git a/lib/functions.js b/lib/functions.js index 65ea78715..e294034c1 100644 --- a/lib/functions.js +++ b/lib/functions.js @@ -536,7 +536,7 @@ function start_datatables() { var sum; var tempo; var tempo_attesa_ricerche = (globals.tempo_attesa_ricerche*1000); - + var table = $this.DataTable({ language: { url: globals.js + '/i18n/datatables/' + globals.locale + '.min.json' @@ -629,9 +629,9 @@ function start_datatables() { $('
') .appendTo(column.header()) .on('keyup', function (e) { - + clearInterval(tempo); - + if (e.which != 9) { if (!$(this).val()) { if ($(this).parent().data("slow") != undefined) $("#slow").remove(); @@ -648,13 +648,13 @@ function start_datatables() { idx1 = 'module_' + $this.data('idmodule'); //+ "-" + $this.data('idplugin'); idx2 = 'search_' + $(this).parent().attr('id').replace('th_', ''); - + function start_search(search_value){ session_set(idx1 + ',' + idx2, search_value, 0); column.search(search_value).draw(); } - // Imposto delle sessioni per le ricerche del modulo e del campo specificatsi + // Imposto delle sessioni per le ricerche del modulo e del campo specificatsi if(e.keyCode == 13 || $(this).val()==''){ start_search($(this).val()); }else{ @@ -662,7 +662,7 @@ function start_datatables() { } }); }); - + // Disabilito l'ordinamento alla pressione del tasto invio sull' $("thead input, .search").on('keypress', function (e) { stopTableSorting(e); @@ -769,6 +769,10 @@ function start_datatables() { if (type === 'row') { var selected = $this.data('selected').split(';'); + selected = selected.filter(function (value, index, self) { + return value != '' && self.indexOf(value) === index; + }) + var data = table.rows(indexes).data(); data.each(function (item) { @@ -779,6 +783,8 @@ function start_datatables() { selected.push(id); } else { var index = selected.indexOf("" + id); + console.log(selected); + console.log(id); if (index > -1) { delete selected[index]; } @@ -786,9 +792,9 @@ function start_datatables() { } }); - selected = selected.filter(function (entry) { - return entry != ''; - }); + selected = selected.filter(function (value, index, self) { + return value != '' && self.indexOf(value) === index; + }) $this.data('selected', selected.join(';')); @@ -1055,7 +1061,7 @@ function start_inputmask(element) { if (min == 'undefined') { min = false; } - + var max = $this.attr('max-value'); if (max == 'undefined') { max = false; @@ -1151,10 +1157,10 @@ function session_set(session_array, value, clear, reload) { } return $.get(globals.rootdir + "/ajax.php?op=session_set&session=" + session_array + "&value=" + value + "&clear=" + clear, function(data, status){ - + if (reload==1) - location.reload(); - + location.reload(); + }); } @@ -1354,7 +1360,7 @@ function getCookie(cname) { } /** - * Funzione per controllare se un file esiste + * Funzione per controllare se un file esiste */ function UrlExists(url) @@ -1363,4 +1369,4 @@ function UrlExists(url) http.open('HEAD', url, false); http.send(); return http.status!=404; -} \ No newline at end of file +} diff --git a/modules/fatture/bulk.php b/modules/fatture/bulk.php index 3165d3ef8..37efcf0d8 100644 --- a/modules/fatture/bulk.php +++ b/modules/fatture/bulk.php @@ -25,13 +25,12 @@ switch (post('op')) { $rapportino_nome = sanitizeFilename($numero.' '.$r['data'].' '.$r['ragione_sociale'].'.pdf'); $filename = slashes($dir.'tmp/'.$rapportino_nome); - $iddocumento = $r['id']; $ptype = 'fatture'; $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, $iddocumento, $filename); + Prints::render($id_print, $r['id'], $filename); } $dir = slashes($dir); diff --git a/modules/interventi/actions.php b/modules/interventi/actions.php index 5defcb0f6..c0c51b2f8 100644 --- a/modules/interventi/actions.php +++ b/modules/interventi/actions.php @@ -616,46 +616,5 @@ switch (post('op')) { ]); } - break; - - case 'sendemail': - $from_address = post('from_address'); - $from_name = post('from_name'); - - $destinatario = post('destinatario'); - $cc = get_var('Destinatario fisso in copia (campo CC)'); - - $oggetto = html_entity_decode(post('oggetto')); - $testo_email = post('body'); - $allegato = post('allegato'); - - $mail = new Mail(); - - $mail->AddReplyTo($from_address, $from_name); - $mail->SetFrom($from_address, $from_name); - - $mail->AddAddress($destinatario, ''); - - // se ho impostato la conferma di lettura - if (post('confermalettura') == 'on') { - $mail->ConfirmReadingTo = $from_address; - } - - $mail->Subject = $oggetto; - $mail->AddCC($cc); - - $mail->MsgHTML($testo_email); - - if (!empty($allegato)) { - $mail->AddAttachment($allegato); - } - - if (!$mail->send()) { - $_SESSION['errors'][] = tr("Errore durante l'invio dell'email").': '.$mail->ErrorInfo; - } else { - $dbo->query('UPDATE in_interventi SET data_invio=NOW() WHERE id='.prepare($id_record)); - $_SESSION['infos'][] = tr('Email inviata!'); - } - break; } diff --git a/modules/interventi/bulk.php b/modules/interventi/bulk.php index dbc4f4bf0..82fb0dcca 100644 --- a/modules/interventi/bulk.php +++ b/modules/interventi/bulk.php @@ -25,22 +25,19 @@ switch (post('op')) { if (!empty($records)) { foreach ($records as $r) { - //$numero = !empty($r['numero_esterno']) ? $r['numero_esterno'] : $r['numero']; $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); - $_GET['idintervento'] = $r['id']; // Fix temporaneo per la stampa - $idintervento = $r['id']; // Fix temporaneo per la stampa - //$ptype = ($r['descrizione'] == 'Fattura accompagnatoria di vendita') ? 'fatture_accompagnatorie' : 'fatture'; - $ptype = 'interventi'; - require DOCROOT.'/pdfgen.php'; + $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); } $dir = slashes($dir);