adding invalidating stop_date column to usr_standing_penalty, which is checked by...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 19 May 2009 02:20:19 +0000 (02:20 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 19 May 2009 02:20:19 +0000 (02:20 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13206 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/fm_IDL.xml
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/005.schema.actors.sql
Open-ILS/src/sql/Pg/100.circ_matrix.sql
Open-ILS/src/sql/Pg/110.hold_matrix.sql

index 08b2c8d..17f4d2a 100644 (file)
@@ -1897,11 +1897,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
        <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>
index 91221d8..926541e 100644 (file)
@@ -125,6 +125,17 @@ INSERT INTO config.standing_penalty (id,name,label,block_list)
        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 (
index d8eb74d..9880efc 100644 (file)
@@ -497,6 +497,7 @@ CREATE TABLE actor.usr_standing_penalty (
        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 $$
index 892866f..33733e4 100644 (file)
@@ -321,6 +321,7 @@ BEGIN
                 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 @@ BEGIN
                   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 @@ BEGIN
                   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 @@ BEGIN
                   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 @@ BEGIN
                   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;
index d526830..a966737 100644 (file)
@@ -261,6 +261,7 @@ BEGIN
                 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 @@ BEGIN
                     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;