Add a "staff_alert" column to config.standing_penalty, and ...
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Tue, 10 Jan 2012 17:59:57 +0000 (12:59 -0500)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Tue, 10 Jan 2012 19:33:54 +0000 (14:33 -0500)
... consult this when deciding whether to show the stop sign page in the
patron interface of the staff client, rather than explicitly checking
for the id of the ALERT_NOTE config.standing_penalty.

Now only show the standing penalty if the staff_alert value is true,
instead of unconditionally showing it for all penalties with a
block_list value.  This allows staff to configure blocking penalties
that do not alert.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>

Open-ILS/examples/fm_IDL.xml
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0667.schema.alerting-penalties.sql [new file with mode: 0644]
Open-ILS/xul/staff_client/server/patron/display.js

index e9c6f1a..8c481ec 100644 (file)
@@ -2962,6 +2962,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field name="name"  reporter:datatype="text"/>
                        <field name="label"  reporter:datatype="text" oils_persist:i18n="true"/>
                        <field name="block_list" reporter:datatype="text"/>
+                       <field name="staff_alert" reporter:datatype="bool"/>
                        <field name="org_depth" reporter:datatype="int"/>
                </fields>
                <links/>
index 542d0ad..eaf5c15 100644 (file)
@@ -86,7 +86,7 @@ CREATE TRIGGER no_overlapping_deps
     BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
     FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
 
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0666', :eg_version); -- phasefx/miker
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0667', :eg_version); -- senator/berick
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
@@ -122,26 +122,27 @@ CREATE TABLE config.standing_penalty (
        name            TEXT    NOT NULL UNIQUE,
        label           TEXT    NOT NULL,
        block_list      TEXT,
+       staff_alert     BOOL    NOT NULL DEFAULT FALSE,
        org_depth       INTEGER
 );
-INSERT INTO config.standing_penalty (id,name,label,block_list)
-       VALUES (1,'PATRON_EXCEEDS_FINES','Patron exceeds fine threshold','CIRC|HOLD|RENEW');
-INSERT INTO config.standing_penalty (id,name,label,block_list)
-       VALUES (2,'PATRON_EXCEEDS_OVERDUE_COUNT','Patron exceeds max overdue item threshold','CIRC|HOLD|RENEW');
-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,block_list,staff_alert)
+       VALUES (1,'PATRON_EXCEEDS_FINES','Patron exceeds fine threshold','CIRC|HOLD|RENEW', TRUE);
+INSERT INTO config.standing_penalty (id,name,label,block_list,staff_alert)
+       VALUES (2,'PATRON_EXCEEDS_OVERDUE_COUNT','Patron exceeds max overdue item threshold','CIRC|HOLD|RENEW', TRUE);
+INSERT INTO config.standing_penalty (id,name,label,block_list,staff_alert)
+       VALUES (3,'PATRON_EXCEEDS_CHECKOUT_COUNT','Patron exceeds max checked out item threshold','CIRC', TRUE);
+INSERT INTO config.standing_penalty (id,name,label,block_list,staff_alert)
+       VALUES (4,'PATRON_EXCEEDS_COLLECTIONS_WARNING','Patron exceeds pre-collections warning fine threshold','CIRC|HOLD|RENEW', TRUE);
 
-INSERT INTO config.standing_penalty (id,name,label) VALUES (20,'ALERT_NOTE','Alerting Note, no blocks');
+INSERT INTO config.standing_penalty (id,name,label,staff_alert) VALUES (20,'ALERT_NOTE','Alerting Note, no blocks',TRUE);
 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');
+INSERT INTO config.standing_penalty (id,name,label,block_list,staff_alert) VALUES (22,'STAFF_C','Alerting block on Circ','CIRC');
+INSERT INTO config.standing_penalty (id,name,label,block_list,staff_alert) VALUES (23,'STAFF_CH','Alerting block on Circ and Hold','CIRC|HOLD', TRUE);
+INSERT INTO config.standing_penalty (id,name,label,block_list,staff_alert) VALUES (24,'STAFF_CR','Alerting block on Circ and Renew','CIRC|RENEW', TRUE);
+INSERT INTO config.standing_penalty (id,name,label,block_list,staff_alert) VALUES (25,'STAFF_CHR','Alerting block on Circ, Hold and Renew','CIRC|HOLD|RENEW', TRUE);
+INSERT INTO config.standing_penalty (id,name,label,block_list,staff_alert) VALUES (26,'STAFF_HR','Alerting block on Hold and Renew','HOLD|RENEW', TRUE);
+INSERT INTO config.standing_penalty (id,name,label,block_list,staff_alert) VALUES (27,'STAFF_H','Alerting block on Hold','HOLD', TRUE);
+INSERT INTO config.standing_penalty (id,name,label,block_list,staff_alert) VALUES (28,'STAFF_R','Alerting block on Renew','RENEW', TRUE);
 INSERT INTO config.standing_penalty (id,name,label) VALUES (29,'INVALID_PATRON_ADDRESS','Patron has an invalid address');
 INSERT INTO config.standing_penalty (id,name,label) VALUES (30,'PATRON_IN_COLLECTIONS','Patron has been referred to a collections agency');
 
diff --git a/Open-ILS/src/sql/Pg/upgrade/0667.schema.alerting-penalties.sql b/Open-ILS/src/sql/Pg/upgrade/0667.schema.alerting-penalties.sql
new file mode 100644 (file)
index 0000000..7a96137
--- /dev/null
@@ -0,0 +1,12 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('0667', :eg_version);
+
+ALTER TABLE config.standing_penalty ADD staff_alert BOOL NOT NULL DEFAULT FALSE;
+
+-- 20 is ALERT_NOTE
+-- for backwards compat, set all blocking penalties to alerts
+UPDATE config.standing_penalty SET staff_alert = TRUE 
+    WHERE id = 20 OR block_list IS NOT NULL;
+
+COMMIT;
index 1eec41f..2e17b8b 100644 (file)
@@ -963,7 +963,7 @@ patron.display.prototype = {
                 if (!penalties) { penalties = []; }
                 var dl_flag_opened = false;
                 for (var i = 0; i < penalties.length; i++) {
-                    if (penalties[i].standing_penalty().block_list() || penalties[i].standing_penalty().id() == 20 /* ALERT_NOTE */) {
+                    if (get_bool(penalties[i].standing_penalty().staff_alert())) {
                         if (!dl_flag_opened) {
                             msg += '<dl>';
                             dl_flag_opened = true;