Lines 43-48
use C4::Branch; # GetBranches
Link Here
|
43 |
use C4::Members; |
43 |
use C4::Members; |
44 |
|
44 |
|
45 |
use Koha::Number::Price; |
45 |
use Koha::Number::Price; |
|
|
46 |
use Koha::Acquisition::Currencies; |
46 |
use Koha::Acquisition::Order; |
47 |
use Koha::Acquisition::Order; |
47 |
use Koha::Acquisition::Bookseller; |
48 |
use Koha::Acquisition::Bookseller; |
48 |
|
49 |
|
Lines 61-67
my $op = $cgiparams->{'op'} || '';
Link Here
|
61 |
my $booksellerid = $input->param('booksellerid'); |
62 |
my $booksellerid = $input->param('booksellerid'); |
62 |
my $allmatch = $input->param('allmatch'); |
63 |
my $allmatch = $input->param('allmatch'); |
63 |
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid }); |
64 |
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid }); |
64 |
my $data; |
|
|
65 |
|
65 |
|
66 |
$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl", |
66 |
$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl", |
67 |
booksellerid => $booksellerid, |
67 |
booksellerid => $booksellerid, |
Lines 90-128
if ($op eq ""){
Link Here
|
90 |
} elsif ($op eq "batch_details"){ |
90 |
} elsif ($op eq "batch_details"){ |
91 |
#display lines inside the selected batch |
91 |
#display lines inside the selected batch |
92 |
# get currencies (for change rates calcs if needed) |
92 |
# get currencies (for change rates calcs if needed) |
93 |
my $active_currency = GetCurrency(); |
93 |
my @currencies = Koha::Acquisition::Currencies->search; |
94 |
my $default_currency; |
|
|
95 |
if (! $data->{currency} ) { # New order no currency set |
96 |
if ( $bookseller->{listprice} ) { |
97 |
$default_currency = $bookseller->{listprice}; |
98 |
} |
99 |
else { |
100 |
$default_currency = $active_currency->{currency}; |
101 |
} |
102 |
} |
103 |
my @rates = GetCurrencies(); |
104 |
|
105 |
# ## @rates |
106 |
|
107 |
my @loop_currency = (); |
108 |
for my $curr ( @rates ) { |
109 |
my $selected; |
110 |
if ($data->{currency} ) { |
111 |
$selected = $curr->{currency} eq $data->{currency}; |
112 |
} |
113 |
else { |
114 |
$selected = $curr->{currency} eq $default_currency; |
115 |
} |
116 |
push @loop_currency, { |
117 |
currcode => $curr->{currency}, |
118 |
rate => $curr->{rate}, |
119 |
selected => $selected, |
120 |
} |
121 |
} |
122 |
|
94 |
|
123 |
$template->param("batch_details" => 1, |
95 |
$template->param("batch_details" => 1, |
124 |
"basketno" => $cgiparams->{'basketno'}, |
96 |
"basketno" => $cgiparams->{'basketno'}, |
125 |
loop_currencies => \@loop_currency, |
97 |
currencies => \@currencies, |
|
|
98 |
bookseller => $bookseller, |
126 |
"allmatch" => $allmatch, |
99 |
"allmatch" => $allmatch, |
127 |
); |
100 |
); |
128 |
import_biblios_list($template, $cgiparams->{'import_batch_id'}); |
101 |
import_biblios_list($template, $cgiparams->{'import_batch_id'}); |
Lines 167-173
if ($op eq ""){
Link Here
|
167 |
my @discount = $input->param('discount'); |
140 |
my @discount = $input->param('discount'); |
168 |
my @sort1 = $input->param('sort1'); |
141 |
my @sort1 = $input->param('sort1'); |
169 |
my @sort2 = $input->param('sort2'); |
142 |
my @sort2 = $input->param('sort2'); |
170 |
my $cur = GetCurrency(); |
143 |
my $active_currency = Koha::Acquisition::Currencies->get_active; |
171 |
for my $biblio (@$biblios){ |
144 |
for my $biblio (@$biblios){ |
172 |
# Check if this import_record_id was selected |
145 |
# Check if this import_record_id was selected |
173 |
next if not grep { $_ eq $$biblio{import_record_id} } @import_record_id_selected; |
146 |
next if not grep { $_ eq $$biblio{import_record_id} } @import_record_id_selected; |
Lines 252-258
if ($op eq ""){
Link Here
|
252 |
$orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c ); |
225 |
$orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c ); |
253 |
} |
226 |
} |
254 |
} |
227 |
} |
255 |
$orderinfo{listprice} = $orderinfo{rrp} / $cur->{rate}; |
228 |
$orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate; |
256 |
$orderinfo{unitprice} = $orderinfo{ecost}; |
229 |
$orderinfo{unitprice} = $orderinfo{ecost}; |
257 |
$orderinfo{total} = $orderinfo{ecost} * $c_quantity; |
230 |
$orderinfo{total} = $orderinfo{ecost} * $c_quantity; |
258 |
} else { |
231 |
} else { |