|
Lines 870-876
subtest 'GetPreparedLetter' => sub {
Link Here
|
| 870 |
|
870 |
|
| 871 |
|
871 |
|
| 872 |
subtest 'TranslateNotices' => sub { |
872 |
subtest 'TranslateNotices' => sub { |
| 873 |
plan tests => 4; |
873 |
plan tests => 7; |
| 874 |
|
874 |
|
| 875 |
t::lib::Mocks::mock_preference( 'TranslateNotices', '1' ); |
875 |
t::lib::Mocks::mock_preference( 'TranslateNotices', '1' ); |
| 876 |
|
876 |
|
|
Lines 932-937
subtest 'TranslateNotices' => sub {
Link Here
|
| 932 |
is( $letter->{title}, 'a test', |
932 |
is( $letter->{title}, 'a test', |
| 933 |
'GetPreparedLetter should return the default notice if pref disabled but additional language exists' ); |
933 |
'GetPreparedLetter should return the default notice if pref disabled but additional language exists' ); |
| 934 |
|
934 |
|
|
|
935 |
my $amount = -20; |
| 936 |
my $accountline = $builder->build( |
| 937 |
{ |
| 938 |
source => 'Accountline', |
| 939 |
value => { |
| 940 |
borrowernumber => $borrowernumber, |
| 941 |
amount => $amount, |
| 942 |
amountoutstanding => $amount, |
| 943 |
credit_type_code => 'PAYMENT', |
| 944 |
} |
| 945 |
} |
| 946 |
); |
| 947 |
$dbh->do( |
| 948 |
q| |
| 949 |
INSERT INTO letter (module, code, branchcode, name, title, content, message_transport_type, lang) VALUES |
| 950 |
('test_payment', 'code', '', 'Account payment', 'Account payment', "[% PROCESS 'accounts.inc' %][% PROCESS account_type_description account=credit %][% credit.description %]", 'print', 'default'); |
| 951 |
| |
| 952 |
); |
| 953 |
|
| 954 |
$tables = { |
| 955 |
borrowers => $borrowernumber, |
| 956 |
credits => $accountline->{accountlines_id}, |
| 957 |
}; |
| 958 |
|
| 959 |
$letter = C4::Letters::GetPreparedLetter( |
| 960 |
module => 'test_payment', |
| 961 |
letter_code => 'code', |
| 962 |
message_transport_type => 'print', |
| 963 |
tables => $tables, |
| 964 |
lang => 'fr-CA', |
| 965 |
); |
| 966 |
like( |
| 967 |
$letter->{content}, qr/Paiement/, |
| 968 |
'GetPreparedLetter should return the notice in patron\'s preferred language' |
| 969 |
); |
| 970 |
|
| 971 |
my $context = Test::MockModule->new('C4::Context'); |
| 972 |
$context->mock( 'interface', 'intranet' ); |
| 973 |
|
| 974 |
Koha::Cache::Memory::Lite->get_instance()->clear_from_cache('getlanguage'); |
| 975 |
t::lib::Mocks::mock_preference( 'language', 'fr-CA,en' ); |
| 976 |
|
| 977 |
$letter = C4::Letters::GetPreparedLetter( |
| 978 |
module => 'test_payment', |
| 979 |
letter_code => 'code', |
| 980 |
message_transport_type => 'print', |
| 981 |
tables => $tables, |
| 982 |
lang => 'default', |
| 983 |
); |
| 984 |
like( $letter->{content}, qr/Paiement/, 'GetPreparedLetter should return the notice in the interface language' ); |
| 985 |
|
| 986 |
$context->mock( 'interface', 'cron' ); |
| 987 |
|
| 988 |
$letter = C4::Letters::GetPreparedLetter( |
| 989 |
module => 'test_payment', |
| 990 |
letter_code => 'code', |
| 991 |
message_transport_type => 'print', |
| 992 |
tables => $tables, |
| 993 |
lang => 'default' |
| 994 |
); |
| 995 |
like( |
| 996 |
$letter->{content}, qr/Paiement/, |
| 997 |
'GetPreparedLetter should return the notice in the first language in language system preference' |
| 998 |
); |
| 935 |
}; |
999 |
}; |
| 936 |
|
1000 |
|
| 937 |
subtest 'Test SMS handling in SendQueuedMessages' => sub { |
1001 |
subtest 'Test SMS handling in SendQueuedMessages' => sub { |
| 938 |
- |
|
|