Commit 51887022 authored by Marcel de Rooy's avatar Marcel de Rooy Committed by Galen Charlton

Bug 11732: Eliminate warning on undefined branchcode

When you run the Reserves test, you have the warnings:
Use of uninitialized value $branchcode in hash element at /usr/share/koha/testclone/C4/ line 138.
Use of uninitialized value $branchcode in hash element at /usr/share/koha/testclone/C4/ line 148.
This patch removes that warning.

Test plan:
Run the Reserves.t again.

Revised Test Plan
Run the following on the command line prompt before and after
applying the patch:
    perl -e "use C4::Letters; *C4::Context::userenv= sub { return {} }; my \$blah=C4::Letters::getletter('circulation','DUE', 'BRA');"
Before the patch there will be errors (as above), after there will not.
Signed-off-by: Mark Tompsett's avatarMark Tompsett <>
Signed-off-by: default avatarKyle M Hall <>
Signed-off-by: joubu's avatarJonathan Druart <>
IndependentBranches must be on.
Signed-off-by: Galen Charlton's avatarGalen Charlton <>
parent c9dd8b8b
......@@ -126,7 +126,6 @@ our %letter;
sub getletter {
my ( $module, $code, $branchcode ) = @_;
$branchcode ||= '';
if ( C4::Context->preference('IndependentBranches')
and $branchcode
......@@ -134,6 +133,7 @@ sub getletter {
$branchcode = C4::Context->userenv->{'branch'};
$branchcode //= '';
if ( my $l = $letter{$module}{$code}{$branchcode} ) {
return { %$l }; # deep copy
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