Finalized XML version for intranet
[koha.git] / tools / exceptionHolidays.pl
1 #!/usr/bin/perl
2
3 use strict;
4 use CGI;
5
6 use C4::Auth;
7
8 use C4::Interface::CGI::Output;
9 use C4::Calendar::Calendar;
10
11 my $input = new CGI;
12 my $dbh = C4::Context->dbh();
13
14 my $branchcode = $input->param('showBranchName');
15 my $weekday = $input->param('showWeekday');
16 my $day = $input->param('showDay');
17 my $month = $input->param('showMonth');
18 my $year = $input->param('showYear');
19 my $title = $input->param('showTitle');
20 my $description = $input->param('showDescription');
21
22 my $calendar = C4::Calendar::Calendar->new(branchcode => $branchcode);
23
24 if ($input->param('showOperation') eq 'exception') {
25         $calendar->insert_exception_holiday(day => $day,
26                                                                                 month => $month,
27                                                                             year => $year,
28                                                                 title => $title,
29                                                                 description => $description);
30 } elsif ($input->param('showOperation') eq 'delete') {
31         $calendar->delete_holiday(weekday => $weekday,
32                                   day => $day,
33                                   month => $month,
34                                               year => $year);
35 }
36 print $input->redirect("/cgi-bin/koha/tools/holidays.pl?branch=$branchcode");