From f563c5a8e9eccad9514d758660090fef97f34805 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=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Nick Clemens Signed-off-by: Joonas Kylmälä Signed-off-by: Jonathan Druart --- catalogue/detail.pl | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index b0e6d2c07e..45a2918e02 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -552,26 +552,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.39.5