X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=tools%2Fholidays.pl;h=a6afcaa20c32adee7486a3e12caf35fe89cbe5d4;hb=49e0a8fc786b61b56d15d77d79c180c60c595943;hp=d3a450c42e037872929e98a78ecc4d6d82400b60;hpb=ec73dc92f95b3adaaa1395d7b156131541e1e4d4;p=koha_fer diff --git a/tools/holidays.pl b/tools/holidays.pl index d3a450c42e..a6afcaa20c 100755 --- a/tools/holidays.pl +++ b/tools/holidays.pl @@ -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; @@ -38,11 +40,26 @@ my ($template, $loggedinuser, $cookie) debug => 1, }); +# keydate - date passed to calendar.js. calendar.js does not process dashes within a date. +my $keydate; +# calendardate - date passed in url for human readability (syspref) +my $calendardate; +my $today = C4::Dates->new(); +my $calendarinput = C4::Dates->new($input->param('calendardate')) || $today; +# if the url has an invalid date default to 'now.' +unless($calendardate = $calendarinput->output('syspref')) { + $calendardate = $today->output('syspref'); +} +unless($keydate = $calendarinput->output('iso')) { + $keydate = $today->output('iso'); +} +$keydate =~ s/-/\//g; + 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'}; @@ -57,7 +74,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 @@ -122,6 +140,9 @@ $template->param(WEEK_DAYS_LOOP => \@week_days, HOLIDAYS_LOOP => \@holidays, EXCEPTION_HOLIDAYS_LOOP => \@exception_holidays, DAY_MONTH_HOLIDAYS_LOOP => \@day_month_holidays, + calendardate => $calendardate, + keydate => $keydate, + branchcodes => $branchcodes, branch => $branch );