Bug 8804 [Revised] Quiet errors in the log from Auth.pm

Found three cases where variables were being
referenced which did not (in each case) exist. Adding
checks for those variables' existence.

Errors appeared when logged in and viewing a detail
page in the OPAC.

Revision simplifies logic as per RM suggestion.

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Owen Leonard 2012-09-21 16:49:51 -04:00 committed by Jared Camins-Esakov
parent 4db3611ee6
commit 5b8e1548e4

View file

@ -381,7 +381,7 @@ sub get_template_and_user {
my $opac_search_limit = $ENV{'OPAC_SEARCH_LIMIT'};
my $opac_limit_override = $ENV{'OPAC_LIMIT_OVERRIDE'};
my $opac_name = '';
if (($opac_search_limit =~ /branch:(\w+)/ && $opac_limit_override) || $in->{'query'}->param('limit') =~ /branch:(\w+)/){
if (($opac_search_limit && $opac_search_limit =~ /branch:(\w+)/ && $opac_limit_override) || ($in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /branch:(\w+)/)){
$opac_name = $1; # opac_search_limit is a branch, so we use it.
} elsif (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv && C4::Context->userenv->{'branch'}) {
$opac_name = C4::Context->userenv->{'branch'};
@ -707,7 +707,7 @@ sub checkauth {
else {
$cookie = $query->cookie( CGISESSID => $session->id );
$session->param('lasttime',time());
unless ( $sessiontype eq 'anon' ) { #if this is an anonymous session, we want to update the session, but not behave as if they are logged in...
unless ( $sessiontype && $sessiontype eq 'anon' ) { #if this is an anonymous session, we want to update the session, but not behave as if they are logged in...
$flags = haspermission($userid, $flagsrequired);
if ($flags) {
$loggedin = 1;