From 1e9bb1f1ad8a99e279cab624e6852758990336f5 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. Signed-off-by: Christian Stelzenmüller Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- 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.39.5