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 <tomascohen@theke.io>
(cherry picked from commit 7323a56823)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Tomás Cohen Arazi 2023-05-09 10:36:40 -03:00 committed by Matt Blenkinsop
parent c48087b551
commit 1dbc3ac100
2 changed files with 3 additions and 6 deletions

View file

@ -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

View file

@ -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;