Bugzilla – Attachment 124869 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 - message_transport_type should allow fallbacks
Bug-21781---messagetransporttype-should-allow-fall.patch (text/plain), 5.15 KB, created by
Kyle M Hall (khall)
on 2021-09-14 17:36:17 UTC
(
hide
)
Description:
Bug 21781 - message_transport_type should allow fallbacks
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-09-14 17:36:17 UTC
Size:
5.15 KB
patch
obsolete
>From b2fcaffc551898d57d93c69dbf1f8750156e2c0c 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 - message_transport_type should allow fallbacks > >--- > C4/Acquisition.pm | 2 +- > C4/Suggestions.pm | 2 +- > 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(+), 7 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 3d74f847a6..a0b24c7c69 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -3017,7 +3017,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 ba72a1888a..ed9ca184c3 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -481,7 +481,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 941dace0df..5be69ad831 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1273,6 +1273,28 @@ sub first_valid_email_address { > return $self->email() || $self->emailpro() || $self->B_email() || q{}; > } > >+=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 0b2fea2195..beaaa15480 100755 >--- a/circ/pendingreserves.pl >+++ b/circ/pendingreserves.pl >@@ -89,7 +89,7 @@ if ( $op eq '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 5a6f1bd5a4..20ff3809d6 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 >@@ -198,7 +198,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 41003674e2..b4e8cb54dc 100755 >--- a/misc/cronjobs/membership_expiry.pl >+++ b/misc/cronjobs/membership_expiry.pl >@@ -225,9 +225,9 @@ while ( my $recent = $upcoming_mem_expires->next ) { > } else { > 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'), > }); > } > } >diff --git a/opac/opac-shareshelf.pl b/opac/opac-shareshelf.pl >index 701871bafc..16d8caef2a 100755 >--- a/opac/opac-shareshelf.pl >+++ b/opac/opac-shareshelf.pl >@@ -182,7 +182,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.30.1 (Apple Git-130)
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