Bug 4833: Show acq information when selecting suggestion for order
[srvgit] / acqui / ordered.pl
index 3eb0519..f6796f2 100755 (executable)
@@ -77,7 +77,7 @@ WHERE
     (quantity > quantityreceived OR quantityreceived IS NULL)
     GROUP BY aqorders.biblionumber, aqorders.basketno, aqorders.ordernumber,
              tleft,
-             ecost, budgetdate, entrydate,
+             ecost_tax_included, budgetdate, entrydate,
              aqbasket.booksellerid,
              aqbooksellers.name,
              itype,
@@ -99,7 +99,7 @@ while ( my $data = $sth->fetchrow_hashref ) {
         $left = $data->{'quantity'};
     }
     if ( $left && $left > 0 ) {
-        my $subtotal = get_rounded_price( $left * $data->{'ecost_tax_included'} );
+        my $subtotal = $left * get_rounded_price( $data->{'ecost_tax_included'} );
         $data->{subtotal} = sprintf( "%.2f", $subtotal );
         $data->{'left'} = $left;
         push @ordered, $data;
@@ -107,7 +107,7 @@ while ( my $data = $sth->fetchrow_hashref ) {
     }
 }
 
-my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({budget_id => $fund_id, closedate => undef, encumber_open => 1 }, { join => 'invoiceid' } );
+my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({budget_id => $fund_id, closedate => undef, encumber_open => 1 }, { prefetch => 'invoiceid' } );
 while ( my $adj = $adjustments->next ){
     $total += $adj->adjustment;
 }