From f4cb7dad3fecb0dd511a285623bca2e80febaeeb 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: Jonathan Druart --- Koha/Patrons.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm index 24e3d9de8a6..c210f53f4bc 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.25.1