Koha/tools/newHolidays.pl
tipaul 2373f47a76 commit for holidays and news management.
Contrib from Tümer Garip (from Turkey) :
* holiday :
in /tools/ the holiday.pl script let you define holidays (days where the library is closed), branch by branch. You can define 3 types of holidays :
- single day : only this day is closed
- repet weekly (like "sunday") : the day is holiday every week
- repet yearly (like "July, 4") : this day is closed every year.

You can also put exception :
- sunday is holiday, but "2006 March, 5th" the library will be open

The holidays are used for return date calculation : the return date is set to the next date where the library is open. A systempreference (useDaysMode) set ON (Calendar) or OFF (Normal) the calendar calculation.
2006-03-03 16:35:21 +00:00

43 lines
1.3 KiB
Perl
Executable file

#!/usr/bin/perl
use strict;
use CGI;
use C4::Auth;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Database;
use HTML::Template;
use C4::Calendar;
my $input = new CGI;
my $dbh = C4::Context->dbh();
my $branchcode = $input->param('newBranchName');
my $weekday = $input->param('newWeekday');
my $day = $input->param('newDay');
my $month = $input->param('newMonth');
my $year = $input->param('newYear');
my $title = $input->param('newTitle');
my $description = $input->param('newDescription');
my $calendar = C4::Calendar->new(branchcode => $branchcode);
if ($input->param('newOperation') eq 'weekday') {
$calendar->insert_week_day_holiday(weekday => $weekday,
title => $title,
description => $description);
} elsif ($input->param('newOperation') eq 'repeatable') {
$calendar->insert_day_month_holiday(day => $day,
month => $month,
title => $title,
description => $description);
} elsif ($input->param('newOperation') eq 'holiday') {
$calendar->insert_single_holiday(day => $day,
month => $month,
year => $year,
title => $title,
description => $description);
}
print $input->redirect("/cgi-bin/koha/tools/holidays.pl?branch=$branchcode");