Bug 21781 - message_transport_type should allow fallbacks
Summary: message_transport_type should allow fallbacks
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords:
: 21776 (view as bug list)
Depends on: 21241
Blocks: 37214
  Show dependency treegraph
 
Reported: 2018-11-07 12:40 UTC by Martin Renvoize (ashimema)
Modified: 2024-09-24 16:14 UTC (History)
7 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Extended notice message_transport_type fallback functionality implemented by FallbackToSMSIfNoEmail system preference to: cronjobs (membership expiry, automatic renewal), opac-shareshelf.pl (sending of SHARE_ACCEPT notice when list share accepted), circ/pendingreserves.pl (sending 'CANCEL_HOLD_ON_LOST' notice when reserved item marked lost in Holds to pull), C4/Acquisition.pm (sending 'ACQ_NOTIF_ON_RECEIV' notice to notify order user of order receival)
Version(s) released in:
Circulation function:


Attachments
Bug 21781: Fallback to SMS if no email address where email address hardcoded (10.55 KB, patch)
2020-04-23 01:25 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 21781: Fallback to SMS if no email address where email address hardcoded (10.55 KB, patch)
2020-04-23 01:31 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 21781: Fallback to SMS if no email address where email address hardcoded (11.23 KB, patch)
2020-05-25 20:57 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 21781: Fallback to SMS if no email address where email address hardcoded (11.24 KB, patch)
2020-09-02 21:20 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 21781 - message_transport_type should allow fallbacks (4.63 KB, patch)
2021-09-14 17:31 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 21781 - message_transport_type should allow fallbacks (5.15 KB, patch)
2021-09-14 17:36 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 21781 - message_transport_type should allow fallbacks (5.13 KB, patch)
2024-06-27 14:34 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 21781: Apply message_transport_type fallbacks to more locations (5.20 KB, patch)
2024-06-27 14:53 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 21781: (follow-up) Use SMS templates (8.52 KB, patch)
2024-06-27 14:53 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2018-11-07 12:40:19 UTC
Bug 21241 adds the ability for a fallback from email to sms when a patron email address isn't found on the suggestions notices.

This shouldn't be limited to suggestions, but be a more comprehensive piece of work to capture other hard coded message transports.

opac/svc/checkout_notes
opac/opac-issue-note.pl
opac/opac-memberentry.pl
opac/opac-shareshelf.pl
circ/pendingreserves.pl
circ/article-request-slip.pl
C4/Reserves.pm
C4/Acquisition.pm
misc/cronjobs/automatic_renewals.pl
misc/cronjobs/membership_expiry.pl
misc/cronjobs/stockrotation.pl
Koha/ArticleRequests.pm
Koha/Patron/Password/Recovery.pm
Koha/Account.pm

All of the above have a message_transport_type hard coded to some degree.. some may be better served left as is.. but many would benefit from a fallback.
Comment 1 Alex Buckley 2020-04-23 01:25:58 UTC
Created attachment 103525 [details] [review]
Bug 21781: Fallback to SMS if no email address where email address hardcoded

Extend use of FallbackToSMSIfNoEmail syspref to fallback to SMS if no
patron email address outside of it's current usage sending suggestion
notices.

