<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>
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 (
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 $$
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;
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;
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;
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;
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;
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;
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;