From e69be635e4a40306bc54f9fbef341ce003130330 Mon Sep 17 00:00:00 2001 From: Ayoub Glizi-Vicioso Date: Thu, 22 Jan 2026 11:11:49 -0500 Subject: [PATCH] Bug 40744: Handle PatronSelfRegistration as well as PatronSelfRegistrationExpireTemporaryAccountsDelay Test plan BEFORE APPLYING PATCH: 1- From the main page on the staff interface, go to Administration. 2- On the system preferences search bar, enter 'PatronSelfRegistration'. 3- Set 'PatronSelfRegistration' value to "Don't allow". 4- On the system preferences search bar, enter 'PatronSelfRegistrationExpireTemporaryAccountsDelay'. 5- Set 'PatronSelfRegistrationExpireTemporaryAccountsDelay' value to '0'. 6- On command line, run cleanup_database.pl. Note: the following message will show up: 'Self-registrations cannot be removed, system preference PatronSelfRegistrationDefaultCategory is not set' 7- Apply patch. AFTER APPLYING PATCH: 8- Set 'PatronSelfRegistration' value to "Don't allow" and set 'PatronSelfRegistrationExpireTemporaryAccountsDelay' value to '0'. 9- Save and run cleanup_database.pl : No message should show up. 10- Set 'PatronSelfRegistration' value to "Allow" and set 'PatronSelfRegistrationExpireTemporaryAccountsDelay' value to '0'. 11- Save and run cleanup_database.pl : No message should show up. 12- Set 'PatronSelfRegistration' value to "Don't allow". and set 'PatronSelfRegistrationExpireTemporaryAccountsDelay' value to '1'. 13- Save and run cleanup_database.pl : No message should show up. 14- Set 'PatronSelfRegistration' value to "Allow". and set 'PatronSelfRegistrationExpireTemporaryAccountsDelay' value to '1'. 15- Save and run cleanup_database.pl Note: this message should show up: 'Self-registrations cannot be removed, system preference PatronSelfRegistrationDefaultCategory is not set' 16- Set 'PatronSelfRegistration' value to "Don't allow". and set 'PatronSelfRegistrationExpireTemporaryAccountsDelay' value to ''(leave empty). 17- Save and run cleanup_database.pl : No message should show up. 18- Set 'PatronSelfRegistration' value to "Allow". and set 'PatronSelfRegistrationExpireTemporaryAccountsDelay' value to ''(leave empty). 19- Save and run cleanup_database.pl : No message should show up. ** EXEMPLE OF THE COMMAND TO EXECUTE: make sure to enter the RIGHT PATH to the script file. perl /path/to/cleanup_database.pl --sessions --sessdays 1 --zebraqueue 1 --mail 365 --merged --import 90 --z3950 --logs 180 --searchhistory 30 --list-invites 7 --all-restrictions --del-exp-selfreg --del-unv-selfreg 30 --temp-uploads --temp-uploads-days 14 --oauth-tokens --transfers 30 --jobs-days 1 --jobs-type all --confirm Signed-off-by: David Nind --- misc/cronjobs/cleanup_database.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl index 2299e59cc5..14956ead72 100755 --- a/misc/cronjobs/cleanup_database.pl +++ b/misc/cronjobs/cleanup_database.pl @@ -524,7 +524,7 @@ if ($verbose) { say $confirm ? sprintf( "Deleted %d patrons", $count ) : sprintf( "%d patrons would have been deleted", $count ); } -if ( $pExpSelfReg && C4::Context->preference('PatronSelfRegistration') ) { +if ( $pExpSelfReg && C4::Context->preference('PatronSelfRegistration') && C4::Context->preference('PatronSelfRegistrationExpireTemporaryAccountsDelay')) { try { my $opac_registrations = Koha::Patrons->search->filter_by_expired_opac_registrations->filter_by_safe_to_delete; my $count = $opac_registrations->count; -- 2.39.5