13 my $dbh = C4::Context->dbh();
15 my $branchcode = $input->param('newBranchName');
16 my $weekday = $input->param('newWeekday');
17 my $day = $input->param('newDay');
18 my $month = $input->param('newMonth');
19 my $year = $input->param('newYear');
20 my $title = $input->param('newTitle');
21 my $description = $input->param('newDescription');
23 $title || ($title = '');
25 $description =~ s/\r/\\r/g;
26 $description =~ s/\n/\\n/g;
30 my $calendar = C4::Calendar->new(branchcode => $branchcode);
32 if ($input->param('newOperation') eq 'weekday') {
33 unless ( $weekday && ($weekday ne '') ) {
34 # was dow calculated by javascript? original code implies it was supposed to be.
36 $weekday = &Date::Calc::Day_of_Week($year, $month, $day) % 7 unless($weekday);
38 $calendar->insert_week_day_holiday(weekday => $weekday,
40 description => $description);
41 } elsif ($input->param('newOperation') eq 'repeatable') {
42 $calendar->insert_day_month_holiday(day => $day,
45 description => $description);
46 } elsif ($input->param('newOperation') eq 'holiday') {
47 $calendar->insert_single_holiday(day => $day,
51 description => $description);
54 print $input->redirect("/cgi-bin/koha/tools/holidays.pl?branch=$branchcode");