Bug 8436: Replace GetBranches with GetBranchesLoop
authorJonathan Druart <jonathan.druart@biblibre.com>
Fri, 20 Feb 2015 09:57:52 +0000 (10:57 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 4 Nov 2015 14:11:47 +0000 (11:11 -0300)
The branch selection logic still exists in GetBranchesLoop, it should be
used here.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
serials/checkexpiration.pl

index 23e692f..df18fe2 100755 (executable)
@@ -106,31 +106,17 @@ if ($date) {
 }
 
 my $branchname;
-my @branches_loop;
+my $branches_loop;
 if (   $flags->{superlibrarian}
     or ( ref $flags->{serials}  and $flags->{serials}->{superserials} )
     or ( !ref $flags->{serials} and $flags->{serials} == 1 ) )
 {
-    my $branches = GetBranches();
-    foreach my $b (sort keys %$branches) {
-        my $selected = 0;
-        if( $branch and $branch eq $b ){
-            $selected = 1;
-            $branchname = $branches->{$b}->{branchname};
-        }
-        push @branches_loop, {
-            branchcode => $b,
-            branchname => $branches->{$b}->{branchname},
-            selected   => $selected,
-        };
-    }
+    $branches_loop = C4::Branch::GetBranchesLoop( $branch );
 }
 
 $template->param (
     (uc(C4::Context->preference("marcflavour"))) => 1,
-    branches_loop   => \@branches_loop,
-    branchcode      => $branch,
-    branchname      => $branchname,
+    branches_loop   => $branches_loop,
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;