Bugzilla – Attachment 178677 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.44 KB, created by
Martin Renvoize (ashimema)
on 2025-02-25 13:04:06 UTC
(
hide
)
Description:
Bug 21781: Apply message_transport_type fallbacks to more locations
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-02-25 13:04:06 UTC
Size:
5.44 KB
patch
obsolete
>From 5cf9b08bc9f8304e8c77889dd3b5b0314e1701d1 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 | 6 +--- > Koha/Patron.pm | 32 ++++++++++++++++++- > circ/pendingreserves.pl | 2 +- > .../en/modules/admin/preferences/patrons.pref | 4 +-- > opac/opac-shareshelf.pl | 2 +- > 6 files changed, 37 insertions(+), 11 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index a81a6b9acd1..3dadeab028e 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -2933,7 +2933,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 154b2e845c7..26f03d8044e 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -269,10 +269,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( >@@ -452,4 +449,3 @@ __END__ > Koha Development Team <http://koha-community.org/> > > =cut >- >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index ec7f6704983..727b492c192 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1745,6 +1745,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 >@@ -2704,7 +2726,15 @@ sub queue_notice { > or ( $mtt eq 'phone' and not $self->phone ) ) > { > push @{ $return{fallback} }, $mtt; >- $mtt = 'print'; >+ if ( C4::Context->preference("FallbackToSMSIfNoEmail") >+ && $mtt eq 'email' >+ && $self->smsalertnumber >+ && !$self->notice_email_address ) >+ { >+ $mtt = 'sms'; >+ } else { >+ $mtt = 'print'; >+ } > } > next if $mtt eq 'print' && $print_sent; > $letter_params->{message_transport_type} = $mtt; >diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl >index 5ce792a1a91..a80762c3120 100755 >--- a/circ/pendingreserves.pl >+++ b/circ/pendingreserves.pl >@@ -90,7 +90,7 @@ if ( $op eq 'cud-cancel_reserve' and $reserve_id ) { > { > 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 671b4f4d416..2d76be732b7 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 >@@ -264,7 +264,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 >@@ -523,4 +523,4 @@ Patrons: > homebranch: "Home library" > location: "Location" > itemcallnumber: "Item's callnumber" >- ccode: "Collection" >+ ccode: "Collection" >\ No newline at end of file >diff --git a/opac/opac-shareshelf.pl b/opac/opac-shareshelf.pl >index c4dec0c18d6..faa1d0cff5c 100755 >--- a/opac/opac-shareshelf.pl >+++ b/opac/opac-shareshelf.pl >@@ -210,7 +210,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.48.1
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
| 178677 |
178678