Bugzilla – Attachment 47235 Details for
Bug 15647
Allow selection of destination email address for print overdue notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15647: Allow selection of destination email address for print overdue notices
Bug-15647-Allow-selection-of-destination-email-add.patch (text/plain), 7.14 KB, created by
Jesse Weaver
on 2016-01-23 00:04:56 UTC
(
hide
)
Description:
Bug 15647: Allow selection of destination email address for print overdue notices
Filename:
MIME Type:
Creator:
Jesse Weaver
Created:
2016-01-23 00:04:56 UTC
Size:
7.14 KB
patch
obsolete
>From e35fdbb5bbbdcd805b7b6f67986b76d6ffa4b712 Mon Sep 17 00:00:00 2001 >From: Jesse Weaver <jweaver@bywatersolutions.com> >Date: Fri, 22 Jan 2016 16:58:13 -0700 >Subject: [PATCH] Bug 15647: Allow selection of destination email address for > print overdue notices > >Test plan: > > * Verify that, after patch, print overdue notices are still sent to > branchemail/KohaAdminEmailAddress as appropriate. > * Change PrintNoticesEmailField to reply-to/return-path, and check > that branchreplyto/ReplytoDefault or > branchreturnpath/ReturnpathDefault (respectively) are used instead. >--- > Koha/Library.pm | 26 ++++++++++++++++++++++ > ...ug_15647-add_syspref_PrintNoticesEmailField.sql | 1 + > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/admin.pref | 9 ++++++++ > misc/cronjobs/overdue_notices.pl | 11 ++++----- > 5 files changed, 43 insertions(+), 5 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_15647-add_syspref_PrintNoticesEmailField.sql > >diff --git a/Koha/Library.pm b/Koha/Library.pm >index 7420c6a..ddfe962 100644 >--- a/Koha/Library.pm >+++ b/Koha/Library.pm >@@ -21,6 +21,7 @@ use Modern::Perl; > > use Carp; > >+use C4::Context; > use Koha::Database; > > use base qw(Koha::Object); >@@ -54,6 +55,31 @@ sub add_to_categories { > } > } > >+=head3 print_notice_email >+ >+Looks up the effective print notice destination email, based on PrintNoticesEmailField. >+ >+=cut >+ >+sub print_notice_email { >+ my ( $self ) = @_; >+ >+ my $syspref = 'KohaAdminEmailAddress'; >+ my $branchfield = 'branchemail'; >+ >+ if ( C4::Context->preference('PrintNoticesEmailField') eq 'replyto' ) { >+ $syspref = 'ReplytoDefault'; >+ $branchfield = 'branchreplyto'; >+ } elsif ( C4::Context->preference('PrintNoticesEmailField') eq 'returnpath' ) { >+ $syspref = 'ReturnpathDefault'; >+ $branchfield = 'branchreturnpath'; >+ } >+ >+ return $self->_result->get_column($branchfield) || >+ C4::Context->preference($syspref) || >+ C4::Context->preference('KohaAdminEmailAddress'); >+} >+ > =head3 type > > =cut >diff --git a/installer/data/mysql/atomicupdate/bug_15647-add_syspref_PrintNoticesEmailField.sql b/installer/data/mysql/atomicupdate/bug_15647-add_syspref_PrintNoticesEmailField.sql >new file mode 100644 >index 0000000..e8a3921 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_15647-add_syspref_PrintNoticesEmailField.sql >@@ -0,0 +1 @@ >+INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('PrintNoticesEmailField','email','email|replyto|returnpath','Send print notices to the email address in the given branch field/syspref.','Choice'); >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index aa53139..36828a3 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -373,6 +373,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'), > ('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'), > ('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'), >+('PrintNoticesEmailField','email','email|replyto|returnpath','Send print notices to the email address in the given branch field/syspref.','Choice'), > ('QueryAutoTruncate','1',NULL,'If ON, query truncation is enabled by default','YesNo'), > ('QueryFuzzy','1',NULL,'If ON, enables fuzzy option for searches','YesNo'), > ('QueryStemming','1',NULL,'If ON, enables query stemming','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >index 0f3b66c..a8d06af 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >@@ -17,6 +17,15 @@ Administration: > class: email > - "as the return path or bounce address for undeliverable mail messages. If you leave this empty, the From address will be used (often defaulting to the admin address)." > - >+ - Sent print notices to >+ - pref: PrintNoticesEmailField >+ default: email >+ choices: >+ email: "the library's email or KohaAdminEmailAddress." >+ replyto: "the library's reply-to email or ReplytoDefault." >+ returnpath: "the library's return-path email or ReturnpathDefault." >+ - This currently only applies to print overdue notices. >+ - > - Show > - pref: DebugLevel > default: 0 >diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl >index 98b0a25..9dbff87 100755 >--- a/misc/cronjobs/overdue_notices.pl >+++ b/misc/cronjobs/overdue_notices.pl >@@ -46,6 +46,7 @@ use C4::Log; > use Koha::Borrower::Debarments qw(AddUniqueDebarment); > use Koha::DateUtils; > use Koha::Calendar; >+use Koha::Libraries; > > =head1 NAME > >@@ -439,9 +440,9 @@ foreach my $branchcode (@branches) { > } > } > >- my $branch_details = C4::Branch::GetBranchDetail($branchcode); >- my $admin_email_address = $branch_details->{'branchemail'} >- || C4::Context->preference('KohaAdminEmailAddress'); >+ my $library = Koha::Libraries->find($branchcode); >+ my $admin_email_address = $library->print_notice_email; >+ > my @output_chunks; # may be sent to mail or stdout or csv file. > > $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $admin_email_address; >@@ -680,7 +681,7 @@ END_SQL > branchcode => $branchcode, > items => \@items, > substitute => { # this appears to be a hack to overcome incomplete features in this code. >- bib => $branch_details->{'branchname'}, # maybe 'bib' is a typo for 'lib<rary>'? >+ bib => $library->branchname, # maybe 'bib' is a typo for 'lib<rary>'? > 'items.content' => $titles, > 'count' => $itemcount, > }, >@@ -714,7 +715,7 @@ END_SQL > city => $data->{'city'}, > phone => $data->{'phone'}, > cardnumber => $data->{'cardnumber'}, >- branchname => $branch_details->{'branchname'}, >+ branchname => $library->branchname, > letternumber => $i, > postcode => $data->{'zipcode'}, > country => $data->{'country'}, >-- >2.6.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 15647
: 47235