Browse Source

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
3.18.x
Jonathan Druart 8 years ago
committed by Tomas Cohen Arazi
parent
commit
3b6b8a4a1e
  1. 2
      C4/Letters.pm
  2. 7
      t/db_dependent/Letters/GetLetterTemplates.t

2
C4/Letters.pm

@ -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|

7
t/db_dependent/Letters/GetLetterTemplates.t

@ -1,5 +1,5 @@
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)' );

Loading…
Cancel
Save