Test plan for C4/Acquisitions.pm:
1. Input a value into SMSSendDriver syspref
2. Create a patron with sms (under Member messaging preferences) and no email address
3. In Acquistions module make currency, active budget, fund, vendor
4. Create a basket
5. Add to basket. Click to add 'From a new (empty) record'
6. Under 'Patrons' header add a user and search for your patron (added
in #1)
7. Submit new order
8. Receive the order:
'Close this basket'
'Receive shipment'
Submit invoice page
Select 'Receive' link on right hand side of page
Tick checkbox to add 1 quantity of item and Save
9. Revisit your patrons page and in the 'Notices' tab you'll see a
'Order received' notice with type of 'email'
11. Apply patch and restart plack
12. Repeat steps 4-9 and observe the 'Order received' notice has a type
of SMS

Test plan for amendment to circ/pendingreserves.pl (patch has been
applied in 'Test plan for C4/Acquidsitions.pm):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Set CanMarkHoldsToPullAsLost  syspref to 'Allow to mark items as lost
and notify the patron'
3. Using the patron from test plan for C4/Acquisitions.pm (i.e. sms alert
number and no email) place a hold on an item currently available
4. Visit Circulation > Holds to pull
5. Select 'Mark lost and notify patron'
6. Return to patron page look in 'Notices' tab and observe 'Hold has
been cancelled' notice has type of 'email'
7. Change 'FallbackToSMSIfNoEmail' to 'Enable' and repeat steps 3,4,5,6
and observe the new 'Hold has been cancelled' notice has type 'sms'

Test plan for amendment to misc/cronjobs/automatic_renewals.pl (patch
has been applied already):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Enable automatic renewals in Administration > Circulation and fine
rules
3. Checkout an item to our patron and set due date in the past
4. cd into misc/cronjobs
5. Jump into koha-shell and run automatic_renewals.pl cronjob
sudo koha-shell <instancename>
./automatic_renewals.pl --confirm --send-notices
6. Observe in patron records 'Notices' tab there is a 'Auto renewals'
notice with type 'email'
7. Set 'FallbackToSMSIfNoEmail' syspref to 'Enable' and repeat steps
3,4,5,6 and observe the new 'Auto renewals' notice is type 'sms'

Test plan for amendment to misc/cronjobs/membership_expiry.pl (patch has
been applied already):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Set 'MembershipExpiryDaysNotice' to '1'
3. Edit our patrons record setting 'Expiry date' to 1 day in future
4. cd to misc/cronjobs directory
5. Jump into koha-shell and run membership_expiry.pl cronjob:
sudo koha-shell <instancename>
./membership_expiry.pl -c
6. Visit the patron record's 'Notices' tab and observe 'Account
expiration' notice with type 'email'
7. Change 'FallbackToSMSIfNoEmail' syspref to 'Enable'
8. Reset patrons epxiration date to 1 day in future
9. Repeat step 4,5,6 and observe new 'Account expiration' notice is type
'sms'

Test plan for opac/opac-shareshelf.pl (patch has been applied already):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Set 'OpacAllowSharingPrivateLists' syspref to 'Allow'
3. Ensure OPACBaseURL is set
4. In OPAC log in as the patron with set smsalertnumber and no email
5. Create a private list, select 'Share' link, input email
address and submit
6. Back in staff client make a new patron record
7. Return to OPAC and login as patron from step #5
8. Query database:
select content from message_queue where letter_code='SHARE_INVITE';
9. Click on the link in the message_queue notice
10. OPAC loads
11. Query database again:
select to_address, message_transport_type from
message_queue where letter_code='SHARE_ACCEPT';
12. Observe there is no 'Share on list <listname> accepted' notice
13. Set 'FallbackToSMSIfNoEmail' to 'Enable' and repeat steps 4,5,7,8,
9,10,11,12 and observe there is a 'Share on list <listname> accepted'
notice with to_address = smsalertnumber and message_transport_type is 'sms'

14. Set 'FallbackToSMSIfNoEmail' to 'disable' and edit the patron with
smsalertnumber set and no email setting an email address and repeat
steps 4,5,7,8,9,10,11,12 and observe there is a 'Share on list
<listname> accepted' notice with the to_address of the email you set and
message_transport_type of 'email'

Sponsored-by: Catalyst IT
Comment 2 Alex Buckley 2020-04-23 01:31:02 UTC
Created attachment 103526 [details] [review]
Bug 21781: Fallback to SMS if no email address where email address hardcoded

Extend use of FallbackToSMSIfNoEmail syspref to fallback to SMS if no
patron email address outside of it's current usage sending suggestion
notices.

Test plan for C4/Acquisition.pm:
1. Input a value into SMSSendDriver syspref
2. Create a patron with sms (under Member messaging preferences) and no email address
3. In Acquistions module make currency, active budget, fund, vendor
4. Create a basket
5. Add to basket. Click to add 'From a new (empty) record'
6. Under 'Patrons' header add a user and search for your patron (added
in #1)
7. Submit new order
8. Receive the order:
'Close this basket'
'Receive shipment'
Submit invoice page
Select 'Receive' link on right hand side of page
Tick checkbox to add 1 quantity of item and Save
9. Revisit your patrons page and in the 'Notices' tab you'll see a
'Order received' notice with type of 'email'
11. Apply patch and restart plack
12. Repeat steps 4-9 and observe the 'Order received' notice has a type
of SMS

Test plan for amendment to circ/pendingreserves.pl (patch has been
applied in 'Test plan for C4/Acquisition.pm):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Set CanMarkHoldsToPullAsLost  syspref to 'Allow to mark items as lost
and notify the patron'
3. Using the patron from test plan for C4/Acquisitions.pm (i.e. sms alert
number and no email) place a hold on an item currently available
4. Visit Circulation > Holds to pull
5. Select 'Mark lost and notify patron'
6. Return to patron page look in 'Notices' tab and observe 'Hold has
been cancelled' notice has type of 'email'
7. Change 'FallbackToSMSIfNoEmail' to 'Enable' and repeat steps 3,4,5,6
and observe the new 'Hold has been cancelled' notice has type 'sms'

Test plan for amendment to misc/cronjobs/automatic_renewals.pl (patch
has been applied already):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Enable automatic renewals in Administration > Circulation and fine
rules
3. Checkout an item to our patron and set due date in the past
4. cd into misc/cronjobs
5. Jump into koha-shell and run automatic_renewals.pl cronjob
sudo koha-shell <instancename>
./automatic_renewals.pl --confirm --send-notices
6. Observe in patron records 'Notices' tab there is a 'Auto renewals'
notice with type 'email'
7. Set 'FallbackToSMSIfNoEmail' syspref to 'Enable' and repeat steps
3,4,5,6 and observe the new 'Auto renewals' notice is type 'sms'

Test plan for amendment to misc/cronjobs/membership_expiry.pl (patch has
been applied already):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Set 'MembershipExpiryDaysNotice' to '1'
3. Edit our patrons record setting 'Expiry date' to 1 day in future
4. cd to misc/cronjobs directory
5. Jump into koha-shell and run membership_expiry.pl cronjob:
sudo koha-shell <instancename>
./membership_expiry.pl -c
6. Visit the patron record's 'Notices' tab and observe 'Account
expiration' notice with type 'email'
7. Change 'FallbackToSMSIfNoEmail' syspref to 'Enable'
8. Reset patrons epxiration date to 1 day in future
9. Repeat step 4,5,6 and observe new 'Account expiration' notice is type
'sms'

Test plan for opac/opac-shareshelf.pl (patch has been applied already):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Set 'OpacAllowSharingPrivateLists' syspref to 'Allow'
3. Ensure OPACBaseURL is set
4. In OPAC log in as the patron with set smsalertnumber and no email
5. Create a private list, select 'Share' link, input email
address and submit
6. Back in staff client make a new patron record
7. Return to OPAC and login as patron from step #5
8. Query database:
select content from message_queue where letter_code='SHARE_INVITE';
9. Click on the link in the message_queue notice
10. OPAC loads
11. Query database again:
select to_address, message_transport_type from
message_queue where letter_code='SHARE_ACCEPT';
12. Observe there is no 'Share on list <listname> accepted' notice
13. Set 'FallbackToSMSIfNoEmail' to 'Enable' and repeat steps 4,5,7,8,
9,10,11,12 and observe there is a 'Share on list <listname> accepted'
notice with to_address = smsalertnumber and message_transport_type is 'sms'

14. Set 'FallbackToSMSIfNoEmail' to 'disable' and edit the patron with
smsalertnumber set and no email setting an email address and repeat
steps 4,5,7,8,9,10,11,12 and observe there is a 'Share on list
<listname> accepted' notice with the to_address of the email you set and
message_transport_type of 'email'

Sponsored-by: Catalyst IT
Comment 3 Alex Buckley 2020-04-23 01:34:19 UTC
Hi all, 

I've attached a patch which extends the use of FallbackToSMSIfNoEmail syspref to the following files which Martin noted:

* opac/opac-shareshelf.pl
* misc/cronjobs/membership_expiry.pl
* misc/cronjobs/automatic_renewals.pl
* circ/pendingreserves.pl
* C4/Acquisition.pm

I've included an individual test plan for each of these files to test the changes. The individual test plans are sequential though, so you can start testing 'Test plan for C4/Acquisition.pm' where you apply the patch and then you keep it applied through all the other test plans. 

The following files I have not included for the following rationale, very happy to discuss if you disagree :)

* opac/svc/checkout_notes -> Sends 'CHECKOUT_NOTE' notice to library inbound email address if AllowCheckoutNotes
* opac/opac-issue-note.pl -> ditto
* opac/opac-memberentry.pl -> Sends 'OPAC_REG_VERIFY' notice to entered email address, defining sms address should be on separate bug report
* opac/opac-shareshelf.pl -> One of 2 hardcoded message_transport_types I have made. Regarding unchanged one this is unchanged as 'SHARE_INVITE' notice sent to inputted sharee email address.
Defining sharee sms number should be different bug report
* circ/article-request-slip.pl -> Hardcoded message_transport_type of 'print' on master
* C4/Reserves.pm -> Sends 'HOLDPLACED' notice to library inbound email address if 'emailLibrarianWhenHoldIsPlaced' syspref is enabled
* misc/cronjobs/stockrotation.pl -> Sends 'SR_SLIP' stock rotation report notice to library inbound email address or KohaAdminEmailAddress 
* Koha/ArticleRequests.pm -> No longer contains notice being queued
* Koha/Patron/Password/Recovery.pm -> Hardcoded message_transport_type for 'PASSWORD_RESET' is requiring email from OpacResetPassword syspref
*  Koha/Account.pm -> Requires email to be hardcoded as only run if UseEmailReceipts is enabled

Thanks,
Alex
Comment 4 Alex Buckley 2020-04-23 02:31:08 UTC
*** Bug 21776 has been marked as a duplicate of this bug. ***
Comment 5 Alex Buckley 2020-05-25 20:57:30 UTC
Created attachment 105328 [details] [review]
Bug 21781: Fallback to SMS if no email address where email address hardcoded

Extend use of FallbackToSMSIfNoEmail syspref to fallback to SMS if no
patron email address outside of it's current usage sending suggestion
notices.

Test plan for C4/Acquisition.pm:
1. Input a value into SMSSendDriver syspref
2. Create a patron with sms (under Member messaging preferences) and no email address
3. In Acquistions module make currency, active budget, fund, vendor
4. Create a basket
5. Add to basket. Click to add 'From a new (empty) record'
6. Under 'Patrons' header add a user and search for your patron (added
in #1)
7. Submit new order
8. Receive the order:
'Close this basket'
'Receive shipment'
Submit invoice page
Select 'Receive' link on right hand side of page
Tick checkbox to add 1 quantity of item and Save
9. Revisit your patrons page and in the 'Notices' tab you'll see a
'Order received' notice with type of 'email'
11. Apply patch and restart plack
12. Repeat steps 4-9 and observe the 'Order received' notice has a type
of SMS

Test plan for amendment to circ/pendingreserves.pl (patch has been
applied in 'Test plan for C4/Acquisition.pm):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Set CanMarkHoldsToPullAsLost  syspref to 'Allow to mark items as lost
and notify the patron'
3. Using the patron from test plan for C4/Acquisitions.pm (i.e. sms alert
number and no email) place a hold on an item currently available
4. Visit Circulation > Holds to pull
5. Select 'Mark lost and notify patron'
6. Return to patron page look in 'Notices' tab and observe 'Hold has
been cancelled' notice has type of 'email'
7. Change 'FallbackToSMSIfNoEmail' to 'Enable' and repeat steps 3,4,5,6
and observe the new 'Hold has been cancelled' notice has type 'sms'

Test plan for amendment to misc/cronjobs/automatic_renewals.pl (patch
has been applied already):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Enable automatic renewals in Administration > Circulation and fine
rules
3. Checkout an item to our patron and set due date in the past
4. cd into misc/cronjobs
5. Jump into koha-shell and run automatic_renewals.pl cronjob
sudo koha-shell <instancename>
./automatic_renewals.pl --confirm --send-notices
6. Observe in patron records 'Notices' tab there is a 'Auto renewals'
notice with type 'email'
7. Set 'FallbackToSMSIfNoEmail' syspref to 'Enable' and repeat steps
3,4,5,6 and observe the new 'Auto renewals' notice is type 'sms'

Test plan for amendment to misc/cronjobs/membership_expiry.pl (patch has
been applied already):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Set 'MembershipExpiryDaysNotice' to '1'
3. Edit our patrons record setting 'Expiry date' to 1 day in future
4. cd to misc/cronjobs directory
5. Jump into koha-shell and run membership_expiry.pl cronjob:
sudo koha-shell <instancename>
./membership_expiry.pl -c
6. Visit the patron record's 'Notices' tab and observe 'Account
expiration' notice with type 'email'
7. Change 'FallbackToSMSIfNoEmail' syspref to 'Enable'
8. Reset patrons epxiration date to 1 day in future
9. Repeat step 4,5,6 and observe new 'Account expiration' notice is type
'sms'

Test plan for opac/opac-shareshelf.pl (patch has been applied already):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Set 'OpacAllowSharingPrivateLists' syspref to 'Allow'
3. Ensure OPACBaseURL is set
4. In OPAC log in as the patron with set smsalertnumber and no email
5. Create a private list, select 'Share' link, input email
address and submit
6. Back in staff client make a new patron record
7. Return to OPAC and login as patron from step #5
8. Query database:
select content from message_queue where letter_code='SHARE_INVITE';
9. Click on the link in the message_queue notice
10. OPAC loads
11. Query database again:
select to_address, message_transport_type from
message_queue where letter_code='SHARE_ACCEPT';
12. Observe there is no 'Share on list <listname> accepted' notice
13. Set 'FallbackToSMSIfNoEmail' to 'Enable' and repeat steps 4,5,7,8,
9,10,11,12 and observe there is a 'Share on list <listname> accepted'
notice with to_address = smsalertnumber and message_transport_type is 'sms'

14. Set 'FallbackToSMSIfNoEmail' to 'disable' and edit the patron with
smsalertnumber set and no email setting an email address and repeat
steps 4,5,7,8,9,10,11,12 and observe there is a 'Share on list
<listname> accepted' notice with the to_address of the email you set and
message_transport_type of 'email'

Sponsored-by: Catalyst IT
Comment 6 Alex Buckley 2020-05-25 20:57:50 UTC
Rebased against master.
Comment 7 Alex Buckley 2020-09-02 21:20:54 UTC
Created attachment 109559 [details] [review]
Bug 21781: Fallback to SMS if no email address where email address hardcoded

Extend use of FallbackToSMSIfNoEmail syspref to fallback to SMS if no
patron email address outside of it's current usage sending suggestion
notices.

Test plan for C4/Acquisition.pm:
1. Input a value into SMSSendDriver syspref
2. Create a patron with sms (under Member messaging preferences) and no email address
3. In Acquistions module make currency, active budget, fund, vendor
4. Create a basket
5. Add to basket. Click to add 'From a new (empty) record'
6. Under 'Patrons' header add a user and search for your patron (added
in #1)
7. Submit new order
8. Receive the order:
'Close this basket'
'Receive shipment'
Submit invoice page
Select 'Receive' link on right hand side of page
Tick checkbox to add 1 quantity of item and Save
9. Revisit your patrons page and in the 'Notices' tab you'll see a
'Order received' notice with type of 'email'
11. Apply patch and restart plack
12. Repeat steps 4-9 and observe the 'Order received' notice has a type
of SMS

Test plan for amendment to circ/pendingreserves.pl (patch has been
applied in 'Test plan for C4/Acquisition.pm):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Set CanMarkHoldsToPullAsLost  syspref to 'Allow to mark items as lost
and notify the patron'
3. Using the patron from test plan for C4/Acquisitions.pm (i.e. sms alert
number and no email) place a hold on an item currently available
4. Visit Circulation > Holds to pull
5. Select 'Mark lost and notify patron'
6. Return to patron page look in 'Notices' tab and observe 'Hold has
been cancelled' notice has type of 'email'
7. Change 'FallbackToSMSIfNoEmail' to 'Enable' and repeat steps 3,4,5,6
and observe the new 'Hold has been cancelled' notice has type 'sms'

Test plan for amendment to misc/cronjobs/automatic_renewals.pl (patch
has been applied already):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Enable automatic renewals in Administration > Circulation and fine
rules
3. Checkout an item to our patron and set due date in the past
4. cd into misc/cronjobs
5. Jump into koha-shell and run automatic_renewals.pl cronjob
sudo koha-shell <instancename>
./automatic_renewals.pl --confirm --send-notices
6. Observe in patron records 'Notices' tab there is a 'Auto renewals'
notice with type 'email'
7. Set 'FallbackToSMSIfNoEmail' syspref to 'Enable' and repeat steps
3,4,5,6 and observe the new 'Auto renewals' notice is type 'sms'

Test plan for amendment to misc/cronjobs/membership_expiry.pl (patch has
been applied already):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Set 'MembershipExpiryDaysNotice' to '1'
3. Edit our patrons record setting 'Expiry date' to 1 day in future
4. cd to misc/cronjobs directory
5. Jump into koha-shell and run membership_expiry.pl cronjob:
sudo koha-shell <instancename>
./membership_expiry.pl -c
6. Visit the patron record's 'Notices' tab and observe 'Account
expiration' notice with type 'email'
7. Change 'FallbackToSMSIfNoEmail' syspref to 'Enable'
8. Reset patrons epxiration date to 1 day in future
9. Repeat step 4,5,6 and observe new 'Account expiration' notice is type
'sms'

Test plan for opac/opac-shareshelf.pl (patch has been applied already):
1. Set 'FallbackToSMSIfNoEmail' syspref to 'Disable'
2. Set 'OpacAllowSharingPrivateLists' syspref to 'Allow'
3. Ensure OPACBaseURL is set
4. In OPAC log in as the patron with set smsalertnumber and no email
5. Create a private list, select 'Share' link, input email
address and submit
6. Back in staff client make a new patron record
7. Return to OPAC and login as patron from step #5
8. Query database:
select content from message_queue where letter_code='SHARE_INVITE';
9. Click on the link in the message_queue notice
10. OPAC loads
11. Query database again:
select to_address, message_transport_type from
message_queue where letter_code='SHARE_ACCEPT';
12. Observe there is no 'Share on list <listname> accepted' notice
13. Set 'FallbackToSMSIfNoEmail' to 'Enable' and repeat steps 4,5,7,8,
9,10,11,12 and observe there is a 'Share on list <listname> accepted'
notice with to_address = smsalertnumber and message_transport_type is 'sms'

14. Set 'FallbackToSMSIfNoEmail' to 'disable' and edit the patron with
smsalertnumber set and no email setting an email address and repeat
steps 4,5,7,8,9,10,11,12 and observe there is a 'Share on list
<listname> accepted' notice with the to_address of the email you set and
message_transport_type of 'email'

Sponsored-by: Catalyst IT
Comment 8 Alex Buckley 2020-09-02 21:21:11 UTC
Rebased against master
Comment 9 Alex Buckley 2020-10-26 06:37:40 UTC
Patches still apply cleanly on master.
Comment 10 Martin Renvoize (ashimema) 2021-04-21 11:20:24 UTC
This may need updating for the new `queue_message` method added with bug 15986.

I like the idea of a migration to using 'queue_message' for all message queuing operations and thus centralising the fallback system for message transport types.
Comment 11 Andrew Fuerste-Henry 2021-08-27 18:15:59 UTC
I got a couple of small merge errors here. I managed to apply the patches, but something in pendingreseves is still mad. I get this error when I try to go to Holds to Pull as part of your Test plan for amendment to circ/pendingreserves.pl:


Could not compile /kohadevbox/koha/circ/pendingreserves.pl: Global symbol "$admin_email_address" requires explicit package name (did you forget to declare "my $admin_email_address"?) at /kohadevbox/koha/circ/pendingreserves.pl line 95.
BEGIN not safe after errors--compilation aborted at /kohadevbox/koha/circ/pendingreserves.pl line 315.
Comment 12 Andrew Fuerste-Henry 2021-08-27 18:25:31 UTC
Also running into issues with auto-renew notices, probably due to changes made in bug 18532. That added messaging preferences for auto-renew notices. Might that mean we should remove them from this bug? Since now patrons/libraries are more explicitly choosing how they want auto-renews sent?

With the patch applied right now, I have FallbackToSMSIfNoEmail turned off, my patron has an SMS number but no email address, and their messaging prefs say to send auto-renew as an email only. When I run the cron, my patron gets an SMS. So that's not right.

For what it's worth, the acq and membership expiry notices worked as described. I didn't test the list share.
Comment 13 Kyle M Hall (khall) 2021-09-14 17:31:28 UTC
Created attachment 124868 [details] [review]
Bug 21781 - message_transport_type should allow fallbacks
Comment 14 Kyle M Hall (khall) 2021-09-14 17:36:17 UTC
Created attachment 124869 [details] [review]
Bug 21781 - message_transport_type should allow fallbacks
Comment 15 Liz Rea 2023-07-28 18:29:22 UTC
has anyone tested the latest patches here? setting this to needs signoff so we can make sure the patches still don't apply.
Comment 16 David Nind 2023-12-31 22:27:24 UTC
(In reply to Liz Rea from comment #15)
> has anyone tested the latest patches here? setting this to needs signoff so
> we can make sure the patches still don't apply.

The patch no longer applies 8-(...

git bz apply 21781

Bug 21781 - message_transport_type should allow fallbacks

124869 - Bug 21781 - message_transport_type should allow fallbacks

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 21781 - message_transport_type should allow fallbacks
Using index info to reconstruct a base tree...
M	C4/Acquisition.pm
M	C4/Suggestions.pm
M	Koha/Patron.pm
M	circ/pendingreserves.pl
M	koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
M	misc/cronjobs/membership_expiry.pl
M	opac/opac-shareshelf.pl
Falling back to patching base and 3-way merge...
Auto-merging opac/opac-shareshelf.pl
Auto-merging misc/cronjobs/membership_expiry.pl
CONFLICT (content): Merge conflict in misc/cronjobs/membership_expiry.pl
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
Auto-merging circ/pendingreserves.pl
Auto-merging Koha/Patron.pm
Auto-merging C4/Suggestions.pm
Auto-merging C4/Acquisition.pm
error: Failed to merge in the changes.
Patch failed at 0001 Bug 21781 - message_transport_type should allow fallbacks
Comment 17 Martin Renvoize (ashimema) 2024-06-27 14:34:52 UTC
Created attachment 168199 [details] [review]
Bug 21781 - message_transport_type should allow fallbacks
Comment 18 Martin Renvoize (ashimema) 2024-06-27 14:53:48 UTC
Created attachment 168200 [details] [review]
Bug 21781: Apply message_transport_type fallbacks to more locations

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 19 Martin Renvoize (ashimema) 2024-06-27 14:53:51 UTC
Created attachment 168201 [details] [review]
Bug 21781: (follow-up) Use SMS templates

We shouldn't only be changing the message transport type for the enqueue
function but also for the call to GetPreparedLetter.. otherwise we'll
just be putting what may be an innapropriately formatted for email
notice into an SMS message.

This patch updates all the occurences touched by the patchset to use the
SMS notice template when we're falling back to SMS for transport medium.

We also drop the fallback for the expiry notice, as a bug has since
introduced functionality to send to both email and sms for that notice.
Comment 20 Martin Renvoize (ashimema) 2024-06-27 15:12:44 UTC
I still think the long term goal should be to further improve Koha::Patron->queue_notice and then use that wherever we can.. but this is an OK intermediate step in my opinion.
Comment 21 Lucas Gass (lukeg) 2024-09-24 16:14:40 UTC
Martin, do you think it would be a good idea to have some tests to cover these changes?