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;
31 my $calendar = C4
::Calendar
->new(branchcode
=> $branchcode);
33 if ($input->param('newOperation') eq 'weekday') {
34 $calendar->insert_week_day_holiday(weekday
=> $weekday,
36 description
=> $description);
37 } elsif ($input->param('newOperation') eq 'repeatable') {
38 $calendar->insert_day_month_holiday(day
=> $day,
41 description
=> $description);
42 } elsif ($input->param('newOperation') eq 'holiday') {
43 $calendar->insert_single_holiday(day
=> $day,
47 description
=> $description);
50 print $input->redirect("/cgi-bin/koha/tools/holidays.pl?branch=$branchcode");