From 00402ae67e8b4edf686585752a2193da8ecfc169 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Wed, 9 May 2018 14:36:31 +0200 Subject: [PATCH] Auftrags-Controller: Formelberechnung Sollte evtl. auf Dialog umgestellt werden. --- SL/Controller/Order.pm | 2 +- bin/mozilla/io.pl | 2 +- js/kivi.Order.js | 9 +++++++++ templates/webpages/order/tabs/_row.html | 6 +++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 864cc674f..845115cc2 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -1435,7 +1435,7 @@ sub _pre_render { } } @all_objects; } - $::request->{layout}->use_javascript("${_}.js") for qw(kivi.SalesPurchase kivi.Order kivi.File ckeditor/ckeditor ckeditor/adapters/jquery edit_periodic_invoices_config); + $::request->{layout}->use_javascript("${_}.js") for qw(kivi.SalesPurchase kivi.Order kivi.File ckeditor/ckeditor ckeditor/adapters/jquery edit_periodic_invoices_config calculate_qty); $self->_setup_edit_action_bar; } diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index fa6300482..d376d4c5f 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -319,7 +319,7 @@ sub display_row { my $qty_dec = ($form->{"qty_$i"} =~ /\.(\d+)/) ? length $1 : 2; $column_data{qty} = $cgi->textfield(-name => "qty_$i", -size => 5, -class => "numeric", -value => $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec)); - $column_data{qty} .= $cgi->button(-onclick => "calculate_qty_selection_window('qty_$i', '', 'formel_$i')", -value => $locale->text('*/')) + $column_data{qty} .= $cgi->button(-onclick => "calculate_qty_selection_window('qty_$i', '', 'formel_$i', '')", -value => $locale->text('*/')) . $cgi->hidden(-name => "formel_$i", -value => $form->{"formel_$i"}) if $form->{"formel_$i"}; diff --git a/js/kivi.Order.js b/js/kivi.Order.js index 441a3dcce..b6a9642e5 100644 --- a/js/kivi.Order.js +++ b/js/kivi.Order.js @@ -623,6 +623,15 @@ namespace('kivi.Order', function(ns) { return true; }; + ns.show_calculate_qty_dialog = function(clicked) { + var row = $(clicked).parents("tbody").first(); + var input_id = $(row).find('[name="order.orderitems[].qty_as_number"]').attr('id'); + var formula_id = $(row).find('[name="formula"]').attr('id'); + + calculate_qty_selection_window("", input_id, "", formula_id); + return true; + } + }); $(function(){ diff --git a/templates/webpages/order/tabs/_row.html b/templates/webpages/order/tabs/_row.html index 0de680ff0..f95560407 100644 --- a/templates/webpages/order/tabs/_row.html +++ b/templates/webpages/order/tabs/_row.html @@ -48,11 +48,15 @@ [%- END -%] [%- L.button_tag("kivi.Order.show_longdescription_dialog(this)", LxERP.t8("L")) %] - + [%- L.input_tag("order.orderitems[].qty_as_number", ITEM.qty_as_number, size = 5, class="recalc reformat_number numeric") %] + [%- IF ITEM.part.formel -%] + [%- L.button_tag("kivi.Order.show_calculate_qty_dialog(this)", LxERP.t8("*/")) %] + [%- L.hidden_tag("formula", ITEM.part.formel) -%] + [%- END -%] [%- L.select_tag("order.orderitems[].price_factor_id", -- 2.20.1