use C4::Koha;
use Koha::Acquisition::Booksellers;
+use Koha::Acquisition::Currencies;
use Koha::Acquisition::Orders;
use Koha::DateUtils qw( dt_from_string );
use Koha::ItemTypes;
# prepare the form for receiving
my $order = $results->[0];
-my $basket = Koha::Acquisition::Orders->find( $ordernumber )->basket;
+my $order_object = Koha::Acquisition::Orders->find( $ordernumber );
+my $basket = $order_object->basket;
+my $active_currency = Koha::Acquisition::Currencies->get_active;
# Check if ACQ framework exists
my $acq_fw = GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
);
} elsif ($AcqCreateItem eq 'ordering') {
my $fw = ($acq_fw) ? 'ACQ' : '';
- my @itemnumbers = GetItemnumbersFromOrder($order->{ordernumber});
+ my @itemnumbers = $order_object->items->get_column('itemnumber');
my @items;
foreach (@itemnumbers) {
- my $item = GetItem($_);
+ my $item = GetItem($_); # FIXME We do not need this call, we already have the Koha::Items
my $descriptions;
$descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => $fw, kohafield => 'items.notforloan', authorised_value => $item->{notforloan} });
$item->{notforloan} = $descriptions->{lib} // '';
option => $_ + 0.0
}, split( '\|', C4::Context->preference("gist") );
+if ( $order->{subscriptionid} ) {
+ # Order from a subscription, we will display an history of what has been received
+ my $orders = Koha::Acquisition::Orders->search(
+ {
+ subscriptionid => $order->{subscriptionid},
+ parent_ordernumber => $order->{ordernumber},
+ ordernumber => { '!=' => $order->{ordernumber} }
+ }
+ );
+ $template->param( orders => $orders );
+}
+
$template->param(
AcqCreateItem => $AcqCreateItem,
count => 1,
booksellerid => $order->{'booksellerid'},
freight => $freight,
name => $bookseller->name,
+ cur_active_sym => $active_currency->symbol,
+ cur_active => $active_currency->currency,
+ listincgst => $bookseller->listincgst,
+ invoiceincgst => $bookseller->invoiceincgst,
title => $order->{'title'},
author => $order->{'author'},
copyrightdate => $order->{'copyrightdate'},
quantityreceivedplus1 => $order->{'quantityreceived'} + 1,
quantityreceived => $order->{'quantityreceived'},
rrp => $rrp,
+ replacementprice => $order->{'replacementprice'},
ecost => $ecost,
unitprice => $unitprice,
tax_rate => $tax_rate,