Commit 3b6b8a4a authored by joubu's avatar joubu Committed by Tomas Cohen Arazi

Bug 13215: Fix GetLetterTemplates should return default templates if branchcode is not defined

Signed-off-by: Tomas Cohen Arazi's avatarTomas Cohen Arazi <tomascohen@gmail.com>
parent eff8f8c0
......@@ -115,7 +115,7 @@ sub GetLetterTemplates {
my $module = $params->{module};
my $code = $params->{code};
my $branchcode = $params->{branchcode};
my $branchcode = $params->{branchcode} // '';
my $dbh = C4::Context->dbh;
my $letters = $dbh->selectall_hashref(
q|
......
use Modern::Perl;
use Test::More tests => 6;
use Test::More tests => 7;
use C4::Context;
use C4::Letters qw( GetLetterTemplates );
......@@ -123,3 +123,8 @@ is( scalar( keys %$letter_templates ),
1, '1 template should exist for circulation CPL code1' );
is( exists( $letter_templates->{email} ),
1, 'The mtt should be email for circulation CPL code1' );
$letter_templates = C4::Letters::GetLetterTemplates(
{ module => 'circulation', code => 'code1' } );
is( scalar( keys %$letter_templates ),
2, '2 default templates should exist for circulation code1 (even if branchcode is not given)' );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment