[open-ils-commits] r14588 - in trunk/Open-ILS/src: perlmods/OpenILS/Application/Trigger sql/Pg sql/Pg/upgrade (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Oct 23 21:05:52 EDT 2009
Author: miker
Date: 2009-10-23 21:05:50 -0400 (Fri, 23 Oct 2009)
New Revision: 14588
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0053.data.max-passive-delay-validator.sql
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql
trunk/Open-ILS/src/sql/Pg/upgrade/0052.schema.asset_copy_location_order.sql
Log:
add passive event validator to stop events that are too far past the delay_field-based timeout; add BEGIN to a previous upgrade script for correctness
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm 2009-10-23 22:34:17 UTC (rev 14587)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm 2009-10-24 01:05:50 UTC (rev 14588)
@@ -16,6 +16,19 @@
return defined($env->{target}->checkin_time) ? 0 : 1;
}
+sub MaxPassiveDelayAge {
+ my $self = shift;
+ my $env = shift;
+ my $target = $env->{target};
+ my $delay_field = $env->{event}->event_def->delay_field;
+
+ my $delay_field_ts = DateTime::Format::ISO8601->new->parse_datetime(clense_ISO8601($target->$delay_field()));
+ $delay_field_ts->add( seconds => interval_to_seconds( $env->{params}->{max_delay_age} ) );
+
+ return 0 if $delay_field_ts > DateTime->now;
+ return 1;
+}
+
sub CircIsOverdue {
my $self = shift;
my $env = shift;
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-10-23 22:34:17 UTC (rev 14587)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-10-24 01:05:50 UTC (rev 14588)
@@ -51,7 +51,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0052'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0053'); -- miker
CREATE TABLE config.bib_source (
Modified: trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql 2009-10-23 22:34:17 UTC (rev 14587)
+++ trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql 2009-10-24 01:05:50 UTC (rev 14588)
@@ -76,6 +76,7 @@
INSERT INTO action_trigger.validator (module,description) VALUES ('CircIsOpen','Check that the circulation is still open');
INSERT INTO action_trigger.validator (module,description) VALUES ('HoldIsAvailable','Check that an item is on the hold shelf');
INSERT INTO action_trigger.validator (module,description) VALUES ('CircIsOverdue','Check that the circulation is overdue');
+INSERT INTO action_trigger.validator (module,description) VALUES ('MaxPassiveDelayAge','Check that the event is not too far past the delay_field time -- requires a max_delay_age interval parameter');
-- After an event passes validation (action_trigger.validator), the reactor processes it.
CREATE TABLE action_trigger.reactor (
Modified: trunk/Open-ILS/src/sql/Pg/upgrade/0052.schema.asset_copy_location_order.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0052.schema.asset_copy_location_order.sql 2009-10-23 22:34:17 UTC (rev 14587)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0052.schema.asset_copy_location_order.sql 2009-10-24 01:05:50 UTC (rev 14588)
@@ -1,3 +1,5 @@
+BEGIN;
+
INSERT INTO config.upgrade_log (version) VALUES ('0052');
CREATE TABLE asset.copy_location_order
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0053.data.max-passive-delay-validator.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0053.data.max-passive-delay-validator.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0053.data.max-passive-delay-validator.sql 2009-10-24 01:05:50 UTC (rev 14588)
@@ -0,0 +1,8 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0053');
+
+INSERT INTO action_trigger.validator (module,description) VALUES ('MaxPassiveDelayAge','Check that the event is not too far past the delay_field time -- requires a max_delay_age interval parameter');
+
+COMMIT;
+
More information about the open-ils-commits
mailing list