From c770cc3fc65808ade44fc58f693ce0f6e2a0984b 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Joonas Kylmälä --- catalogue/detail.pl | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 4ffe75c0a3..4f1c44fd0d 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -553,26 +553,18 @@ 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; - } -} - $template->param(biblio => $biblio); -my $count_orders_using_biblio = scalar @orders_using_biblio ; -$template->param (countorders => $count_orders_using_biblio); +my $orders = + Koha::Acquisition::Orders->search( { biblionumber => $biblionumber } ); -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