From ea3b9e4b4c22a6570512d8c9ecc9b9d8691bea11 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 35f0bebb1c..3dcdbaf60d 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -557,26 +557,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.20.1