Bug 40076

Summary: Add --skip-no-email parameter to borrowers-force-messaging-defaults.pl
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: Command-line UtilitiesAssignee: Hammat wele <hammat.wele>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: caroline.cyr-la-rose, hammat.wele, philippe.blouin, robin
Version: unspecified   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 40076: Add --skip-no-email parameter to borrowers-force-messaging-defaults.pl

Description Caroline Cyr La Rose 2025-06-04 20:26:49 UTC
I use this script a lot during migrations to set the default preferences from the categories to all the patrons. However, recently I've had cases where about half the patrons did not have email addresses in their accounts. This means that I either set everyone's preferences and the library has to go back and remove the preferences from the patrons without email addresses, or I don't do it, and the library has to set the preferences for those with email addresses.

(I think I've had back-to-back cases like this because in their old system it was set up as if the patron has an email address, they get the email notices, and if they want to opt-out, they remove their email address from their account.)

It would be great if the script could skip the patrons without email addresses.

(Note : we never set SMS messages by default, only email; I don't know if someone does this, but it is not a requirement for us to manage sms messaging with this script.)
Comment 1 Hammat wele 2025-07-03 15:56:18 UTC
Created attachment 183769 [details] [review]
Bug 40076: Add --skip-no-email parameter to borrowers-force-messaging-defaults.pl

This patch adds a new parameter to skip borrowers without an email address.

To test:
1 - Create a new patron without an email address and note their borrowernumber.
2 - Run ./misc/maintenance/borrowers-force-messaging-defaults.pl
   ==> The patron created in step 1 should be processed.
3 - Repeat step 2 with the --skip-no-email parameter.
   ==> The patron created in step 1 should not be processed.