Bugzilla – Attachment 168201 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: (follow-up) Use SMS templates
Bug-21781-follow-up-Use-SMS-templates.patch (text/plain), 8.52 KB, created by
Martin Renvoize (ashimema)
on 2024-06-27 14:53:51 UTC
(
hide
)
Description:
Bug 21781: (follow-up) Use SMS templates
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-06-27 14:53:51 UTC
Size:
8.52 KB
patch
obsolete
>From 9bb74de1bbb814cb04838793ebd636c47733513d Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 27 Jun 2024 15:50:13 +0100 >Subject: [PATCH] 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. >--- > C4/Acquisition.pm | 38 ++++++++++++++++-------------- > circ/pendingreserves.pl | 23 ++++++++++-------- > misc/cronjobs/membership_expiry.pl | 14 ++++++----- > opac/opac-shareshelf.pl | 18 +++++++------- > 4 files changed, 51 insertions(+), 42 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 1ef07090b04..34b61ead09f 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -2858,30 +2858,32 @@ sub NotifyOrderUsers { > my @borrowernumbers = GetOrderUsers($ordernumber); > return unless @borrowernumbers; > >- my $order = GetOrder( $ordernumber ); >+ my $order = GetOrder($ordernumber); > for my $borrowernumber (@borrowernumbers) { >- my $patron = Koha::Patrons->find( $borrowernumber ); >+ my $patron = Koha::Patrons->find($borrowernumber); > my $library = $patron->library->unblessed; >- my $biblio = Koha::Biblios->find( $order->{biblionumber} )->unblessed; >- my $letter = C4::Letters::GetPreparedLetter( >- module => 'acquisition', >- letter_code => 'ACQ_NOTIF_ON_RECEIV', >- branchcode => $library->{branchcode}, >- lang => $patron->lang, >- tables => { >- 'branches' => $library, >- 'borrowers' => $patron->unblessed, >- 'biblio' => $biblio, >- 'aqorders' => $order, >+ my $biblio = Koha::Biblios->find( $order->{biblionumber} )->unblessed; >+ my $mtt = $patron->message_transport_type_for('email'); >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'acquisition', >+ letter_code => 'ACQ_NOTIF_ON_RECEIV', >+ branchcode => $library->{branchcode}, >+ message_transport_type => $mtt, >+ lang => $patron->lang, >+ tables => { >+ 'branches' => $library, >+ 'borrowers' => $patron->unblessed, >+ 'biblio' => $biblio, >+ 'aqorders' => $order, > }, > ); >- if ( $letter ) { >+ if ($letter) { > C4::Letters::EnqueueLetter( > { >- letter => $letter, >- borrowernumber => $borrowernumber, >- LibraryName => C4::Context->preference("LibraryName"), >- message_transport_type => $patron->message_transport_type_for('email'), >+ letter => $letter, >+ borrowernumber => $borrowernumber, >+ LibraryName => C4::Context->preference("LibraryName"), >+ message_transport_type => $mtt, > } > ) or warn "can't enqueue letter $letter"; > } >diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl >index 896779a6aa9..09169fcc4e8 100755 >--- a/circ/pendingreserves.pl >+++ b/circ/pendingreserves.pl >@@ -67,12 +67,14 @@ if ( $op eq 'cud-cancel_reserve' and $reserve_id ) { > C4::Circulation::LostItem( $item->itemnumber, "pendingreserves" ); > if ( $op eq 'cud-mark_as_lost_and_notify' and C4::Context->preference('CanMarkHoldsToPullAsLost') eq 'allow_and_notify' ) { > my $library = $hold->branch; >- my $letter = C4::Letters::GetPreparedLetter( >- module => 'reserves', >- letter_code => 'CANCEL_HOLD_ON_LOST', >- branchcode => $patron->branchcode, >- lang => $patron->lang, >- tables => { >+ my $mtt = $patron->message_transport_type_for('email'); >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'reserves', >+ letter_code => 'CANCEL_HOLD_ON_LOST', >+ branchcode => $patron->branchcode, >+ message_transport_type => $mtt, >+ lang => $patron->lang, >+ tables => { > branches => $library->branchcode, > borrowers => $patron->borrowernumber, > items => $item->itemnumber, >@@ -81,18 +83,19 @@ if ( $op eq 'cud-cancel_reserve' and $reserve_id ) { > reserves => $hold->unblessed, > }, > ); >- if ( $letter ) { >+ if ($letter) { > my $from_address = $library->from_email_address; > > C4::Letters::EnqueueLetter( >- { letter => $letter, >+ { >+ letter => $letter, > borrowernumber => $patron->borrowernumber, >- message_transport_type => $patron->message_transport_type_for('email'), >+ message_transport_type => $mtt, > from_address => $from_address, > } > ); > unless ( $patron->notice_email_address ) { >- push @messages, {type => 'alert', code => 'no_email_address', }; >+ push @messages, { type => 'alert', code => 'no_email_address', }; > } > push @messages, { type => 'message', code => 'letter_enqueued' }; > } else { >diff --git a/misc/cronjobs/membership_expiry.pl b/misc/cronjobs/membership_expiry.pl >index e7703a82e4a..71294865876 100755 >--- a/misc/cronjobs/membership_expiry.pl >+++ b/misc/cronjobs/membership_expiry.pl >@@ -288,12 +288,14 @@ while ( my $recent = $upcoming_mem_expires->next ) { > next; > } > >- C4::Letters::EnqueueLetter({ >- letter => $letter, >- borrowernumber => $recent->borrowernumber, >- from_address => $from_address, >- message_transport_type => $recent->message_transport_type_for('email'), >- }); >+ C4::Letters::EnqueueLetter( >+ { >+ letter => $letter, >+ borrowernumber => $recent->borrowernumber, >+ from_address => $from_address, >+ message_transport_type => 'email', >+ } >+ ); > $count_enqueued++; > > if ($recent->smsalertnumber) { >diff --git a/opac/opac-shareshelf.pl b/opac/opac-shareshelf.pl >index 8b5524ca599..3b415439d33 100755 >--- a/opac/opac-shareshelf.pl >+++ b/opac/opac-shareshelf.pl >@@ -190,13 +190,15 @@ sub notify_owner { > my $toaddr = $patron->notice_email_address or return; > > #prepare letter >+ my $mtt = $patron->message_transport_type_for('email'); > my $letter = C4::Letters::GetPreparedLetter( >- module => 'members', >- letter_code => 'SHARE_ACCEPT', >- branchcode => C4::Context->userenv->{"branch"}, >- lang => $patron->lang, >- tables => { borrowers => $loggedinuser, }, >- substitute => { listname => $param->{shelfname}, }, >+ module => 'members', >+ letter_code => 'SHARE_ACCEPT', >+ branchcode => C4::Context->userenv->{"branch"}, >+ message_transport_type => $mtt, >+ lang => $patron->lang, >+ tables => { borrowers => $loggedinuser, }, >+ substitute => { listname => $param->{shelfname}, }, > ); > > #send letter to queue >@@ -204,8 +206,8 @@ sub notify_owner { > { > letter => $letter, > message_transport_type => 'email', >- from_address => C4::Context->preference('KohaAdminEmailAddress'), >- message_transport_type => $patron->message_transport_type_for('email'), >+ from_address => C4::Context->preference('KohaAdminEmailAddress'), >+ message_transport_type => $mtt, > } > ); > } >-- >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