[open-ils-commits] r12352 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Mar 2 12:27:35 EST 2009
Author: erickson
Date: 2009-03-02 12:27:32 -0500 (Mon, 02 Mar 2009)
New Revision: 12352
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm
Log:
added CircIsOverdue validator
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm 2009-03-02 16:50:21 UTC (rev 12351)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm 2009-03-02 17:27:32 UTC (rev 12352)
@@ -1,4 +1,6 @@
package OpenILS::Application::Trigger::Validator;
+use DateTime;
+use DateTime::Format::ISO8601;
sub fourty_two { return 42 }
sub NOOP_True { return 1 }
sub NOOP_False { return 0 }
@@ -10,6 +12,16 @@
return defined($env->{target}->checkin_time) ? 0 : 1;
}
+sub CircIsOverdue {
+ my $self;
+ my $env;
+ my $circ = $env->{target};
+ return 0 if $circ->checkin_time;
+ return 0 if $circ->stop_fines and not $circ->stop_fines =~ /MAXFINES|LONGOVERDUE/;
+ return 0 if DateTime::Format::ISO8601->new->parse_datetime($circ->due_date) < DateTime->now;
+ return 1;
+}
+
sub HoldIsAvailable {
my $self = shift;
my $env = shift;
More information about the open-ils-commits
mailing list