Bugzilla – Attachment 151536 Details for
Bug 31627
Add ability to embed the letter ID in outgoing email notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31627: Add ability to embed the letter id in outgoing email notices
Bug-31627-Add-ability-to-embed-the-letter-id-in-ou.patch (text/plain), 5.07 KB, created by
Sam Lau
on 2023-05-22 16:26:16 UTC
(
hide
)
Description:
Bug 31627: Add ability to embed the letter id in outgoing email notices
Filename:
MIME Type:
Creator:
Sam Lau
Created:
2023-05-22 16:26:16 UTC
Size:
5.07 KB
patch
obsolete
>From 34b5a540fe6f01e32831a7745ddd0578d0a0a929 Mon Sep 17 00:00:00 2001 >From: Kyle Hall <kyle@bywatersolutions.com> >Date: Mon, 26 Sep 2022 12:23:33 -0400 >Subject: [PATCH] Bug 31627: Add ability to embed the letter id in outgoing > email notices > >It can be useful to know exactly what template was used to generate a notice. To further this end, it would be useful be able to send the letter id as part of any emails sent out if there is a letter template associated with the message. > >Test Plan: >1) Apply this patch >2) Restart all the things! >3) Enable SendLetterIdInEmailNotices >4) Generate an email notice like a checkout notice >5) Note your email has the letter id at the bottom! > >Signed-off-by: Sam Lau <samalau@gmail.com> >--- > C4/Letters.pm | 4 +++- > installer/data/mysql/atomicupdate/bug_31627.pl | 14 ++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/patrons.pref | 6 ++++++ > 4 files changed, 24 insertions(+), 1 deletion(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_31627.pl > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 7100c4ea71..b904573df6 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -1267,7 +1267,7 @@ sub _get_unsent_messages { > > my $dbh = C4::Context->dbh(); > my $statement = qq{ >- SELECT mq.message_id, mq.borrowernumber, mq.subject, mq.content, mq.message_transport_type, mq.status, mq.time_queued, mq.from_address, mq.reply_address, mq.to_address, mq.content_type, b.branchcode, mq.letter_code, mq.failure_code >+ SELECT mq.message_id, mq.borrowernumber, mq.subject, mq.content, mq.message_transport_type, mq.status, mq.time_queued, mq.from_address, mq.reply_address, mq.to_address, mq.content_type, b.branchcode, mq.letter_code, mq.failure_code, mq.letter_id > FROM message_queue mq > LEFT JOIN borrowers b ON b.borrowernumber = mq.borrowernumber > WHERE status = ? >@@ -1416,8 +1416,10 @@ sub _send_message_by_email { > } else { > $email = Koha::Email->create($params); > if ($is_html) { >+ $content .= "<br/>$message->{letter_id}" if $message->{id} && C4::Context->preference('SendLetterIdInEmailNotices'); > $email->html_body( _wrap_html( $content, $subject ) ); > } else { >+ $content .= "\n$message->{letter_id}" if $message->{id} && C4::Context->preference('SendLetterIdInEmailNotices'); > $email->text_body($content); > } > } >diff --git a/installer/data/mysql/atomicupdate/bug_31627.pl b/installer/data/mysql/atomicupdate/bug_31627.pl >new file mode 100755 >index 0000000000..52c5621dd8 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_31627.pl >@@ -0,0 +1,14 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "31627", >+ description => "Add syspref SendLetterIdInEmailNotices", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ $dbh->do(q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('SendLetterIdInEmailNotices','0',NULL,'Add template id to bottom of emailed notices','YesNo') >+ }); >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 0a94701897..861081b6dc 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -660,6 +660,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'), > ('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'), > ('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'), >+('SendLetterIdInEmailNotices','0',NULL,'Add template id to bottom of emailed notices','YesNo'), > ('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'), > ('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'), > ('SessionRestrictionByIP','1','Check for change in remote IP address for session security. Disable only when remote IP address changes frequently.','','YesNo'), >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 b2ed2e5fe4..4a846a2ad6 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 >@@ -166,6 +166,12 @@ Patrons: > 1: Notify > 0: "Don't notify" > - patrons whenever their password is changed. >+ - >+ - pref: SendLetterIdInEmailNotices >+ choices: >+ 1: Add >+ 0: "Don't add" >+ - the template id for a notice to the bottom of any emailed notices. > - > - pref: UseEmailReceipts > choices: >-- >2.30.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 31627
:
140998
|
141025
|
142826
|
143022
|
151536
|
151537
|
155364
|
166374
|
166375
|
166376
|
166377
|
166378
|
166379
|
166399
|
166400
|
166401