[open-ils-commits] r18214 - branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Circ (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Oct 6 16:45:54 EDT 2010
Author: erickson
Date: 2010-10-06 16:45:49 -0400 (Wed, 06 Oct 2010)
New Revision: 18214
Modified:
branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Log:
added support for honoring the due date ceiling from the duration rule. AKA, end-of-semester due dates
Modified: branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2010-10-06 20:44:46 UTC (rev 18213)
+++ branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2010-10-06 20:45:49 UTC (rev 18214)
@@ -1136,7 +1136,8 @@
max_fine_rule => $max_fine_rule->name,
max_fine => $self->get_max_fine_amount($max_fine_rule),
fine_interval => $recurring_fine_rule->recurance_interval,
- renewal_remaining => $duration_rule->max_renewals
+ renewal_remaining => $duration_rule->max_renewals,
+ duration_date_ceiling => $duration_rule->date_ceiling
};
$policy->{duration} = $duration_rule->shrt
@@ -1618,10 +1619,12 @@
my $recurring = $self->recurring_fines_rule;
my $copy = $self->copy;
my $patron = $self->patron;
+ my $duration_date_ceiling;
if( $duration ) {
my $policy = $self->get_circ_policy($duration, $recurring, $max);
+ $duration_date_ceiling = $policy->{duration_date_ceiling};
my $dname = $duration->name;
my $mname = $max->name;
@@ -1669,7 +1672,7 @@
# if a patron is renewing, 'requestor' will be the patron
$circ->circ_staff($self->editor->requestor->id);
- $circ->due_date( $self->create_due_date($circ->duration) ) if $circ->duration;
+ $circ->due_date( $self->create_due_date($circ->duration, $duration_date_ceiling) ) if $circ->duration;
$self->circ($circ);
}
@@ -1869,7 +1872,7 @@
sub create_due_date {
- my( $self, $duration ) = @_;
+ my( $self, $duration, $date_ceiling ) = @_;
# if there is a raw time component (e.g. from postgres),
# turn it into an interval that interval_to_seconds can parse
@@ -1881,6 +1884,14 @@
# add the circ duration
$due_date->add(seconds => OpenSRF::Utils->interval_to_seconds($duration));
+ if($date_ceiling) {
+ my $cdate = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($date_ceiling));
+ if ($cdate > DateTime->now and $cdate < $due_date) {
+ $logger->info("circulator: overriding due date with date ceiling: $date_ceiling");
+ $due_date = $cdate;
+ }
+ }
+
# return ISO8601 time with timezone
return $due_date->strftime('%FT%T%z');
}
More information about the open-ils-commits
mailing list