From 75ae1d7115cbcb0bf8e8ff20504eeb2b2778c840 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Tue, 5 Apr 2011 12:03:34 +0200 Subject: [PATCH] BZ5961: follow-up, save currency Cait noticed that currency was not saved properly in the aqorders table. note a surprise, as the 3.2 had no currency feature and 5961 had been written against 3.2 anyway, this patch fixes the problem --- acqui/addorderiso2709.pl | 36 +++++++++++++++++++- .../prog/en/modules/acqui/addorderiso2709.tmpl | 9 +++++ 2 files changed, 44 insertions(+), 1 deletions(-) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index a77b111..c46263a 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -87,8 +87,41 @@ if ($op eq ""){ # } elsif ($op eq "batch_details"){ #display lines inside the selected batch + # get currencies (for change rates calcs if needed) + my $active_currency = GetCurrency(); + my $default_currency; + if (! $data->{currency} ) { # New order no currency set + if ( $bookseller->{listprice} ) { + $default_currency = $bookseller->{listprice}; + } + else { + $default_currency = $active_currency->{currency}; + } + } + my @rates = GetCurrencies(); + + # ## @rates + + my @loop_currency = (); + for my $curr ( @rates ) { + my $selected; + if ($data->{currency} ) { + $selected = $curr->{currency} eq $data->{currency}; + } + else { + $selected = $curr->{currency} eq $default_currency; + } + push @loop_currency, { + currcode => $curr->{currency}, + rate => $curr->{rate}, + selected => $selected, + } + } + $template->param("batch_details" => 1, - "basketno" => $cgiparams->{'basketno'}); + "basketno" => $cgiparams->{'basketno'}, + loop_currencies => \@loop_currency, + ); import_biblios_list($template, $cgiparams->{'import_batch_id'}); if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber ) { # prepare empty item form @@ -166,6 +199,7 @@ if ($op eq ""){ "budget_id", $budget_id, "uncertainprice", 1, "sort1", $cgiparams->{'sort1'},"sort2", $cgiparams->{'sort2'}, "notes", $cgiparams->{'notes'}, "budget_id", $cgiparams->{'budget_id'}, + "currency",$cgiparams->{'currency'}, ); # get the price if there is one. # filter by storing only the 1st number diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl index 7365030..1bd65e4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl @@ -156,6 +156,14 @@ Budget: " /> +
  • + + +
  • +
  • +
  • -- 1.7.1