Bug 19191: (QA follow-up) Remove double fetches from database

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Kyle M Hall 2018-05-04 15:17:51 -04:00 committed by Nick Clemens
parent a495ba861d
commit a503abb3db
3 changed files with 4 additions and 4 deletions

View File

@ -270,14 +270,14 @@ sub pay {
module => 'circulation',
letter_code => uc("ACCOUNT_$type"),
message_transport_type => 'email',
lang => Koha::Patrons->find( $self->{patron_id} )->lang,
lang => $patron->lang,
tables => {
borrowers => $self->{patron_id},
branches => $self->{library_id},
},
substitute => {
credit => $payment,
offsets => scalar Koha::Account::Offsets->search( { id => { -in => [ map { $_->id } @account_offsets ] } } ),
offsets => \@account_offsets,
},
)
)

View File

@ -1,7 +1,7 @@
INSERT IGNORE 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_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');
$dbh->do(q{
INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`)

View File

@ -1013,7 +1013,7 @@ subtest "Payment notice tests" => sub {
$id = $account->pay( { amount => 13, type => 'writeoff' } );
$notice = Koha::Notice::Messages->search()->next();
is( $notice->subject, 'Account Writeoff', 'Notice subject is correct for payment' );
is( $notice->subject, 'Account writeoff', 'Notice subject is correct for payment' );
is( $notice->letter_code, 'ACCOUNT_WRITEOFF', 'Notice letter code is correct for writeoff' );
is( $notice->content, 'A writeoff of 13.00 has been applied to your account.', 'Notice content is correct for writeoff' );
};