From 7323a56823c0b23faddd964206c8fc58431b769d Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 9 May 2023 10:36:40 -0300 Subject: [PATCH] Bug 33653: Use filter_by_active instead This patch makes `filter_by_lates` use the `filter_by_active` method instead of an ad-hoc query filter. It has the advantage that it considers standing orders too. No behavior change, tests should still pass. Signed-off-by: Tomas Cohen Arazi --- Koha/Acquisition/Orders.pm | 7 ++----- acqui/lateorders.pl | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Koha/Acquisition/Orders.pm b/Koha/Acquisition/Orders.pm index 5240d699a5..2438886ac8 100644 --- a/Koha/Acquisition/Orders.pm +++ b/Koha/Acquisition/Orders.pm @@ -130,10 +130,7 @@ sub filter_by_lates { && !C4::Context->IsSuperLibrarian ? ( 'borrower.branchcode' => C4::Context->userenv->{branch} ) : () - ), - - ( orderstatus => { '-not_in' => ['cancelled', 'complete'] } ), - + ) }, { '+select' => [ @@ -145,7 +142,7 @@ sub filter_by_lates { join => { 'basketno' => 'booksellerid' }, prefetch => {'basketno' => 'booksellerid'}, } - ); + )->filter_by_active; } =head3 filter_by_active diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl index 7ce5683ae5..6e8dbb9269 100755 --- a/acqui/lateorders.pl +++ b/acqui/lateorders.pl @@ -50,7 +50,7 @@ use C4::Output qw( output_html_with_http_headers ); use C4::Context; use C4::Letters qw( SendAlerts GetLetters ); use Koha::DateUtils qw( dt_from_string ); -use Koha::Acquisition::Orders qw( filter_by_lates ); +use Koha::Acquisition::Orders; use Koha::CsvProfiles; my $input = CGI->new; -- 2.39.5