Signed-off-by: Joshua Ferraro <jmf@liblime.com>
my $input = new CGI;
-my $branch=C4::Context->preference('defaultbranch') || $input->param('branch');
+my $branch= $input->param('branch') || C4::Context->userenv->{'branch'};
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);
} 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);