X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=js%2Fkivi.MassInvoiceCreatePrint.js;h=20ecde0752f69a7cc1676856a15bd458060a82ef;hb=dccb820ac74462367f37c2d7d4afab8b214a37ad;hp=bfb215e80239446ece238aa26e61623b5bd035d6;hpb=54ce51443886623bb785e7c54492ecbc8dc9b3aa;p=kivitendo-erp.git diff --git a/js/kivi.MassInvoiceCreatePrint.js b/js/kivi.MassInvoiceCreatePrint.js index bfb215e80..20ecde075 100644 --- a/js/kivi.MassInvoiceCreatePrint.js +++ b/js/kivi.MassInvoiceCreatePrint.js @@ -12,6 +12,7 @@ namespace('kivi.MassInvoiceCreatePrint', function(ns) { alert(kivi.t8('No delivery orders have been selected.')); return false; }; + this.checkInvoiceSelection = function() { if ($("[data-checkall=1]:checked").size() > 0) return true; @@ -24,7 +25,7 @@ namespace('kivi.MassInvoiceCreatePrint', function(ns) { return false; $('body').addClass('loading'); - $('form').submit(); + kivi.submit_form_with_action('form', 'MassInvoiceCreatePrint/create_invoices'); return false; }; @@ -75,11 +76,43 @@ namespace('kivi.MassInvoiceCreatePrint', function(ns) { $('.ui-dialog-titlebar button.ui-dialog-titlebar-close').prop('disabled', '') }; - this.setup = function() { - $('#create_button').click(kivi.MassInvoiceCreatePrint.submitMassCreationForm); - $('#create_print_all_button').click(kivi.MassInvoiceCreatePrint.createPrintAllInitialize); - $('#action_print').click(kivi.MassInvoiceCreatePrint.checkInvoiceSelection); + ns.showMassPrintOptions = function() { + $('#printer_options_printer_id').val($('#printer_id').val()); + + kivi.popup_dialog({ + id: 'print_options', + dialog: { + title: kivi.t8('Print options'), + width: 600, + height: 200 + } + }); + + return true; }; -}); -$(kivi.MassInvoiceCreatePrint.setup); + ns.showMassPrintOptionsOrDownloadDirectly = function() { + if (!kivi.MassInvoiceCreatePrint.checkInvoiceSelection()) + return false; + + if ($('#print_options_printer_id').length === 0) + return kivi.MassInvoiceCreatePrint.massPrint(); + return kivi.MassInvoiceCreatePrint.showMassPrintOptions(); + }; + + ns.massPrint = function() { + $('#print_options').dialog('close'); + + $('#printer_id').val($('#print_options_printer_id').val()); + $('#bothsided').val($('#print_options_bothsided').prop('checked') ? 1 : 0); + $('#action').val('MassInvoiceCreatePrint/print'); + + $('#report_form').submit(); + + return true; + }; + + this.resetSearchForm = function() { + $("#filter_table input").val(""); + }; +});