Bugzilla – Attachment 168200 Details for
Bug 21781
message_transport_type should allow fallbacks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21781: Apply message_transport_type fallbacks to more locations
Bug-21781-Apply-messagetransporttype-fallbacks-to-.patch (text/plain), 5.20 KB, created by
Martin Renvoize (ashimema)
on 2024-06-27 14:53:48 UTC
(
hide
)
Description:
Bug 21781: Apply message_transport_type fallbacks to more locations
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-06-27 14:53:48 UTC
Size:
5.20 KB
patch
obsolete
>From 1af2a020b44793afce44a4ba69c673d7f6d15eb5 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 14 Sep 2021 13:31:09 -0400 >Subject: [PATCH] Bug 21781: Apply message_transport_type fallbacks to more > locations > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Acquisition.pm | 2 +- > C4/Suggestions.pm | 5 +---- > Koha/Patron.pm | 22 +++++++++++++++++++ > circ/pendingreserves.pl | 2 +- > .../en/modules/admin/preferences/patrons.pref | 2 +- > misc/cronjobs/membership_expiry.pl | 4 ++-- > opac/opac-shareshelf.pl | 2 +- > 7 files changed, 29 insertions(+), 10 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 6824bd86371..1ef07090b04 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -2881,7 +2881,7 @@ sub NotifyOrderUsers { > letter => $letter, > borrowernumber => $borrowernumber, > LibraryName => C4::Context->preference("LibraryName"), >- message_transport_type => 'email', >+ message_transport_type => $patron->message_transport_type_for('email'), > } > ) or warn "can't enqueue letter $letter"; > } >diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm >index ed3a19bcfda..d8491ced9d1 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -263,10 +263,7 @@ sub ModSuggestion { > > my $patron = Koha::Patrons->find( $full_suggestion->{suggestedby} ); > >- my $transport = >- ( C4::Context->preference("FallbackToSMSIfNoEmail") ) >- && ( $patron->smsalertnumber ) >- && ( !$patron->email ) ? 'sms' : 'email'; >+ my $transport = $patron->message_transport_type_for('email'); > > if ( > my $letter = C4::Letters::GetPreparedLetter( >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 1691c9d25b5..dd9c1762c38 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1686,6 +1686,28 @@ sub first_valid_email_address { > return $email; > } > >+=head3 message_transport_type_for >+ >+Given a message transport type, will return the transport type that should be used, >+including a fallback if needed. >+ >+my $mtt = $patron->message_transport_type_for('email'); >+ >+=cut >+ >+sub message_transport_type_for { >+ my ( $self, $mtt ) = @_; >+ >+ if ( $mtt eq 'email' ) { >+ return 'sms' >+ if C4::Context->preference("FallbackToSMSIfNoEmail") >+ && $self->smsalertnumber >+ && !$self->notice_email_address; >+ } >+ >+ return $mtt; >+} >+ > =head3 get_club_enrollments > > =cut >diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl >index 366d0009af7..896779a6aa9 100755 >--- a/circ/pendingreserves.pl >+++ b/circ/pendingreserves.pl >@@ -87,7 +87,7 @@ if ( $op eq 'cud-cancel_reserve' and $reserve_id ) { > C4::Letters::EnqueueLetter( > { letter => $letter, > borrowernumber => $patron->borrowernumber, >- message_transport_type => 'email', >+ message_transport_type => $patron->message_transport_type_for('email'), > from_address => $from_address, > } > ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index d2976e2d430..f0429f8e4bd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -261,7 +261,7 @@ Patrons: > choices: > 1: Enable > 0: Disable >- - sending purchase suggestion messages by SMS if no patron email is defined. >+ - sending notices by SMS if patron has no email address. > - > - "Send automatic renewal notices: " > - pref: AutoRenewalNotices >diff --git a/misc/cronjobs/membership_expiry.pl b/misc/cronjobs/membership_expiry.pl >index 3d0a53a05e1..e7703a82e4a 100755 >--- a/misc/cronjobs/membership_expiry.pl >+++ b/misc/cronjobs/membership_expiry.pl >@@ -290,9 +290,9 @@ while ( my $recent = $upcoming_mem_expires->next ) { > > C4::Letters::EnqueueLetter({ > letter => $letter, >- borrowernumber => $recent->borrowernumber, >+ borrowernumber => $recent->borrowernumber, > from_address => $from_address, >- message_transport_type => 'email', >+ message_transport_type => $recent->message_transport_type_for('email'), > }); > $count_enqueued++; > >diff --git a/opac/opac-shareshelf.pl b/opac/opac-shareshelf.pl >index 4cc2b690453..8b5524ca599 100755 >--- a/opac/opac-shareshelf.pl >+++ b/opac/opac-shareshelf.pl >@@ -205,7 +205,7 @@ sub notify_owner { > letter => $letter, > message_transport_type => 'email', > from_address => C4::Context->preference('KohaAdminEmailAddress'), >- to_address => $toaddr, >+ message_transport_type => $patron->message_transport_type_for('email'), > } > ); > } >-- >2.45.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21781
:
103525
|
103526
|
105328
|
109559
|
124868
|
124869
|
168199
| 168200 |
168201