[open-ils-commits] r13206 - in trunk/Open-ILS: examples src/sql/Pg (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon May 18 22:20:20 EDT 2009


Author: miker
Date: 2009-05-18 22:20:19 -0400 (Mon, 18 May 2009)
New Revision: 13206

Modified:
   trunk/Open-ILS/examples/fm_IDL.xml
   trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
   trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql
   trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql
   trunk/Open-ILS/src/sql/Pg/110.hold_matrix.sql
Log:
adding invalidating stop_date column to usr_standing_penalty, which is checked by circ/hold stored procs.  ML code (circ/hold/renew scripts) will need to do the same.

Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml	2009-05-18 21:07:14 UTC (rev 13205)
+++ trunk/Open-ILS/examples/fm_IDL.xml	2009-05-19 02:20:19 UTC (rev 13206)
@@ -1897,11 +1897,12 @@
 	<class id="ausp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::user_standing_penalty" oils_persist:tablename="actor.usr_standing_penalty" oils_persist:restrict_primary="100" reporter:label="User Standing Penalty">
 		<fields oils_persist:primary="id" oils_persist:sequence="actor.usr_standing_penalty_id_seq">
 			<field name="id" reporter:datatype="id" reporter:label="ID" />
-			<field name="set_date"  reporter:datatype="timestamp" reporter:label="Set Date"/>
+			<field name="set_date" reporter:datatype="timestamp" reporter:label="Set Date"/>
 			<field name="usr" reporter:datatype="link" reporter:label="User"/>
 			<field name="staff" reporter:datatype="link" reporter:label="Staff"/>
 			<field name="standing_penalty" reporter:datatype="link" reporter:label="Standing Penalty"/>
 			<field name="org_unit" reporter:datatype="link" reporter:label="Org Unit"/>
+			<field name="stop_date" reporter:datatype="timestamp" reporter:label="Stop Date"/>
 			<field name="note" reporter:datatype="text" reporter:label="Note"/>
 		</fields>
 		<links>

Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2009-05-18 21:07:14 UTC (rev 13205)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2009-05-19 02:20:19 UTC (rev 13206)
@@ -125,6 +125,17 @@
 	VALUES (3,'PATRON_EXCEEDS_CHECKOUT_COUNT','Patron exceeds max checked out item threshold','CIRC');
 INSERT INTO config.standing_penalty (id,name,label,block_list)
 	VALUES (4,'PATRON_EXCEEDS_COLLECTIONS_WARNING','Patron exceeds pre-collections warning fine threshold','CIRC|HOLD|RENEW');
+
+INSERT INTO config.standing_penalty (id,name,label) VALUES (20,'ALERT_NOTE','Alerting Note, no blocks');
+INSERT INTO config.standing_penalty (id,name,label) VALUES (21,'SILENT_NOTE','Note, no blocks');
+INSERT INTO config.standing_penalty (id,name,label,block_list) VALUES (22,'STAFF_C','Alerting block on Circ','CIRC');
+INSERT INTO config.standing_penalty (id,name,label,block_list) VALUES (23,'STAFF_CH','Alerting block on Circ and Hold','CIRC|HOLD');
+INSERT INTO config.standing_penalty (id,name,label,block_list) VALUES (24,'STAFF_CR','Alerting block on Circ and Renew','CIRC|RENEW');
+INSERT INTO config.standing_penalty (id,name,label,block_list) VALUES (25,'STAFF_CHR','Alerting block on Circ, Hold and Renew','CIRC|HOLD|RENEW');
+INSERT INTO config.standing_penalty (id,name,label,block_list) VALUES (26,'STAFF_HR','Alerting block on Hold and Renew','HOLD|RENEW');
+INSERT INTO config.standing_penalty (id,name,label,block_list) VALUES (27,'STAFF_H','Alerting block on Hold','HOLD');
+INSERT INTO config.standing_penalty (id,name,label,block_list) VALUES (28,'STAFF_R','Alerting block on Renew','RENEW');
+
 SELECT SETVAL('config.standing_penalty_id_seq', 100);
 
 CREATE TABLE config.xml_transform (

Modified: trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql	2009-05-18 21:07:14 UTC (rev 13205)
+++ trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql	2009-05-19 02:20:19 UTC (rev 13206)
@@ -497,6 +497,7 @@
 	standing_penalty	INT	NOT NULL REFERENCES config.standing_penalty (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
 	staff			INT	REFERENCES actor.usr (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
 	set_date		TIMESTAMP WITH TIME ZONE	DEFAULT NOW(),
+	stop_date		TIMESTAMP WITH TIME ZONE,
 	note			TEXT
 );
 COMMENT ON TABLE actor.usr_standing_penalty IS $$

Modified: trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql	2009-05-18 21:07:14 UTC (rev 13205)
+++ trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql	2009-05-19 02:20:19 UTC (rev 13206)
@@ -321,6 +321,7 @@
                 JOIN config.standing_penalty csp ON (csp.id = usp.standing_penalty)
           WHERE usr = match_user
                 AND usp.org_unit IN ( SELECT * FROM explode_array(context_org_list) )
+                AND (usp.stop_date IS NULL or usp.stop_date > NOW())
                 AND csp.block_list LIKE penalty_type LOOP
 
         result.fail_part := standing_penalty.name;
@@ -421,6 +422,7 @@
                   FROM  actor.usr_standing_penalty
                   WHERE usr = match_user
                         AND org_unit = max_fines.org_unit
+                        AND (stop_date IS NULL or stop_date > NOW())
                         AND standing_penalty = 1
                 LOOP
             RETURN NEXT existing_sp_row;
@@ -485,6 +487,7 @@
                   FROM  actor.usr_standing_penalty
                   WHERE usr = match_user
                         AND org_unit = max_overdue.org_unit
+                        AND (stop_date IS NULL or stop_date > NOW())
                         AND standing_penalty = 2
                 LOOP
             RETURN NEXT existing_sp_row;
@@ -543,6 +546,7 @@
                   FROM  actor.usr_standing_penalty
                   WHERE usr = match_user
                         AND org_unit = max_items_out.org_unit
+                        AND (stop_date IS NULL or stop_date > NOW())
                         AND standing_penalty = 3
                 LOOP
             RETURN NEXT existing_sp_row;
@@ -598,6 +602,7 @@
                   FROM  actor.usr_standing_penalty
                   WHERE usr = match_user
                         AND org_unit = max_fines.org_unit
+                        AND (stop_date IS NULL or stop_date > NOW())
                         AND standing_penalty = 4
                 LOOP
             RETURN NEXT existing_sp_row;

Modified: trunk/Open-ILS/src/sql/Pg/110.hold_matrix.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/110.hold_matrix.sql	2009-05-18 21:07:14 UTC (rev 13205)
+++ trunk/Open-ILS/src/sql/Pg/110.hold_matrix.sql	2009-05-19 02:20:19 UTC (rev 13206)
@@ -261,6 +261,7 @@
                 JOIN config.standing_penalty csp ON (csp.id = usp.standing_penalty)
           WHERE usr = match_user
                 AND usp.org_unit IN ( SELECT * FROM explode_array(context_org_list) )
+                AND (usp.stop_date IS NULL or usp.stop_date > NOW())
                 AND csp.block_list LIKE '%HOLD%' LOOP
 
         result.fail_part := standing_penalty.name;
@@ -276,6 +277,7 @@
                     JOIN config.standing_penalty csp ON (csp.id = usp.standing_penalty)
               WHERE usr = match_user
                     AND usp.org_unit IN ( SELECT * FROM explode_array(context_org_list) )
+                    AND (usp.stop_date IS NULL or usp.stop_date > NOW())
                     AND csp.block_list LIKE '%CIRC%' LOOP
     
             result.fail_part := standing_penalty.name;



More information about the open-ils-commits mailing list