Merge remote branch 'kc/master' into new/enh/bug_5917
authorChris Cormack <chrisc@catalyst.net.nz>
Tue, 22 Mar 2011 02:06:44 +0000 (15:06 +1300)
committerChris Cormack <chrisc@catalyst.net.nz>
Tue, 22 Mar 2011 02:06:44 +0000 (15:06 +1300)
1  2 
C4/Auth.pm

diff --cc C4/Auth.pm
@@@ -380,22 -379,12 +379,21 @@@ sub get_template_and_user 
          # variables passed from CGI: opac_css_override and opac_search_limits.
          my $opac_search_limit = $ENV{'OPAC_SEARCH_LIMIT'};
          my $opac_limit_override = $ENV{'OPAC_LIMIT_OVERRIDE'};
-         my $mylibraryfirst = C4::Context->preference("SearchMyLibraryFirst");
-         my $opac_name;
-         if($opac_limit_override && ($opac_search_limit =~ /branch:(\w+)/) ){
-              $opac_name = C4::Branch::GetBranchName($1)   # opac_search_limit is a branch, so we use it.
-         } elsif($mylibraryfirst){
-             $opac_name = C4::Branch::GetBranchName($mylibraryfirst);
+         my $opac_name = '';
+         if (($opac_search_limit =~ /branch:(\w+)/ && $opac_limit_override) || $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'};
          }
 +      my $checkstyle = C4::Context->preference("opaccolorstylesheet");
 +      if ($checkstyle =~ /http/)
 +      {
 +              $template->param( opacexternalsheet => $checkstyle);
 +      } else
 +      {
 +              my $opaccolorstylesheet = C4::Context->preference("opaccolorstylesheet");  
 +            $template->param( opaccolorstylesheet => $opaccolorstylesheet);
 +      }
          $template->param(
              AmazonContent             => "" . C4::Context->preference("AmazonContent"),
              AnonSuggestions           => "" . C4::Context->preference("AnonSuggestions"),