[Koha-cvs] koha/C4 Calendar.pm [rel_2_2]
Ryan Higgins
rch at liblime.com
Mon Apr 9 19:14:35 CEST 2007
CVSROOT: /sources/koha
Module name: koha
Branch: rel_2_2
Changes by: Ryan Higgins <rych> 07/04/09 17:14:35
Modified files:
C4 : Calendar.pm
Log message:
Correcting date calculation;
Adding new calculation modes:
"normal" : ignore holidays.
"length" : only non-holiday dates count toward loan length.
"datedue" : if the normally calculated due date falls on a holiday, the loan
length is extended to the next non-holiday date.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Calendar.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.2.2.2&r2=1.2.2.3
Patches:
Index: Calendar.pm
===================================================================
RCS file: /sources/koha/koha/C4/Calendar.pm,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -u -b -r1.2.2.2 -r1.2.2.3
--- Calendar.pm 16 Feb 2007 03:53:39 -0000 1.2.2.2
+++ Calendar.pm 9 Apr 2007 17:14:34 -0000 1.2.2.3
@@ -482,18 +482,23 @@
}
my $daysMode = C4::Context->preference('useDaysMode');
+ warn $daysMode;
if ($daysMode eq 'normal') {
- ($year, $month, $day) = Add_Delta_Days($year, $month, $day, ($offset - 1));
- } else {
+ ($year, $month, $day) = Add_Delta_Days($year, $month, $day, $offset );
+ } elsif ($daysMode eq 'datedue') {
+ ($year, $month, $day) = Add_Delta_Days($year, $month, $day, $offset );
+ while ($self->isHoliday($day, $month, $year)) {
+ ($year, $month, $day) = Add_Delta_Days($year, $month, $day, 1);
+ }
+ } else { ### ($daysMode eq 'length') {
while ($offset > 0) {
+ ($year, $month, $day) = Add_Delta_Days($year, $month, $day, 1);
if (!($self->isHoliday($day, $month, $year))) {
$offset = $offset - 1;
}
- if ($offset > 0) {
- ($year, $month, $day) = Add_Delta_Days($year, $month, $day, 1);
- }
}
}
+
return($day, $month, $year);
}
More information about the Koha-cvs
mailing list