|
Lines 905-911
subtest "Koha::Account::Line::void tests" => sub {
Link Here
|
| 905 |
|
905 |
|
| 906 |
subtest "Payment notice tests" => sub { |
906 |
subtest "Payment notice tests" => sub { |
| 907 |
|
907 |
|
| 908 |
plan tests => 6; |
908 |
plan tests => 8; |
| 909 |
|
909 |
|
| 910 |
Koha::Account::Lines->delete(); |
910 |
Koha::Account::Lines->delete(); |
| 911 |
Koha::Patrons->delete(); |
911 |
Koha::Patrons->delete(); |
|
Lines 933-954
subtest "Payment notice tests" => sub {
Link Here
|
| 933 |
$letter->content('[%- USE Price -%]A payment of [% credit.amount * -1 | $Price %] has been applied to your account.'); |
933 |
$letter->content('[%- USE Price -%]A payment of [% credit.amount * -1 | $Price %] has been applied to your account.'); |
| 934 |
$letter->store(); |
934 |
$letter->store(); |
| 935 |
|
935 |
|
| 936 |
my $id = $account->pay( { amount => 13 } ); |
936 |
t::lib::Mocks::mock_preference('UseEmailReceipts', '0'); |
|
|
937 |
|
| 938 |
my $id = $account->pay( { amount => 1 } ); |
| 939 |
is( Koha::Notice::Messages->search()->count(), 0, 'Notice for payment not sent if UseEmailReceipts is disabled' ); |
| 940 |
|
| 941 |
$id = $account->pay( { amount => 1, type => 'writeoff' } ); |
| 942 |
is( Koha::Notice::Messages->search()->count(), 0, 'Notice for writeoff not sent if UseEmailReceipts is disabled' ); |
| 943 |
|
| 944 |
t::lib::Mocks::mock_preference('UseEmailReceipts', '1'); |
| 945 |
|
| 946 |
$id = $account->pay( { amount => 12 } ); |
| 937 |
my $notice = Koha::Notice::Messages->search()->next(); |
947 |
my $notice = Koha::Notice::Messages->search()->next(); |
| 938 |
is( $notice->subject, 'Account Payment', 'Notice subject is correct for payment' ); |
948 |
is( $notice->subject, 'Account payment', 'Notice subject is correct for payment' ); |
| 939 |
is( $notice->letter_code, 'ACCOUNT_PAYMENT', 'Notice letter code is correct for payment' ); |
949 |
is( $notice->letter_code, 'ACCOUNT_PAYMENT', 'Notice letter code is correct for payment' ); |
| 940 |
is( $notice->content, 'A payment of 13.00 has been applied to your account.', 'Notice content is correct for payment' ); |
950 |
is( $notice->content, 'A payment of 12.00 has been applied to your account.', 'Notice content is correct for payment' ); |
| 941 |
$notice->delete(); |
951 |
$notice->delete(); |
| 942 |
|
952 |
|
| 943 |
$letter = Koha::Notice::Templates->find( { code => 'ACCOUNT_WRITEOFF' } ); |
953 |
$letter = Koha::Notice::Templates->find( { code => 'ACCOUNT_WRITEOFF' } ); |
| 944 |
$letter->content('[%- USE Price -%]A writeoff of [% credit.amount * -1 | $Price %] has been applied to your account.'); |
954 |
$letter->content('[%- USE Price -%]A writeoff of [% credit.amount * -1 | $Price %] has been applied to your account.'); |
| 945 |
$letter->store(); |
955 |
$letter->store(); |
| 946 |
|
956 |
|
| 947 |
$id = $account->pay( { amount => 14, type => 'writeoff' } ); |
957 |
$id = $account->pay( { amount => 13, type => 'writeoff' } ); |
| 948 |
$notice = Koha::Notice::Messages->search()->next(); |
958 |
$notice = Koha::Notice::Messages->search()->next(); |
| 949 |
is( $notice->subject, 'Account Writeoff', 'Notice subject is correct for payment' ); |
959 |
is( $notice->subject, 'Account writeoff', 'Notice subject is correct for payment' ); |
| 950 |
is( $notice->letter_code, 'ACCOUNT_WRITEOFF', 'Notice letter code is correct for writeoff' ); |
960 |
is( $notice->letter_code, 'ACCOUNT_WRITEOFF', 'Notice letter code is correct for writeoff' ); |
| 951 |
is( $notice->content, 'A writeoff of 14.00 has been applied to your account.', 'Notice content is correct for writeoff' ); |
961 |
is( $notice->content, 'A writeoff of 13.00 has been applied to your account.', 'Notice content is correct for writeoff' ); |
| 952 |
}; |
962 |
}; |
| 953 |
|
963 |
|
| 954 |
1; |
964 |
1; |
| 955 |
- |
|
|