Bug 39646

Summary: Send overdue notice to guarantor when guarantee has no email
Product: Koha Reporter: William Lavoie <william.lavoie>
Component: NoticesAssignee: Hammat wele <hammat.wele>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: caroline.cyr-la-rose, david, philippe.blouin
Version: Main   
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 39646: Send overdue notice to guarantor when guarantee has no email

Description William Lavoie 2025-04-15 20:02:50 UTC
If a guarantee does not have an email address registered to their account, then the script overdue_notices.pl doesn't send an email to their guarantors either.
Additionally, if an email is sent, the letter should not be printed.
Comment 1 William Lavoie 2025-04-15 20:22:02 UTC
Created attachment 180995 [details] [review]
Bug 39646: Send overdue notice to guarantor when guarantee has no email

Test plan:
1. Have a patron with no email address and an overdue item.
2. Add a guarantor to this patron. The guarantor must have an email
   address.
3. Run the script overdue_notices.pl.
4. On the staff interface, go to the guarantee patron > Notices.
5. Notice that only a print notice has been created.
6. Apply the patch.
7. Repeat steps 3 and 4.
8. Notice that an email message has been created.
9. Run the script process_message_queue.pl.
10. Verify that the email has been sent to the guarantor's address.
Comment 2 David Nind 2025-04-27 19:54:44 UTC
I had a go at testing, but it did not work for me.

After the patch, there is no email overdue notice for the Guarantor (Mary) with the Guarentee's (Lisa's) overdue item.

It just generated a print notice for the Guarantee (Lisa).

This may be because I've never generated overdue notices before, and I'm not sure that I have set everything up correctly.

Testing notes (using KTD):

1. Add a valid email address you have access to, to the KohaAdminEmailAddress system preference.

2. Update the details for a Guarantee patron:
   - Lisa Charles
   - Add Mary Burton as Guarantor
   - Patron messaging preferences:
     . Advance notice: 1 and Email selected

3. Update the details for a Guarantor patron:
   - Mary Burton
   - Primary email: set a valid email address you have access to
   - Patron messaging preferences:
     . Advance notice: 1 and Email selected

4. Set up sending emails using a Google account:
   4.1 Set up an App password for your Google Account
   4.2 Configure a new 'SMTP Server' under 'Administration > SMTP servers'
   using the following settings where `User name` = your Google email
   address and `Password` = your APP password, not your Google account
   password):
       - Host: smtp.gmail.com
       - Port: 587
       - Timeout: 5
       - SSL: STARTTLS
       - User name: GOOGLEACCOUNTUSER
       - Password: GOOGLEAPPPASSWORD
       - Set this server as default
   4.3 Test that this is working by:
       - Sending a welcome message to Mary Burton
       - Process the message queue: misc/cronjobs/process_message_queue.pl

5. Set up overdue notice/status triggers:
   5.1 Tools > Patrons and circulation > Overdue notice/status triggers
   5.2 For default library and the Kid and Patron patron categories:
       - Delay: 1
       - Letter: Overdue notice (ODUE)
       - Email: selected

6. Check out an item to Lisa Charles and make it overdue:
   6.1 I used: Programming perl, 39999000011418
   6.2 Search bar: select check out, then enter lisa and select
   6.3 Enter the barcode: 39999000011418
   6.4 Click the settings icon in the barcode field
   6.5 Set specifify due date to the previous month
   6.6 Click check out
   6.7 Confirm checkout: Yes, check out (Y)

7. Check that an overdue notice will be triggered: misc/cronjobs/overdue_notices.pl --list-all -v

8. Run for real: misc/cronjobs/overdue_notices.pl -v