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