https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40744 --- Comment #11 from Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> --- Comment on attachment 191877 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191877 BZ40744: Handle PatronSelfRegistration as well as PatronSelfRegistrationExpireTemporaryAccountsDelay
From d48323236ef6071f263981944b33a039cf84bdae Mon Sep 17 00:00:00 2001 From: Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> Date: Thu, 22 Jan 2026 11:11:49 -0500 Subject: [PATCH] BZ40744: Handle PatronSelfRegistration as well as PatronSelfRegistrationExpireTemporaryAccountsDelay
Handle error messages from the cleanup_database.pl script, depending on the preference settings.
to test
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
--- 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.52.0
-- You are receiving this mail because: You are watching all bug changes.