From 6a75dc1c3ddda3e78d77bc95ebdd72dbe5d858b1 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 28 Feb 2017 11:33:11 +0100 Subject: [PATCH] ActionBar: Verwendung beim Massendruck von Lieferscheinen --- bin/mozilla/do.pl | 21 +++++++++++--- js/kivi.MassDeliveryOrderPrint.js | 23 ++------------- js/kivi.SalesPurchase.js | 6 +++- js/locale/de.js | 1 - locale/de/all | 3 -- templates/webpages/do/orders_bottom.html | 28 +++++++++---------- templates/webpages/do/orders_top.html | 2 +- templates/webpages/generic/print_options.html | 5 ++++ 8 files changed, 44 insertions(+), 45 deletions(-) diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 07988dbb2..e4aa85d86 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -376,10 +376,15 @@ sub setup_do_orders_action_bar { $bar->add( action => [ t8('New invoice'), - submit => [ '#orders_form' ], - checks => [ [ 'kivi.check_if_entries_selected', '#orders_form tbody input[type=checkbox]' ] ], + submit => [ '#form', { action => 'invoice_multi' } ], + checks => [ [ 'kivi.check_if_entries_selected', '#form tbody input[type=checkbox]' ] ], accesskey => 'enter', ], + action => [ + t8('Print'), + call => [ 'kivi.SalesPurchase.show_print_dialog', 'js:kivi.MassDeliveryOrderPrint.submitMultiOrders' ], + checks => [ [ 'kivi.check_if_entries_selected', '#form tbody input[type=checkbox]' ] ], + ], ); } } @@ -659,7 +664,7 @@ sub orders { my $locale = $main::locale; my $cgi = $::request->{cgi}; - $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.MassDeliveryOrderPrint)); + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.MassDeliveryOrderPrint kivi.SalesPurchase)); ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) = split(/--/, $form->{ $form->{vc} }); report_generator_set_default_sort('transdate', 1); @@ -801,9 +806,17 @@ sub orders { $form->{printer_id} = $pr->id; } + my $print_options = SL::Helper::PrintOptions->get_print_options( + options => { + hide_language_id => 1, + show_bothsided => 1, + show_headers => 1, + }, + ); + $report->set_options('top_info_text' => join("\n", @options), 'raw_top_info_text' => $form->parse_html_template('do/orders_top'), - 'raw_bottom_info_text' => $form->parse_html_template('do/orders_bottom', { print_options => print_options(inline => 1,hide_language_id => 1) }), + 'raw_bottom_info_text' => $form->parse_html_template('do/orders_bottom', { print_options => $print_options }), 'output_format' => 'HTML', 'title' => $form->{title}, 'attachment_basename' => $attachment_basename . strftime('_%Y%m%d', localtime time), diff --git a/js/kivi.MassDeliveryOrderPrint.js b/js/kivi.MassDeliveryOrderPrint.js index 426b4c116..e0b538761 100644 --- a/js/kivi.MassDeliveryOrderPrint.js +++ b/js/kivi.MassDeliveryOrderPrint.js @@ -1,5 +1,6 @@ namespace('kivi.MassDeliveryOrderPrint', function(ns) { - + "use strict"; + ns.massConversionFinishProcess = function() { $('#mass_print_dialog').dialog('close'); }; @@ -30,24 +31,6 @@ namespace('kivi.MassDeliveryOrderPrint', function(ns) { }; ns.submitMultiOrders = function () { - $("#old_table_id").remove(); - var checkboxes = $('input[type=checkbox]').filter(function () { return $(this).prop('checked'); }); - if (checkboxes.size() == 0) { - alert(kivi.t8("No delievery orders selected, please set one checkbox!")); - return false; - } - - var tmpform = $("#report_table_id").clone(); - tmpform.hide(); - tmpform.attr('id',"old_table_id"); - tmpform.appendTo("#print_multi_id"); - return kivi.submit_ajax_form('controller.pl?action=MassDeliveryOrderPrint/mass_mdo_print',$('#print_multi_id')); - }; - - ns.setup = function() { - $('#multi_all').checkall("input[name^='multi_id']"); - $('#print_multi_button').click(kivi.MassDeliveryOrderPrint.submitMultiOrders); + return kivi.submit_ajax_form('controller.pl?action=MassDeliveryOrderPrint/mass_mdo_print', $('#form')); }; }); - -$(kivi.MassDeliveryOrderPrint.setup); diff --git a/js/kivi.SalesPurchase.js b/js/kivi.SalesPurchase.js index c19c10a68..2fcd2132e 100644 --- a/js/kivi.SalesPurchase.js +++ b/js/kivi.SalesPurchase.js @@ -311,7 +311,11 @@ namespace('kivi.SalesPurchase', function(ns) { this.print_record = function() { $('#print_dialog').dialog('close'); - kivi.submit_form_with_action('#form', $('#form').data('print-action')); + var action = $('#form').data('print-action'); + if (action.match("^js:")) + return kivi.run(action.substring(3)); + + kivi.submit_form_with_action('#form', action); }; this.show_print_dialog = function(print_action) { diff --git a/js/locale/de.js b/js/locale/de.js index 2bdd17e3f..2fffd6fbf 100644 --- a/js/locale/de.js +++ b/js/locale/de.js @@ -69,7 +69,6 @@ namespace("kivi").setupLocale({ "More than one file selected, please set only one checkbox!":"Mehr als ein Element selektiert, bitte nur eine Box anklicken", "No":"Nein", "No article has been selected yet.":"Es wurde noch kein Artikel ausgewählt.", -"No delievery orders selected, please set one checkbox!":"Kein Lieferschein selektiert, bitte eine Box anklicken!", "No delivery orders have been selected.":"Es wurden keine Lieferscheine ausgewählt.", "No entries have been selected.":"Es wurden keine Einträge ausgewählt.", "No file selected, please set one checkbox!":"Kein Element selektiert,bitte eine Box anklicken", diff --git a/locale/de/all b/locale/de/all index 694ee9e5b..9bf27212d 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1857,7 +1857,6 @@ $self->{texts} = { 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.', 'No data was found.' => 'Es wurden keine Daten gefunden.', 'No default currency' => 'Keine Standardwährung', - 'No delievery orders selected, please set one checkbox!' => 'Kein Lieferschein selektiert, bitte eine Box anklicken!', 'No delivery orders have been selected.' => 'Es wurden keine Lieferscheine ausgewählt.', 'No delivery term has been created yet.' => 'Es wurden noch keine Lieferbedingungen angelegt', 'No dunnings have been selected for printing.' => 'Es wurden keine Mahnungen zum Drucken ausgewählt.', @@ -2218,8 +2217,6 @@ $self->{texts} = { 'Print list' => 'Liste ausdrucken', 'Print options' => 'Druckoptionen', 'Print record' => 'Beleg drucken', - 'Print selected' => 'Drucken', - 'Print selected delivery orders both sided' => 'Ausgewählte Lieferscheine (ggf beidseitig)', 'Print template base file name' => 'Druckvorlagen-Basisdateiname', 'Print templates' => 'Druckvorlagen', 'Print templates to use' => 'Zu verwendende Druckvorlagen', diff --git a/templates/webpages/do/orders_bottom.html b/templates/webpages/do/orders_bottom.html index be524f84e..e51ac704b 100644 --- a/templates/webpages/do/orders_bottom.html +++ b/templates/webpages/do/orders_bottom.html @@ -1,17 +1,15 @@ -[% USE HTML %][%- USE T8 -%] - - - - - +[% USE HTML %][%- USE T8 -%][%- USE LxERP -%][%- USE P -%] + [% P.hidden_tag("type", type) %] + [% P.hidden_tag("vc", vc) %] + [% P.hidden_tag("rowcount", rowcount) %] + [% P.hidden_tag("callback", callback) %] + + - diff --git a/templates/webpages/do/orders_top.html b/templates/webpages/do/orders_top.html index d197c97d1..181f25a2c 100644 --- a/templates/webpages/do/orders_top.html +++ b/templates/webpages/do/orders_top.html @@ -1,2 +1,2 @@ [%- INCLUDE 'common/flash.html' %] -
+ diff --git a/templates/webpages/generic/print_options.html b/templates/webpages/generic/print_options.html index 5f1fd2c46..be8343f11 100644 --- a/templates/webpages/generic/print_options.html +++ b/templates/webpages/generic/print_options.html @@ -46,6 +46,11 @@ [%- END %] + [%- IF display_bothsided %] + [%- IF !show_headers %][% 'Both-sided' | $T8 %][%- END %] + + + [%- END %] [%- IF display_remove_draft %] [%- IF !show_headers %][% 'Remove Draft' | $T8 %][%- END %] -- 2.20.1