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 <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Bernardo Gonzalez Kriegel 2013-03-15 17:05:26 -03:00 committed by Jared Camins-Esakov
parent 2d9f5fc69e
commit 3209941f3f
4 changed files with 22 additions and 7 deletions

View File

@ -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'};
}

View File

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

View File

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

View File

@ -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');