From 3209941f3fbb11301c799476c6a198474362d209 Mon Sep 17 00:00:00 2001 From: Bernardo Gonzalez Kriegel Date: Fri, 15 Mar 2013 17:05:26 -0300 Subject: [PATCH] Bug 9457 - Followup - Ordering branches should be case independent (2) This follow up reinstates or add check for undef returned by C4::Context->userenv, only where previous patch touch code. Signed-off-by: Jonathan Druart Signed-off-by: Jared Camins-Esakov --- members/memberentry.pl | 6 +++++- opac/opac-suggestions.pl | 6 +++++- reports/itemtypes.plugin | 11 +++++++---- reserve/request.pl | 6 +++++- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/members/memberentry.pl b/members/memberentry.pl index 79f1f932f3..6b0e8464dd 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -572,7 +572,11 @@ foreach (keys(%flags)) { # in modify mod: userbranch value for GetBranchesLoop() comes from borrowers table # in add mod: userbranch value come from branches table (ip correspondence) -my $userbranch = C4::Context->userenv->{'branch'}; +my $userbranch = ''; +if (C4::Context->userenv && C4::Context->userenv->{'branch'}) { + $userbranch = C4::Context->userenv->{'branch'}; +} + if (defined ($data{'branchcode'}) and ( $op eq 'modify' || ( $op eq 'add' && $category_type eq 'C' ) )) { $userbranch = $data{'branchcode'}; } diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index 1b353fd40c..32b5c3d221 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -128,7 +128,11 @@ if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) { my ( $borr ) = GetMemberDetails( $borrowernumber ); # pass the pickup branch along.... - my $branch = $input->param('branch') || $borr->{'branchcode'} || C4::Context->userenv->{branch} || '' ; + my $userbranch = ''; + if (C4::Context->userenv && C4::Context->userenv->{'branch'}) { + $userbranch = C4::Context->userenv->{'branch'}; + } + my $branch = $input->param('branch') || $borr->{'branchcode'} || $userbranch || '' ; # make branch selection options... my $branchloop = GetBranchesLoop($branch); diff --git a/reports/itemtypes.plugin b/reports/itemtypes.plugin index 388649f2dc..e4164a5a76 100755 --- a/reports/itemtypes.plugin +++ b/reports/itemtypes.plugin @@ -31,10 +31,13 @@ use C4::Branch; # GetBranches =cut sub set_parameters { - my ($template) = @_; - my $userbranch = C4::Context->userenv->{'branch'}; - $template->param( branchloop => GetBranchesLoop($userbranch) ); - return $template; + my ($template) = @_; + my $userbranch = ''; + if (C4::Context->userenv && C4::Context->userenv->{'branch'}) { + $userbranch = C4::Context->userenv->{'branch'}; + } + $template->param( branchloop => GetBranchesLoop($userbranch) ); + return $template; } sub calculate { diff --git a/reserve/request.pl b/reserve/request.pl index f8e26a22a6..5bcaca2ca6 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -65,7 +65,11 @@ my $showallitems = $input->param('showallitems'); my $branches = GetBranches(); my $itemtypes = GetItemTypes(); -my $userbranch = C4::Context->userenv->{branch}; +my $userbranch = ''; +if (C4::Context->userenv && C4::Context->userenv->{'branch'}) { + $userbranch = C4::Context->userenv->{'branch'}; +} + # Select borrowers infos my $findborrower = $input->param('findborrower'); -- 2.39.5