[open-ils-commits] r12006 - in trunk/Open-ILS/src: perlmods/OpenILS/Application/Trigger sql/Pg

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jan 27 21:17:39 EST 2009


Author: miker
Date: 2009-01-27 21:17:38 -0500 (Tue, 27 Jan 2009)
New Revision: 12006

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm
   trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql
Log:
example validators; adding noop modules to the schema creation script

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm	2009-01-28 02:01:24 UTC (rev 12005)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm	2009-01-28 02:17:38 UTC (rev 12006)
@@ -2,4 +2,28 @@
 sub fourty_two { return 42 }
 sub NOOP_True { return 1 }
 sub NOOP_False { return 0 }
+
+sub CircIsOpen {
+    my $self = shift;
+    my $env = shift;
+
+    return defined($env->{target}->checkin_time) ? 0 : 1;
+}
+
+sub HoldIsAvailable {
+    my $self = shift;
+    my $env = shift;
+
+    my $t = $env->{target}->transit;
+
+    die "Transit object exists, but is not fleshed.  Add 'transit' to the environment in order to use this Validator."
+        if ($t && !ref($t));
+
+    if ($t) {
+        return (defined($env->{target}->capture_time) && defined($t->dest_recv_time)) ? 1 : 0;
+    }
+
+    return defined($env->{target}->capture_time) ? 1 : 0;
+}
+
 1;

Modified: trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql	2009-01-28 02:01:24 UTC (rev 12005)
+++ trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql	2009-01-28 02:17:38 UTC (rev 12006)
@@ -49,13 +49,17 @@
     module      TEXT    PRIMARY KEY, -- All live under the OpenILS::Trigger::Collector:: namespace
     description TEXT    
 );
-INSERT INTO action_trigger.collector (module,description) VALUES ('CircCountsByCircMod','Count of Circulations for a User, broken down by circulation modifier');
+INSERT INTO action_trigger.collector (module,description) VALUES ('fourty_two','Returns the answer to life, the universe and everything');
+--INSERT INTO action_trigger.collector (module,description) VALUES ('CircCountsByCircMod','Count of Circulations for a User, broken down by circulation modifier');
 
 -- Simple tests on an FM object from hook.core_type to test for "should we still do this."
 CREATE TABLE action_trigger.validator (
     module      TEXT    PRIMARY KEY, -- All live under the OpenILS::Trigger::Validator:: namespace
     description TEXT    
 );
+INSERT INTO action_trigger.validator (module,description) VALUES ('fourty_two','Returns the answer to life, the universe and everything');
+INSERT INTO action_trigger.validator (module,description) VALUES ('NOOP_True','Always returns true -- validation always passes');
+INSERT INTO action_trigger.validator (module,description) VALUES ('NOOP_False','Always returns false -- validation always fails');
 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');
 
@@ -64,6 +68,9 @@
     module      TEXT    PRIMARY KEY, -- All live under the OpenILS::Trigger::Reactor:: namespace
     description TEXT    
 );
+INSERT INTO action_trigger.reactor (module,description) VALUES ('fourty_two','Returns the answer to life, the universe and everything');
+INSERT INTO action_trigger.reactor (module,description) VALUES ('NOOP_True','Always returns true -- reaction always passes');
+INSERT INTO action_trigger.reactor (module,description) VALUES ('NOOP_False','Always returns false -- reaction always fails');
 INSERT INTO action_trigger.reactor (module,description) VALUES ('SendEmail','Send an email based on a user-defined template');
 INSERT INTO action_trigger.reactor (module,description) VALUES ('GenerateBatchOverduePDF','Output a batch PDF of overdue notices for printing');
 
@@ -72,6 +79,9 @@
     module      TEXT    PRIMARY KEY, -- All live under the OpenILS::Trigger::Cleanup:: namespace
     description TEXT    
 );
+INSERT INTO action_trigger.cleanup (module,description) VALUES ('fourty_two','Returns the answer to life, the universe and everything');
+INSERT INTO action_trigger.cleanup (module,description) VALUES ('NOOP_True','Always returns true -- cleanup always passes');
+INSERT INTO action_trigger.cleanup (module,description) VALUES ('NOOP_False','Always returns false -- cleanup always fails');
 INSERT INTO action_trigger.cleanup (module,description) VALUES ('ClearAllPending','Remove all future, pending notifications for this target');
 
 CREATE TABLE action_trigger.event_definition (



More information about the open-ils-commits mailing list