From c48087b551e9db34ea503c3ea7af7f0490fcb83a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 3 May 2023 15:18:13 +0200 Subject: [PATCH] Bug 33653: Never consider received orders as late We should not list received orders on the late orders page. Test plan: * Create a basket * Create a normal order (not from a subscription, no standing order) * Leave estimated delivery date empty * Close the basket * Create a new invoice and receive the order line * Go to acq > late orders * Verify the order is not in the list * Set filter for 'To' date into the future, i.e. 01/01/2025 => Without this patch the order shows up => With this patch applied the received order does not show up Signed-off-by: Michaela Sieber Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 64c4f115cde75c48f71cfd0d7bdb220f48212daf) Signed-off-by: Matt Blenkinsop --- Koha/Acquisition/Orders.pm | 2 +- t/db_dependent/Koha/Acquisition/Order.t | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Koha/Acquisition/Orders.pm b/Koha/Acquisition/Orders.pm index e429475dc3..5240d699a5 100644 --- a/Koha/Acquisition/Orders.pm +++ b/Koha/Acquisition/Orders.pm @@ -132,7 +132,7 @@ sub filter_by_lates { : () ), - ( orderstatus => { '!=' => 'cancelled' } ), + ( orderstatus => { '-not_in' => ['cancelled', 'complete'] } ), }, { diff --git a/t/db_dependent/Koha/Acquisition/Order.t b/t/db_dependent/Koha/Acquisition/Order.t index 4d96e3b7d9..784acd11cb 100755 --- a/t/db_dependent/Koha/Acquisition/Order.t +++ b/t/db_dependent/Koha/Acquisition/Order.t @@ -416,6 +416,7 @@ subtest 'filter_by_late' => sub { datereceived => undef, datecancellationprinted => undef, estimated_delivery_date => undef, + orderstatus => 'ordered', } } ); @@ -436,6 +437,7 @@ subtest 'filter_by_late' => sub { datereceived => undef, datecancellationprinted => undef, estimated_delivery_date => undef, + orderstatus => 'ordered', } } ); @@ -456,6 +458,7 @@ subtest 'filter_by_late' => sub { datereceived => undef, datecancellationprinted => undef, estimated_delivery_date => undef, + orderstatus => 'ordered', } } ); @@ -476,6 +479,19 @@ subtest 'filter_by_late' => sub { datereceived => undef, datecancellationprinted => undef, estimated_delivery_date => undef, + orderstatus => 'ordered', + } + } + ); + my $order_42 = $builder->build_object( + { + class => 'Koha::Acquisition::Orders', + value => { + basketno => $basket_4->basketno, + datereceived => undef, + datecancellationprinted => undef, + estimated_delivery_date => undef, + orderstatus => 'complete', } } ); -- 2.39.5