From 2f8bed4bb019598069d5b499792d6256e87d7b89 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 2 Mar 2018 15:04:10 +0000 Subject: [PATCH] Bug 19191: Remove need for bug 19966 --- C4/Letters.pm | 14 ++++++++++++++ Koha/Account.pm | 14 +++++++++----- installer/data/mysql/en/mandatory/sample_notices.sql | 4 ++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index 219779b..4b0fcae 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -846,6 +846,8 @@ sub _parseletter_sth { ($table eq 'aqorders' ) ? "SELECT * FROM $table WHERE ordernumber = ?" : ($table eq 'opac_news' ) ? "SELECT * FROM $table WHERE idnew = ?" : ($table eq 'article_requests') ? "SELECT * FROM $table WHERE id = ?" : + ($table eq 'account_offsets') ? "SELECT * FROM $table WHERE id = ?" : + ($table eq 'accountlines') ? "SELECT * FROM $table WHERE accountlines_id = ?" : ($table eq 'borrower_modifications') ? "SELECT * FROM $table WHERE verification_token = ?" : ($table eq 'subscription') ? "SELECT * FROM $table WHERE subscriptionid = ?" : ($table eq 'serial') ? "SELECT * FROM $table WHERE serialid = ?" : @@ -1582,6 +1584,18 @@ sub _get_tt_params { plural => 'patron_modifications', fk => 'verification_token', }, + account_offsets => { + module => 'Koha::Account::Offsets', + singular => 'account_offset', + plural => 'account_offsets', + pk => 'id', + }, + accountlines => { + module => 'Koha::Account::Lines', + singular => 'accountline', + plural => 'accountlines', + pk => 'accountlines_id', + }, }; foreach my $table ( keys %$tables ) { diff --git a/Koha/Account.pm b/Koha/Account.pm index 7d62591..ecf6d1e 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -268,12 +268,16 @@ sub pay { 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, + tables => { + borrowers => $self->{patron_id}, + branches => $self->{library_id}, }, + substitute => { + credit => $payment, + }, + loops => { + account_offsets => [ map { $_->id } @account_offsets ], + } ) ) { diff --git a/installer/data/mysql/en/mandatory/sample_notices.sql b/installer/data/mysql/en/mandatory/sample_notices.sql index bc5102f..7302ef1 100644 --- a/installer/data/mysql/en/mandatory/sample_notices.sql +++ b/installer/data/mysql/en/mandatory/sample_notices.sql @@ -178,5 +178,5 @@ INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title` 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'); + ('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 account_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 account_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.10.2