Bug 40744: Ignore --del-exp-selfreg if pref is not set

If PatronSelfRegistration we should ignore (i.e. do nothing) if
--del-exp-selfreg is passed to cleanup_database.pl

It prevents the script to warn that the pref is not set.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
This commit is contained in:
Jonathan Druart 2026-01-22 16:13:44 +01:00 committed by Martin Renvoize
parent e70e6a233e
commit d331c7aba8
No known key found for this signature in database
GPG Key ID: 2D86E0EAEC83711B
1 changed files with 1 additions and 1 deletions

View File

@ -524,7 +524,7 @@ if ($verbose) {
say $confirm ? sprintf( "Deleted %d patrons", $count ) : sprintf( "%d patrons would have been deleted", $count );
}
if ($pExpSelfReg) {
if ( $pExpSelfReg && C4::Context->preference('PatronSelfRegistration') ) {
try {
my $opac_registrations = Koha::Patrons->search->filter_by_expired_opac_registrations->filter_by_safe_to_delete;
my $count = $opac_registrations->count;