Lines 1002-1008
subtest "Payment notice tests" => sub {
Link Here
|
1002 |
my $line = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 27 })->store(); |
1002 |
my $line = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 27 })->store(); |
1003 |
|
1003 |
|
1004 |
my $letter = Koha::Notice::Templates->find( { code => 'ACCOUNT_PAYMENT' } ); |
1004 |
my $letter = Koha::Notice::Templates->find( { code => 'ACCOUNT_PAYMENT' } ); |
1005 |
$letter->content('[%- USE Price -%]A payment of [% credit.amount * -1 | $Price %] has been applied to your account.'); |
1005 |
$letter->content('[%- USE Price -%]A payment of [% credit.amount * -1 | $Price %] has been applied to your account. Your [% branch.branchcode %]'); |
1006 |
$letter->store(); |
1006 |
$letter->store(); |
1007 |
|
1007 |
|
1008 |
t::lib::Mocks::mock_preference('UseEmailReceipts', '0'); |
1008 |
t::lib::Mocks::mock_preference('UseEmailReceipts', '0'); |
Lines 1015-1036
subtest "Payment notice tests" => sub {
Link Here
|
1015 |
|
1015 |
|
1016 |
t::lib::Mocks::mock_preference('UseEmailReceipts', '1'); |
1016 |
t::lib::Mocks::mock_preference('UseEmailReceipts', '1'); |
1017 |
|
1017 |
|
1018 |
$id = $account->pay( { amount => 12 } ); |
1018 |
$id = $account->pay( { amount => 12, library_id => $branchcode } ); |
1019 |
my $notice = Koha::Notice::Messages->search()->next(); |
1019 |
my $notice = Koha::Notice::Messages->search()->next(); |
1020 |
is( $notice->subject, 'Account payment', 'Notice subject is correct for payment' ); |
1020 |
is( $notice->subject, 'Account payment', 'Notice subject is correct for payment' ); |
1021 |
is( $notice->letter_code, 'ACCOUNT_PAYMENT', 'Notice letter code is correct for payment' ); |
1021 |
is( $notice->letter_code, 'ACCOUNT_PAYMENT', 'Notice letter code is correct for payment' ); |
1022 |
is( $notice->content, 'A payment of 12.00 has been applied to your account.', 'Notice content is correct for payment' ); |
1022 |
is( $notice->content, "A payment of 12.00 has been applied to your account. Your $branchcode", 'Notice content is correct for payment' ); |
1023 |
$notice->delete(); |
1023 |
$notice->delete(); |
1024 |
|
1024 |
|
1025 |
$letter = Koha::Notice::Templates->find( { code => 'ACCOUNT_WRITEOFF' } ); |
1025 |
$letter = Koha::Notice::Templates->find( { code => 'ACCOUNT_WRITEOFF' } ); |
1026 |
$letter->content('[%- USE Price -%]A writeoff of [% credit.amount * -1 | $Price %] has been applied to your account.'); |
1026 |
$letter->content('[%- USE Price -%]A writeoff of [% credit.amount * -1 | $Price %] has been applied to your account. Your [% branch.branchcode %]'); |
1027 |
$letter->store(); |
1027 |
$letter->store(); |
1028 |
|
1028 |
|
1029 |
$id = $account->pay( { amount => 13, type => 'writeoff' } ); |
1029 |
$id = $account->pay( { amount => 13, type => 'writeoff', library_id => $branchcode } ); |
1030 |
$notice = Koha::Notice::Messages->search()->next(); |
1030 |
$notice = Koha::Notice::Messages->search()->next(); |
1031 |
is( $notice->subject, 'Account writeoff', 'Notice subject is correct for payment' ); |
1031 |
is( $notice->subject, 'Account writeoff', 'Notice subject is correct for payment' ); |
1032 |
is( $notice->letter_code, 'ACCOUNT_WRITEOFF', 'Notice letter code is correct for writeoff' ); |
1032 |
is( $notice->letter_code, 'ACCOUNT_WRITEOFF', 'Notice letter code is correct for writeoff' ); |
1033 |
is( $notice->content, 'A writeoff of 13.00 has been applied to your account.', 'Notice content is correct for writeoff' ); |
1033 |
is( $notice->content, "A writeoff of 13.00 has been applied to your account. Your $branchcode", 'Notice content is correct for writeoff' ); |
1034 |
}; |
1034 |
}; |
1035 |
|
1035 |
|
1036 |
1; |
1036 |
1; |
1037 |
- |
|
|