From 5ee56934108b8681aaa50b4f13676c872e5a8ed0 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Thu, 3 Jan 2013 23:38:17 +0100 Subject: [PATCH] Bug 9346 - acqui/neworderempty.pl ignores exchange rates and destroys user data on page load MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This restores behaviour of new order form before Bug 5335 merge Test scenario: 1. load Receipt summary for existing customer 2. take note of Unit cost and Order cost 3. open existing order line and verify that Replacement cost, Budgeted cost and Total are not re-calculated on page load 4. change currency and verify that costs are updated (change currency to system default and all values should become same as vendor price) 5. change Quantity, get alert "You can't add a new item, please create a new order line" and verify that Total still reflects correct value Signed-off-by: Jonathan Druart Signed-off-by: Elliott Davis Signed-off-by: Jared Camins-Esakov --- acqui/neworderempty.pl | 3 --- koha-tmpl/intranet-tmpl/prog/en/js/acq.js | 5 +++-- .../intranet-tmpl/prog/en/modules/acqui/neworderempty.tt | 8 ++++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 90b4732c81..807a82b19b 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -336,8 +336,6 @@ my @gst_values = map { option => $_ }, split( '\|', C4::Context->preference("gist") ); -my $cur = GetCurrency(); - $template->param( existing => $biblionumber, ordernumber => $ordernumber, @@ -371,7 +369,6 @@ $template->param( cur_active_sym => $active_currency->{'symbol'}, cur_active => $active_currency->{'currency'}, loop_currencies => \@loop_currency, - currency_rate => $cur->{rate}, orderexists => ( $new eq 'yes' ) ? 0 : 1, title => $data->{'title'}, author => $data->{'author'}, diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js index d67b05b9ed..0c3ce911a8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js @@ -644,7 +644,8 @@ function updateCosts(){ var discount = new Number($("#discount").val()); var applygst = new Number ($("#applygst").val()); var listprice = new Number($("#listprice").val()); - var exchangerate = new Number($("#currency_rate").val()); + var currcode = new String($("#currency").val()); + var exchangerate = new Number($("#currency_rate_"+currcode).val()); var gst_on=false; var rrp = new Number(listprice*exchangerate); @@ -669,7 +670,7 @@ function calcNewsuggTotal(){ // var currency = f.currency.value; var currcode = new String(document.getElementById('currency').value); var price = new Number(document.getElementById('price').value); - var exchangerate = new Number(document.getElementById(currcode).value); + var exchangerate = new Number(document.getElementById('currency_rate_'+currcode).value); var total = new Number(quantity*price*exchangerate); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index 2631e3cf77..398a568a42 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -125,6 +125,7 @@ $(document).ready(function() alert(_("You can't add a new item, please create a new order line")); // and we replace the original value $(this).val([% quantityrec %]) + updateCosts(); // blur is invoked after change which updated values return false; } }); @@ -146,7 +147,7 @@ $(document).ready(function() //]]> - + [% INCLUDE 'header.inc' %] [% INCLUDE 'acquisitions-search.inc' %] @@ -230,7 +231,10 @@ $(document).ready(function() - + + [% FOREACH loop_currencie IN loop_currencies %] + + [% END %]
  1. [% IF ( biblionumber ) %] -- 2.39.5