From: Ryan Higgins Date: Thu, 5 Jun 2008 21:44:52 +0000 (-0500) Subject: BUGFIX 2106 - repeatable holidays always on sunday. Also removing an old, unused... X-Git-Tag: v3.00.00-stableRC1~169 X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=1889fe8383a25d9f33e3befcc2a24432bf49e384;p=koha.git BUGFIX 2106 - repeatable holidays always on sunday. Also removing an old, unused syspref, and correcting a branch limitation for ind.branches. Signed-off-by: Joshua Ferraro --- diff --git a/tools/holidays.pl b/tools/holidays.pl index 21e791ccba..f1a98614b0 100755 --- a/tools/holidays.pl +++ b/tools/holidays.pl @@ -27,7 +27,7 @@ use C4::Calendar; my $input = new CGI; -my $branch=C4::Context->preference('defaultbranch') || $input->param('branch'); +my $branch= $input->param('branch') || C4::Context->userenv->{'branch'}; @@ -47,7 +47,7 @@ my $onlymine=(C4::Context->preference('IndependantBranches') && C4::Context->userenv && C4::Context->userenv->{flags} !=1 && C4::Context->userenv->{branch}?1:0); -if ( C4::Context->preference("IndependantBranches") ) { +if ( $onlymine ) { $branch = C4::Context->userenv->{'branch'}; } my $branches = GetBranches($onlymine); diff --git a/tools/newHolidays.pl b/tools/newHolidays.pl index 71dd8397ef..d8a51e1aef 100755 --- a/tools/newHolidays.pl +++ b/tools/newHolidays.pl @@ -27,10 +27,14 @@ if ($description) { } else { $description = ''; } - my $calendar = C4::Calendar->new(branchcode => $branchcode); if ($input->param('newOperation') eq 'weekday') { + unless ( $weekday && ($weekday ne '') ) { + # was dow calculated by javascript? original code implies it was supposed to be. + # if not, we need it. + $weekday = &Date::Calc::Day_of_Week($year, $month, $day) % 7 unless($weekday); + } $calendar->insert_week_day_holiday(weekday => $weekday, title => $title, description => $description);