Bug 3543: split NLM call numbers in label creator
[koha_fer] / tools / holidays.pl
index c92e521..eb3bc9c 100755 (executable)
@@ -17,6 +17,8 @@
 
 #####Sets holiday periods for each branch. Datedues will be extended if branch is closed -TG
 use strict;
+use warnings;
+
 use CGI;
 
 use C4::Auth;
@@ -57,11 +59,12 @@ my $branch= $input->param('branch') || C4::Context->userenv->{'branch'};
 # Set all the branches.
 my $onlymine=(C4::Context->preference('IndependantBranches') &&
               C4::Context->userenv &&
-              C4::Context->userenv->{flags} !=1  &&
+              C4::Context->userenv->{flags} % 2 !=1  &&
               C4::Context->userenv->{branch}?1:0);
 if ( $onlymine ) { 
     $branch = C4::Context->userenv->{'branch'};
 }
+my $branchname = GetBranchName($branch);
 my $branches = GetBranches($onlymine);
 my @branchloop;
 for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
@@ -72,7 +75,8 @@ for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{b
             );
     push @branchloop, \%row;
 }
-
+# branches calculated - put branch codes in a single string so they can be passed in a form
+my $branchcodes = join("|", keys %$branches);
 
 # Get all the holidays
 
@@ -133,14 +137,16 @@ foreach my $yearMonthDay (keys %$single_holidays) {
 }
 
 $template->param(WEEK_DAYS_LOOP => \@week_days,
-                               branchloop => \@branchloop, 
-                               HOLIDAYS_LOOP => \@holidays,
-                               EXCEPTION_HOLIDAYS_LOOP => \@exception_holidays,
-                               DAY_MONTH_HOLIDAYS_LOOP => \@day_month_holidays,
-                               calendardate => $calendardate,
-                               keydate => $keydate,
-                               branch => $branch
-       );
+        branchloop => \@branchloop, 
+        HOLIDAYS_LOOP => \@holidays,
+        EXCEPTION_HOLIDAYS_LOOP => \@exception_holidays,
+        DAY_MONTH_HOLIDAYS_LOOP => \@day_month_holidays,
+        calendardate => $calendardate,
+        keydate => $keydate,
+        branchcodes => $branchcodes,
+        branch => $branch,
+        branchname => $branchname
+  );
 
 # Shows the template with the real values replaced
 output_html_with_http_headers $input, $cookie, $template->output;