Bugzilla – Attachment 75067 Details for
Bug 19191
Add ability to email receipts for account payments and write-offs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19191: Add ability to email receipts for account payments and write-offs
Bug-19191-Add-ability-to-email-receipts-for-accoun.patch (text/plain), 5.84 KB, created by
Kyle M Hall (khall)
on 2018-05-04 12:20:36 UTC
(
hide
)
Description:
Bug 19191: Add ability to email receipts for account payments and write-offs
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-05-04 12:20:36 UTC
Size:
5.84 KB
patch
obsolete
>From 2a047f50f2105bb1fcc89fb125ae876b79edf2ef Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatetsolutions.com> >Date: Fri, 12 Jan 2018 10:46:24 -0500 >Subject: [PATCH] Bug 19191: Add ability to email receipts for account payments > and write-offs > >Some libraries are paperless and require all payment receipts to be emailed. Koha should give libraries the option to send email receipts if a patron has an email address. If a notice for the type of "credit" exists ( payment or writeoff ), then an email receipt will be sent. > >These notices only support Template Toolkit syntax. > >Test Plan: >1) Apply this patch and dependencies >2) Add the two new notices, you can find them in installer/data/mysql/en/mandatory/sample_notices.sql >3) Note two new notices exist in the notices editor, ACCOUNT_PAYMENT and ACCOUNT_WRITEOFF >4) Find or create a patron with an email address that owes some amount of money >5) Make a payment for one or more fees >6) Note a new email is queued for the patron >7) Make a writeoff for one or more fees >8) Note a new new email is queued for the patron > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > Koha/Account.pm | 28 ++++++++++++++++++++++ > .../data/mysql/en/mandatory/sample_notices.sql | 5 ++++ > 2 files changed, 33 insertions(+) > >diff --git a/Koha/Account.pm b/Koha/Account.pm >index 493f4ac698..5d696535a9 100644 >--- a/Koha/Account.pm >+++ b/Koha/Account.pm >@@ -26,6 +26,7 @@ use List::MoreUtils qw( uniq ); > use C4::Log qw( logaction ); > use C4::Stats qw( UpdateStats ); > >+use Koha::Patrons; > use Koha::Account::Lines; > use Koha::Account::Offsets; > use Koha::DateUtils qw( dt_from_string ); >@@ -79,6 +80,8 @@ sub pay { > > my $userenv = C4::Context->userenv; > >+ my $patron = Koha::Patrons->find( $self->{patron_id} ); >+ > # We should remove accountno, it is no longer needed > my $last = Koha::Account::Lines->search( > { >@@ -260,6 +263,31 @@ sub pay { > ); > } > >+ require C4::Letters; >+ if ( >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'circulation', >+ letter_code => uc("ACCOUNT_$type"), >+ message_transport_type => 'email', >+ lang => Koha::Patrons->find( $self->{patron_id} )->lang, >+ objects => { >+ patron => scalar Koha::Patrons->find( $self->{patron_id} ), >+ library => scalar Koha::Libraries->find( $self->{library_id} ), >+ offsets => \@account_offsets, >+ credit => $payment, >+ }, >+ ) >+ ) >+ { >+ C4::Letters::EnqueueLetter( >+ { >+ letter => $letter, >+ borrowernumber => $self->{patron_id}, >+ message_transport_type => 'email', >+ } >+ ) or warn "can't enqueue letter $letter"; >+ } >+ > return $payment->id; > } > >diff --git a/installer/data/mysql/en/mandatory/sample_notices.sql b/installer/data/mysql/en/mandatory/sample_notices.sql >index eaaa073f6c..f467f57eae 100644 >--- a/installer/data/mysql/en/mandatory/sample_notices.sql >+++ b/installer/data/mysql/en/mandatory/sample_notices.sql >@@ -176,3 +176,8 @@ INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title` > ('circulation', 'AR_SLIP', '', 'Article request - print slip', 0, 'Article request', 'Article request:\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>),\r\n\r\nTitle: <<biblio.title>>\r\nBarcode: <<items.barcode>>\r\n\r\nArticle requested:\r\nTitle: <<article_requests.title>>\r\nAuthor: <<article_requests.author>>\r\nVolume: <<article_requests.volume>>\r\nIssue: <<article_requests.issue>>\r\nDate: <<article_requests.date>>\r\nPages: <<article_requests.pages>>\r\nChapters: <<article_requests.chapters>>\r\nNotes: <<article_requests.patron_notes>>\r\n', 'print'), > ('circulation', 'AR_PROCESSING', '', 'Article request - processing', 0, 'Article request processing', 'Dear <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>),\r\n\r\nWe are now processing your request for an article from <<biblio.title>> (<<items.barcode>>).\r\n\r\nArticle requested:\r\nTitle: <<article_requests.title>>\r\nAuthor: <<article_requests.author>>\r\nVolume: <<article_requests.volume>>\r\nIssue: <<article_requests.issue>>\r\nDate: <<article_requests.date>>\r\nPages: <<article_requests.pages>>\r\nChapters: <<article_requests.chapters>>\r\nNotes: <<article_requests.patron_notes>>\r\n\r\nThank you!', 'email'), > ('circulation', 'CHECKOUT_NOTE', '', 'Checkout note on item set by patron', '0', 'Checkout note', '<<borrowers.firstname>> <<borrowers.surname>> has added a note to the item <<biblio.title>> - <<biblio.author>> (<<biblio.biblionumber>>).','email'); >+ >+INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) >+ VALUES >+ ('circulation', 'ACCOUNT_PAYMENT', '', 'Account Payment', 0, 'Account Payment', '[%- USE Price -%]\r\nA payment of [% credit.amount * -1 | $Price %] has been applied to your account.\r\n\r\nThis payment affected the following fees:\r\n[%- FOREACH o IN offsets %]\r\nDescription: [% o.debit.description %]\r\nAmount paid: [% o.amount * -1 | $Price %]\r\nAmount remaining: [% o.debit.amountoutstanding | $Price %]\r\n[% END %]', 'email', 'default'), >+ ('circulation', 'ACCOUNT_WRITEOFF', '', 'Account Writeoff', 0, 'Account Writeoff', '[%- USE Price -%]\r\nAn account writeoff of [% credit.amount * -1 | $Price %] has been applied to your account.\r\n\r\nThis writeoff affected the following fees:\r\n[%- FOREACH o IN offsets %]\r\nDescription: [% o.debit.description %]\r\nAmount paid: [% o.amount * -1 | $Price %]\r\nAmount remaining: [% o.debit.amountoutstanding | $Price %]\r\n[% END %]', 'email', 'default'); >-- >2.15.1 (Apple Git-101)
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 19191
:
66554
|
68605
|
68812
|
70465
|
70466
|
70471
|
72366
|
72367
|
72370
|
73924
|
74092
|
74093
|
74094
|
74095
|
74104
|
74105
|
74423
|
74424
|
74504
|
74505
|
74506
|
74507
|
74508
|
74625
|
74626
|
74627
|
74628
|
74629
|
74630
|
74631
|
74686
|
75066
| 75067 |
75068
|
75069
|
75070
|
75071
|
75072
|
75093
|
75134