From de41fe8f909c041e7eb418d8f9987782d7752bc4 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 26 Oct 2022 15:00:53 +0000 Subject: [PATCH] Bug 31937: Fix Patrons::search_unsubscribed - sharpen condition The condition is fine as long as we only have GDPR consents. But if you dont, you would have trouble. I know :) Lets prevent that here, although the table still has an ENUM. So double safety. Test plan: Run t/db_dependent/Koha/Patrons.t Bonus: Run cleanup_database.pl and check for unusual number of locked accounts: misc/cronjobs/cleanup_database.pl --confirm -v --sessions Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer Signed-off-by: Katrin Fischer --- Koha/Patrons.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm index 24e3d9de8a..c210f53f4b 100644 --- a/Koha/Patrons.pm +++ b/Koha/Patrons.pm @@ -237,6 +237,7 @@ sub search_unsubscribed { return $class->search( { 'patron_consents.refused_on' => { '<=' => $str }, + 'patron_consents.type' => 'GDPR_PROCESSING', 'login_attempts' => $cond, }, { join => 'patron_consents' }, -- 2.30.2