X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=js%2Fkivi.MassInvoiceCreatePrint.js;h=4a9ba9fe133d5618b8688bad20ccf5f7acbc01ee;hb=abafb475d9742e3a6c28427477235c923b21eeef;hp=61355191b15a2e23b66e9693d3fdbe4dfafa09bc;hpb=01074b6e7a113d0488a3edcc123f89a4908e75ea;p=kivitendo-erp.git diff --git a/js/kivi.MassInvoiceCreatePrint.js b/js/kivi.MassInvoiceCreatePrint.js index 61355191b..4a9ba9fe1 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; @@ -19,15 +20,6 @@ namespace('kivi.MassInvoiceCreatePrint', function(ns) { return false; }; - this.submitMassCreationForm = function() { - if (!kivi.MassInvoiceCreatePrint.checkDeliveryOrderSelection()) - return false; - - $('body').addClass('loading'); - $('form').submit(); - return false; - }; - this.createPrintAllInitialize = function() { kivi.popup_dialog({ id: 'create_print_all_dialog', @@ -45,6 +37,7 @@ namespace('kivi.MassInvoiceCreatePrint', function(ns) { var data = { action: 'MassInvoiceCreatePrint/create_print_all_start', number_of_invoices: $('#cpa_number_of_invoices').val(), + bothsided: $('#cpa_bothsided').val(), printer_id: $('#cpa_printer_id').val(), copy_printer_id: $('#cpa_copy_printer_id').val(), transdate: $('#transdate').val() @@ -74,11 +67,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; + }; + + ns.showMassPrintOptionsOrDownloadDirectly = function() { + if (!kivi.MassInvoiceCreatePrint.checkInvoiceSelection()) + return false; + + if ($('#print_options_printer_id').length === 0) + return kivi.MassInvoiceCreatePrint.massPrint(); + return kivi.MassInvoiceCreatePrint.showMassPrintOptions(); }; -}); -$(kivi.MassInvoiceCreatePrint.setup); + 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(""); + }; +});