Koha::Calendar - Object containing a branches calendar
This documentation refers to Koha::Calendar version 0.0.1
use Koha::Calendat my $c = Koha::Calender->new( branchcode => 'MAIN' ); my $dt = DateTime->now(); # are we open $open = $c->is_holiday($dt); # when will item be due if loan period = $dur (a DateTime::Duration object) $duedate = $c->addDate($dt,$dur,'days');
Implements those features of C4::Calendar needed for Staffs Rolling Loans
my $calendar = Koha::Calendar->new( branchcode => 'MAIN' );
The option branchcode is required
my $dt = $calendar->addDate($date, $dur, $unit)
$date
is a DateTime object representing the starting date of the interval.
$offset
is a DateTime::Duration to add to it
$unit
is a string value 'days' or 'hours' toflag granularity of duration
Currently unit is only used to invoke Staffs return Monday at 10 am rule this parameter will be removed when issuingrules properly cope with that
$yesno = $calendar->is_holiday($dt);
passed at DateTime object returns 1 if it is a closed day 0 if not according to the calendar
$duration = $calendar->days_between($start_dt, $end_dt);
Passed two dates returns a DateTime::Duration object measuring the length between them ignoring closed days
Will croak if not passed a branchcode in new
This only contains a limited subset of the functionality in C4::Calendar Only enough to support Staffs Rolling loans
Colin Campbell colin.campbell@ptfs-europe.com
Copyright (c) 2011 PTFS-Europe Ltd All rights reserved
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.