Bug 40933

Summary: Add SMS support under Add message feature
Product: Koha Reporter: Lari Taskula <lari.taskula>
Component: Staff interfaceAssignee: Lari Taskula <lari.taskula>
Status: Pushed to main --- QA Contact: Andrew Fuerste-Henry <andrew>
Severity: enhancement    
Priority: P5 - low CC: andrew, carthur, gmcharlt, jzairo, lucas, magnus
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32403
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
This new feature allows staff with appropriate permissions, `send_messages_to_borrowers`, to send SMS messages patrons from the patron details pages. Notice templates can be defined, and used for defaults, using the `Patrons (custom message)` module.
Version(s) released in:
26.05.00
Circulation function:
Attachments: Bug 40933: Add the ability to send custom SMS messages to a patron
Bug 40933: Add the ability to send custom SMS messages to a patron
Bug 40933: Add the ability to send custom SMS messages to a patron
Bug 40933: Add the ability to send custom SMS messages to a patron
Bug 40933: Add the ability to send custom SMS messages to a patron

Description Lari Taskula 2025-10-01 20:02:12 UTC
Staff interface -> Patron details -> Add Message

Current options are:

Staff - Internal note
OPAC
Email - email addresses of patron

Add:

SMS - sms number of patron
Comment 1 Lari Taskula 2025-10-01 20:36:36 UTC
Created attachment 187226 [details] [review]
Bug 40933: Add the ability to send custom SMS messages to a patron

To test:
1. Make sure SMSSendDriver system preference is enabled
2. In staff client, navigate to patron details of any patron
3. From the members menu toolbar, click "Add Message"
4. Under "Add a message for", select "SMS - sms number of patron"
5. Write a custom message
6. Click "Save"
7. Navigate to patron's Notices tab
8. Observe a new notice titled "SMS added by a librarian"
9. Click it
10. Observe the content you wrote in step 5
Comment 2 Laura Escamilla 2025-10-30 13:12:56 UTC
Created attachment 188643 [details] [review]
Bug 40933: Add the ability to send custom SMS messages to a patron

