BUGFIX 2106 - repeatable holidays always on sunday. Also removing an old, unused...
authorRyan Higgins <rch@liblime.com>
Thu, 5 Jun 2008 21:44:52 +0000 (16:44 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Fri, 6 Jun 2008 03:47:45 +0000 (22:47 -0500)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
tools/holidays.pl
tools/newHolidays.pl

index 21e791c..f1a9861 100755 (executable)
@@ -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);
index 71dd839..d8a51e1 100755 (executable)
@@ -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);