From 6ad59e7ab45bbd2858f4cfad83d862688a48e49b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 24 Aug 2015 10:07:37 +0100 Subject: [PATCH] Bug 14709: Do not access to C4::Context->userenv from the commandline MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The script dies with Can't use an undefined value as a HASH reference at tools/export.pl line 149. if it is called from the command line. This is introduced by bug 13040. The C4::Context->userenv is not defined in this case. Test plan: Execute the script using the command line. With the patch applies you should not get the error. Signed-off-by: Joonas Kylmälä Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- tools/export.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/export.pl b/tools/export.pl index 2191b027cd..80a15b4cf9 100755 --- a/tools/export.pl +++ b/tools/export.pl @@ -146,7 +146,7 @@ if ( C4::Context->preference("IndependentBranches") @branch = ( C4::Context->userenv->{'branch'} ); } # if stripping nonlocal items, use loggedinuser's branch -my $localbranch = C4::Context->userenv->{'branch'}; +my $localbranch = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; my %branchmap = map { $_ => 1 } @branch; # for quick lookups -- 2.20.1