(bug #3778) GetBranchesLoop and searchMyLibraryFirst
authorNahuel ANGELINETTI <nahuel.angelinetti@biblibre.com>
Mon, 9 Nov 2009 08:38:25 +0000 (09:38 +0100)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Wed, 18 Nov 2009 18:12:45 +0000 (19:12 +0100)
This fix GetBranchesLoop, if searchmylibraryfirst is disabled, getbranchesloop mustn't select any branch.

C4/Branch.pm

index 18177ec..34f716a 100644 (file)
@@ -156,10 +156,11 @@ sub GetBranchesLoop (;$$) {  # since this is what most pages want anyway
     my $onlymine = @_ ? shift : onlymine();
     my $branches = GetBranches($onlymine);
     my @loop;
+    my $searchMyLibraryFirst = C4::Context->preference("SearchMyLibraryFirst");;
     foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
         push @loop, {
             value => $_,
-            selected => ($_ eq $branch) ? 1 : 0, 
+            selected => (($_ eq $branch) && $searchMyLibraryFirst ) ? 1 : 0, 
             branchname => $branches->{$_}->{branchname},
         };
     }