Bugzilla – Attachment 150821 Details for
Bug 33653
Search for late orders can show received order lines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33653: Use filter_by_active instead
Bug-33653-Use-filterbyactive-instead.patch (text/plain), 5.22 KB, created by
Jonathan Druart
on 2023-05-09 07:20:57 UTC
(
hide
)
Description:
Bug 33653: Use filter_by_active instead
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-05-09 07:20:57 UTC
Size:
5.22 KB
patch
obsolete
>From b88bfaf07549732a409793d422a0a454eadfb481 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 9 May 2023 09:20:02 +0200 >Subject: [PATCH] Bug 33653: Use filter_by_active instead > >We have filter_by_active that is filtering by status already. >--- > Koha/Acquisition/Orders.pm | 3 --- > acqui/lateorders.pl | 4 ++-- > t/db_dependent/Koha/Acquisition/Order.t | 28 ++++++++++++------------- > 3 files changed, 16 insertions(+), 19 deletions(-) > >diff --git a/Koha/Acquisition/Orders.pm b/Koha/Acquisition/Orders.pm >index 5240d699a5f..74c6a7f3f80 100644 >--- a/Koha/Acquisition/Orders.pm >+++ b/Koha/Acquisition/Orders.pm >@@ -131,9 +131,6 @@ sub filter_by_lates { > ? ( 'borrower.branchcode' => C4::Context->userenv->{branch} ) > : () > ), >- >- ( orderstatus => { '-not_in' => ['cancelled', 'complete'] } ), >- > }, > { > '+select' => [ >diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl >index 7ce5683ae56..9a6e742413d 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; >@@ -119,7 +119,7 @@ my @lateorders = Koha::Acquisition::Orders->filter_by_lates( > : () > ) > }, >-)->as_list; >+)->filter_by_active->as_list; > > my $booksellers = Koha::Acquisition::Booksellers->search( > { >diff --git a/t/db_dependent/Koha/Acquisition/Order.t b/t/db_dependent/Koha/Acquisition/Order.t >index 784acd11cbf..50c6f05c424 100755 >--- a/t/db_dependent/Koha/Acquisition/Order.t >+++ b/t/db_dependent/Koha/Acquisition/Order.t >@@ -507,48 +507,48 @@ subtest 'filter_by_late' => sub { > } > ); > >- my $late_orders = $orders->filter_by_lates; >+ my $late_orders = $orders->filter_by_lates->filter_by_active; > is( $late_orders->count, 3 ); > >- $late_orders = $orders->filter_by_lates( { delay => 0 } ); >+ $late_orders = $orders->filter_by_lates( { delay => 0 } )->filter_by_active; > is( $late_orders->count, 3 ); > >- $late_orders = $orders->filter_by_lates( { delay => 1 } ); >+ $late_orders = $orders->filter_by_lates( { delay => 1 } )->filter_by_active; > is( $late_orders->count, 3 ); > >- $late_orders = $orders->filter_by_lates( { delay => 3 } ); >+ $late_orders = $orders->filter_by_lates( { delay => 3 } )->filter_by_active; > is( $late_orders->count, 2 ); > >- $late_orders = $orders->filter_by_lates( { delay => 4 } ); >+ $late_orders = $orders->filter_by_lates( { delay => 4 } )->filter_by_active; > is( $late_orders->count, 1 ); > >- $late_orders = $orders->filter_by_lates( { delay => 5 } ); >+ $late_orders = $orders->filter_by_lates( { delay => 5 } )->filter_by_active; > is( $late_orders->count, 1 ); > >- $late_orders = $orders->filter_by_lates( { delay => 6 } ); >+ $late_orders = $orders->filter_by_lates( { delay => 6 } )->filter_by_active; > is( $late_orders->count, 0 ); > > $late_orders = $orders->filter_by_lates( >- { estimated_from => $now->clone->subtract( days => 6 ) } ); >+ { estimated_from => $now->clone->subtract( days => 6 ) } )->filter_by_active; > is( $late_orders->count, 2 ); > is( $late_orders->next->ordernumber, $order_3->ordernumber ); > > $late_orders = $orders->filter_by_lates( >- { estimated_from => $now->clone->subtract( days => 5 ) } ); >+ { estimated_from => $now->clone->subtract( days => 5 ) } )->filter_by_active; > is( $late_orders->count, 2 ); > is( $late_orders->next->ordernumber, $order_3->ordernumber ); > > $late_orders = $orders->filter_by_lates( >- { estimated_from => $now->clone->subtract( days => 4 ) } ); >+ { estimated_from => $now->clone->subtract( days => 4 ) } )->filter_by_active; > is( $late_orders->count, 2 ); > is( $late_orders->next->ordernumber, $order_3->ordernumber ); > > $late_orders = $orders->filter_by_lates( >- { estimated_from => $now->clone->subtract( days => 3 ) } ); >+ { estimated_from => $now->clone->subtract( days => 3 ) } )->filter_by_active; > is( $late_orders->count, 2 ); > > $late_orders = $orders->filter_by_lates( >- { estimated_from => $now->clone->subtract( days => 1 ) } ); >+ { estimated_from => $now->clone->subtract( days => 1 ) } )->filter_by_active; > is( $late_orders->count, 1 ); > > $late_orders = $orders->filter_by_lates( >@@ -556,7 +556,7 @@ subtest 'filter_by_late' => sub { > estimated_from => $now->clone->subtract( days => 4 ), > estimated_to => $now->clone->subtract( days => 3 ) > } >- ); >+ )->filter_by_active; > is( $late_orders->count, 1 ); > > my $basket_5 = $builder->build_object( # closed today >@@ -584,7 +584,7 @@ subtest 'filter_by_late' => sub { > estimated_from => $now->clone->subtract( days => 3 ), > estimated_to => $now->clone->subtract( days => 2 ) > } >- ); >+ )->filter_by_active; > is( $late_orders->count, 1 ); > > $schema->storage->txn_rollback; >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33653
:
150582
|
150624
|
150669
|
150686
|
150821
|
150833
|
150834
|
150865