From 60adc95f52fff6ce84a7583eb4fb2b010e259ff7 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 4 Aug 2020 18:28:42 +0000 Subject: [PATCH] Bug 25683: (follow-up) Use COALESCE instead of IFNULL Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart (cherry picked from commit e1509855d3aa2729127ac352525be62505d752f9) Signed-off-by: Lucas Gass (cherry picked from commit 6bea771b8048282c61b260699e1b62d8944a7f90) Signed-off-by: Aleisha Amohia --- Koha/Patrons.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm index c984556e52..ae673c29fb 100644 --- a/Koha/Patrons.pm +++ b/Koha/Patrons.pm @@ -395,8 +395,8 @@ sub search_patrons_to_update_category { $query{join} = ["accountlines"]; $query{columns} = ["borrowernumber"]; $query{group_by} = ["borrowernumber"]; - $query{having} = \['IFNULL(sum(accountlines.amountoutstanding),0) <= ?',$params->{fine_max}] if defined $params->{fine_max}; - $query{having} = \['IFNULL(sum(accountlines.amountoutstanding),0) >= ?',$params->{fine_min}] if defined $params->{fine_min}; + $query{having} = \['COALESCE(sum(accountlines.amountoutstanding),0) <= ?',$params->{fine_max}] if defined $params->{fine_max}; + $query{having} = \['COALESCE(sum(accountlines.amountoutstanding),0) >= ?',$params->{fine_min}] if defined $params->{fine_min}; } return $self->search($search_params,\%query); } -- 2.39.5