To test:
1. Make sure SMSSendDriver system preference is enabled
2. In staff client, navigate to patron details of any patron
3. From the members menu toolbar, click "Add Message"
4. Under "Add a message for", select "SMS - sms number of patron"
5. Write a custom message
6. Click "Save"
7. Navigate to patron's Notices tab
8. Observe a new notice titled "SMS added by a librarian"
9. Click it
10. Observe the content you wrote in step 5

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 3 Andrew Fuerste-Henry 2026-01-06 17:05:26 UTC
This is no longer adding "SMS added by a librarian" as the subject of the message. The lack of subject means there is no link to see the notice content in the patron's Notices tab.
Comment 4 Andrew Fuerste-Henry 2026-01-06 21:06:19 UTC
Looking back at this, I've noticed that this code does not allow an SMS to be generating using an existing notice. When sending an email via Add Message, one can either type in email text directly or select a pre-defined letter_code. It would be ideal for SMS messages to match this functionality.
Comment 5 Magnus Enger 2026-01-13 11:00:04 UTC
(In reply to Andrew Fuerste-Henry from comment #4)
> Looking back at this, I've noticed that this code does not allow an SMS to
> be generating using an existing notice. When sending an email via Add
> Message, one can either type in email text directly or select a pre-defined
> letter_code. It would be ideal for SMS messages to match this functionality.

I would say this is useful even without the option to choose a pre-defined
letter_code. Maybe that could be left to a followup?
Comment 6 Lari Taskula 2026-01-13 11:31:23 UTC
Created attachment 191346 [details] [review]
Bug 40933: Add the ability to send custom SMS messages to a patron

To test:
1. Make sure SMSSendDriver system preference is enabled
2. In staff client, navigate to patron details of any patron
3. From the members menu toolbar, click "Add Message"
4. Under "Add a message for", select "SMS - sms number of patron"
5. Write a custom message
6. Click "Save"
7. Navigate to patron's Notices tab
8. Observe a new notice titled "SMS added by a librarian"
9. Click it
10. Observe the content you wrote in step 5
11. Repeat steps 2-4
12. Select predefined patron notice. If you don't have one,
navigate to Tools > Notices and slips > New notice > Patrons (custom message)
and add content under sms delivery option
13. Repeat steps 6-7
14. Observe your custom message in the notices table
15. Observe your custom message content when you click the notice
Comment 7 Lari Taskula 2026-01-13 11:34:28 UTC
(In reply to Andrew Fuerste-Henry from comment #3)
> This is no longer adding "SMS added by a librarian" as the subject of the
> message. The lack of subject means there is no link to see the notice
> content in the patron's Notices tab.

I could not reproduce this issue. Following the test plan gives me this subject. Can you give me the steps to reproduce it?

> Looking back at this, I've noticed that this code does not allow an SMS to be generating using an existing notice. When sending an email via Add Message, one can either type in email text directly or select a pre-defined letter_code. It would be ideal for SMS messages to match this functionality.

Good idea. The library who requested this feature from us didn't need to use pre-defined templates, but I can see it being useful for others

> I would say this is useful even without the option to choose a pre-defined
letter_code. Maybe that could be left to a followup?

It was just a tiny change to implement that so I've squashed it into the original patch.
Comment 8 Lari Taskula 2026-01-13 11:48:46 UTC
Btw something to note, this is currently controlled only by SMSSendDriver preference and edit_borrowers userflags. Since SMS messages are often not free of charge, there could be libraries wanting to disable this feature but at the same time still have automatically generated sms notices enabled. Not sure if a separate preference is required to control this feature.
Comment 9 Lari Taskula 2026-01-13 11:56:14 UTC
(In reply to Lari Taskula from comment #8)
> Btw something to note, this is currently controlled only by SMSSendDriver
> preference and edit_borrowers userflags. Since SMS messages are often not
> free of charge, there could be libraries wanting to disable this feature but
> at the same time still have automatically generated sms notices enabled. Not
> sure if a separate preference is required to control this feature.

But in our case it was the other way around, sms notices are disabled but the librarian still wants the option to occasionally send a manual sms to the patron :)
Comment 10 Magnus Enger 2026-01-13 12:59:23 UTC
(In reply to Lari Taskula from comment #8)
> Btw something to note, this is currently controlled only by SMSSendDriver
> preference and edit_borrowers userflags. Since SMS messages are often not
> free of charge, there could be libraries wanting to disable this feature but
> at the same time still have automatically generated sms notices enabled. Not
> sure if a separate preference is required to control this feature.

I would say a pref to turn this on or off would be nice, but not necessary.
Comment 11 Andrew Fuerste-Henry 2026-01-13 16:59:24 UTC
(In reply to Lari Taskula from comment #7)
> (In reply to Andrew Fuerste-Henry from comment #3)
> > This is no longer adding "SMS added by a librarian" as the subject of the
> > message. The lack of subject means there is no link to see the notice
> > content in the patron's Notices tab.
> 
> I could not reproduce this issue. Following the test plan gives me this
> subject. Can you give me the steps to reproduce it?

I cannot recreate this either and can't think of what I did differently last week. Apologies for the false alarm and thank you for adding in the template functionality! I'm going to try to get a librarian to sign of on this so I can QA it, but it all worked perfectly for me.
Comment 12 Andrew Fuerste-Henry 2026-01-13 17:00:47 UTC
(In reply to Lari Taskula from comment #7)
> (In reply to Andrew Fuerste-Henry from comment #3)
> > This is no longer adding "SMS added by a librarian" as the subject of the
> > message. The lack of subject means there is no link to see the notice
> > content in the patron's Notices tab.
> 
> I could not reproduce this issue. Following the test plan gives me this
> subject. Can you give me the steps to reproduce it?

I cannot recreate this either and can't think of what I did differently last week. Apologies for the false alarm and thank you for adding in the template functionality! I'm going to try to get a librarian to sign of on this so I can QA it, but it all worked perfectly for me.
Comment 13 Andrew Fuerste-Henry 2026-01-13 17:08:54 UTC
Created attachment 191374 [details] [review]
Bug 40933: Add the ability to send custom SMS messages to a patron

To test:
1. Make sure SMSSendDriver system preference is enabled
2. In staff client, navigate to patron details of any patron
3. From the members menu toolbar, click "Add Message"
4. Under "Add a message for", select "SMS - sms number of patron"
5. Write a custom message
6. Click "Save"
7. Navigate to patron's Notices tab
8. Observe a new notice titled "SMS added by a librarian"
9. Click it
10. Observe the content you wrote in step 5
11. Repeat steps 2-4
12. Select predefined patron notice. If you don't have one,
navigate to Tools > Notices and slips > New notice > Patrons (custom message)
and add content under sms delivery option
13. Repeat steps 6-7
14. Observe your custom message in the notices table
15. Observe your custom message content when you click the notice

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Comment 14 Andrew Fuerste-Henry 2026-01-20 16:06:17 UTC
Created attachment 191709 [details] [review]
Bug 40933: Add the ability to send custom SMS messages to a patron

To test:
1. Make sure SMSSendDriver system preference is enabled
2. In staff client, navigate to patron details of any patron
3. From the members menu toolbar, click "Add Message"
4. Under "Add a message for", select "SMS - sms number of patron"
5. Write a custom message
6. Click "Save"
7. Navigate to patron's Notices tab
8. Observe a new notice titled "SMS added by a librarian"
9. Click it
10. Observe the content you wrote in step 5
11. Repeat steps 2-4
12. Select predefined patron notice. If you don't have one,
navigate to Tools > Notices and slips > New notice > Patrons (custom message)
and add content under sms delivery option
13. Repeat steps 6-7
14. Observe your custom message in the notices table
15. Observe your custom message content when you click the notice

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>

Signed-off-by: Charlie Arthur <carthur@slolibrary.org>
Comment 15 Andrew Fuerste-Henry 2026-01-20 16:07:26 UTC
Adding a sign-off from Charlie and bumping my SO up to a PQA.
Comment 16 Lucas Gass (lukeg) 2026-01-30 17:56:21 UTC
Nice work everyone!

Pushed to main for 26.05