Lines 364-370
subtest "Koha::Account::pay writeoff tests" => sub {
Link Here
|
364 |
{ |
364 |
{ |
365 |
lines => [$line], |
365 |
lines => [$line], |
366 |
amount => 42, |
366 |
amount => 42, |
367 |
type => 'writeoff', |
367 |
type => 'WRITEOFF', |
368 |
} |
368 |
} |
369 |
); |
369 |
); |
370 |
|
370 |
|
Lines 374-380
subtest "Koha::Account::pay writeoff tests" => sub {
Link Here
|
374 |
|
374 |
|
375 |
my $writeoff = Koha::Account::Lines->find( $id ); |
375 |
my $writeoff = Koha::Account::Lines->find( $id ); |
376 |
|
376 |
|
377 |
is( $writeoff->credit_type_code, 'W', 'Type is correct for writeoff' ); |
377 |
is( $writeoff->credit_type_code, 'WRITEOFF', 'Type is correct for WRITEOFF' ); |
378 |
is( $writeoff->description, 'Writeoff', 'Description is correct' ); |
378 |
is( $writeoff->description, 'Writeoff', 'Description is correct' ); |
379 |
is( $writeoff->amount, '-42.000000', 'Amount is correct' ); |
379 |
is( $writeoff->amount, '-42.000000', 'Amount is correct' ); |
380 |
}; |
380 |
}; |
Lines 1064-1070
subtest "Payment notice tests" => sub {
Link Here
|
1064 |
my $id = $account->pay( { amount => 1 } ); |
1064 |
my $id = $account->pay( { amount => 1 } ); |
1065 |
is( Koha::Notice::Messages->search()->count(), 0, 'Notice for payment not sent if UseEmailReceipts is disabled' ); |
1065 |
is( Koha::Notice::Messages->search()->count(), 0, 'Notice for payment not sent if UseEmailReceipts is disabled' ); |
1066 |
|
1066 |
|
1067 |
$id = $account->pay( { amount => 1, type => 'writeoff' } ); |
1067 |
$id = $account->pay( { amount => 1, type => 'WRITEOFF' } ); |
1068 |
is( Koha::Notice::Messages->search()->count(), 0, 'Notice for writeoff not sent if UseEmailReceipts is disabled' ); |
1068 |
is( Koha::Notice::Messages->search()->count(), 0, 'Notice for writeoff not sent if UseEmailReceipts is disabled' ); |
1069 |
|
1069 |
|
1070 |
t::lib::Mocks::mock_preference('UseEmailReceipts', '1'); |
1070 |
t::lib::Mocks::mock_preference('UseEmailReceipts', '1'); |
Lines 1080-1086
subtest "Payment notice tests" => sub {
Link Here
|
1080 |
$letter->content('[%- USE Price -%]A writeoff of [% credit.amount * -1 | $Price %] has been applied to your account.'); |
1080 |
$letter->content('[%- USE Price -%]A writeoff of [% credit.amount * -1 | $Price %] has been applied to your account.'); |
1081 |
$letter->store(); |
1081 |
$letter->store(); |
1082 |
|
1082 |
|
1083 |
$id = $account->pay( { amount => 13, type => 'writeoff' } ); |
1083 |
$id = $account->pay( { amount => 13, type => 'WRITEOFF' } ); |
1084 |
$notice = Koha::Notice::Messages->search()->next(); |
1084 |
$notice = Koha::Notice::Messages->search()->next(); |
1085 |
is( $notice->subject, 'Account writeoff', 'Notice subject is correct for payment' ); |
1085 |
is( $notice->subject, 'Account writeoff', 'Notice subject is correct for payment' ); |
1086 |
is( $notice->letter_code, 'ACCOUNT_WRITEOFF', 'Notice letter code is correct for writeoff' ); |
1086 |
is( $notice->letter_code, 'ACCOUNT_WRITEOFF', 'Notice letter code is correct for writeoff' ); |