Bug 14850: Funds from inactive budgets appear in 'Funds' dropdown on acqui/invoice.pl
[koha.git] / acqui / uncertainprice.pl
index 34a6b25..4a559e3 100755 (executable)
@@ -43,8 +43,7 @@ The bookseller who we want to display the orders of.
 =cut
 
 
-use strict;
-use warnings;
+use Modern::Perl;
 
 use C4::Auth;
 use C4::Output;
@@ -54,6 +53,7 @@ use C4::Acquisition qw/SearchOrders GetOrder ModOrder/;
 use C4::Biblio qw/GetBiblioData/;
 
 use Koha::Acquisition::Booksellers;
+use Koha::Acquisition::Baskets;
 
 my $input=new CGI;
 
@@ -72,6 +72,8 @@ my $op = $input->param('op');
 my $owner = $input->param('owner') || 0 ; # flag to see only "my" orders, or everyone orders
 my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
 
+$template->param( basket => scalar Koha::Acquisition::Baskets->find($basketno) );
+
 #show all orders that have uncertain price for the bookseller
 my $pendingorders = SearchOrders({
     booksellerid => $booksellerid,
@@ -79,24 +81,8 @@ my $pendingorders = SearchOrders({
     basketno => $basketno,
     pending => 1,
 });
-my @orders;
-
-foreach my $order (@{$pendingorders}) {
-    if ( $order->{'uncertainprice'} ) {
-        my $bibdata = &GetBiblioData($order->{'biblionumber'});
-        $order->{'bibisbn'} = $bibdata->{'isbn'};
-        $order->{'bibpublishercode'} = $bibdata->{'publishercode'};
-        $order->{'bibpublicationyear'} = $bibdata->{'publicationyear'};
-        $order->{'bibtitle'} = $bibdata->{'title'};
-        $order->{'bibauthor'} = $bibdata->{'author'};
-        $order->{'surname'} = $order->{'surname'};
-        $order->{'firstname'} = $order->{'firstname'};
-        my $order_as_from_db=GetOrder($order->{ordernumber});
-        $order->{'quantity'} = $order_as_from_db->{'quantity'};
-        $order->{'listprice'} = $order_as_from_db->{'listprice'};
-        push(@orders, $order);
-    }
-}
+my @orders = grep { $_->{'uncertainprice'} } @$pendingorders;
+
 if ( $op eq 'validate' ) {
     $template->param( validate => 1);
     my $count = scalar(@orders);