From 4ec8a8db7a54ee646b4976e2d8d7d6b2fbd79b6a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 19 Jun 2019 21:35:20 -0500 Subject: [PATCH] Bug 23166: Replace the count of orders with Koha::Acq::Orders --- catalogue/detail.pl | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 3c2b2dc434..a579516141 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -512,24 +512,16 @@ if ($StaffDetailItemSelection) { } } -my @allorders_using_biblio = GetOrdersByBiblionumber ($biblionumber); -my @deletedorders_using_biblio; -my @orders_using_biblio; - -foreach my $myorder (@allorders_using_biblio) { - my $basket = $myorder->{'basketno'}; - if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){ - push @deletedorders_using_biblio, $myorder; - } - else { - push @orders_using_biblio, $myorder; - } -} +my $orders = + Koha::Acquisition::Orders->search( { biblionumber => $biblionumber } ); -my $count_orders_using_biblio = scalar @orders_using_biblio ; -$template->param (countorders => $count_orders_using_biblio); - -my $count_deletedorders_using_biblio = scalar @deletedorders_using_biblio ; -$template->param (countdeletedorders => $count_deletedorders_using_biblio); +$template->param( + countorders => $orders->search( { + datecancellationprinted => [ undef, '0000-00-00' ] + } )->count, + countdeletedorders => $orders->search( { + datecancellationprinted => [ { '!=' => [ -and => ( undef, '0000-00-00' ) ] } ] + } )->count, +) if $orders->count; output_html_with_http_headers $query, $cookie, $template->output; -- 2.11.0