From 04dd6f351335ff6ee15c96ade33b9d2bb2d77946 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 2 Aug 2022 16:57:02 +1200 Subject: [PATCH] Bug 15348: (follow-up) Fix filtering results on estimated delivery date Adding another clause to the SQL so that the specified estimated delivery date is used for filtering first, and the calculated delivery date is used if there is no specified estimated delivery date. --- Koha/Acquisition/Orders.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Koha/Acquisition/Orders.pm b/Koha/Acquisition/Orders.pm index e345df38f7..e429475dc3 100644 --- a/Koha/Acquisition/Orders.pm +++ b/Koha/Acquisition/Orders.pm @@ -72,6 +72,7 @@ sub filter_by_lates { my @estimated_delivery_time_conditions; if ( defined $estimated_from or defined $estimated_to ) { push @delivery_time_conditions, \[ "$date_add IS NOT NULL" ]; + push @delivery_time_conditions, \[ "estimated_delivery_date IS NULL" ]; push @estimated_delivery_time_conditions, \[ "estimated_delivery_date IS NOT NULL" ]; } if ( defined $estimated_from ) { @@ -118,8 +119,8 @@ sub filter_by_lates { ( ( @delivery_time_conditions and @estimated_delivery_time_conditions ) ? ( -or => [ - -and => \@delivery_time_conditions, - -and => \@estimated_delivery_time_conditions + -and => \@estimated_delivery_time_conditions, + -and => \@delivery_time_conditions ] ) : () -- 2.11.0