add more penalty related CSS hooks
authorJason Etheridge <jason@esilibrary.com>
Fri, 13 Apr 2012 06:54:13 +0000 (02:54 -0400)
committerJason Etheridge <jason@esilibrary.com>
Fri, 13 Apr 2012 15:03:29 +0000 (11:03 -0400)
PATRON_HAS_CUSTOM_PENALTY (if the penalty is not a stock penalty, based on id)
PATRON_HAS_STAFF_ALERT (if the staff_alert boolean on the penalty is true)
PATRON_HAS_BLOCK (if there's anything in the penalty's block list)
PATRON_HAS_CIRC_BLOCK (if CIRC is in the block list)
PATRON_HAS_RENEW_BLOCK (if RENEW is in the block list)
PATRON_HAS_HOLD_BLOCK (if HOLD is in the block list)
PATRON_HAS_CAPTURE_BLOCK (if CAPTURE is in the block list)
PATRON_HAS_FULFILL_BLOCK (if FULFILL is in the block list)

also adds stock CSS for PATRON_HAS_STAFF_ALERT, a blue border around the patron
name.

In the color hierarchy, this comes after the normal Green/Lime status, but gets
trumped by any other penalty that sets a colored border.

So, for example, if a patron has no penalties, and you go to Messages and add an
"Alert" note, that equates to the penalty ALERT_NOTE, which has a staff_alert
setting of True.  On a refresh, the patron will then have a blue border around
their name.  If you then create a bill on that patron for $100, triggering the
PATRON_EXCEEDS_FINES penalty, then the patron will gain the normal purple or
lavender border, even though the penalty also has a staff_alert setting of True
and triggers PATRON_HAS_STAFF_ALERT CSS.

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Open-ILS/xul/staff_client/server/patron/util.js
Open-ILS/xul/staff_client/server/skin/patron_display.css

index 19aab0f..f6f2cd0 100644 (file)
@@ -703,6 +703,32 @@ patron.util.set_penalty_css = function(patron) {
         for (var i = 0; i < penalties.length; i++) {
             /* this comes from /opac/common/js/utils.js */
             addCSSClass(document.documentElement,penalties[i].standing_penalty().name());
+            if (penalties[i].standing_penalty().id() >= 100) {
+                addCSSClass(document.documentElement,'PATRON_HAS_CUSTOM_PENALTY');
+            }
+            if (get_bool( penalties[i].standing_penalty().staff_alert() )) {
+                addCSSClass(document.documentElement,'PATRON_HAS_STAFF_ALERT');
+            }
+            var block_list = penalties[i].standing_penalty().block_list();
+            if (block_list) {
+                addCSSClass(document.documentElement,'PATRON_HAS_BLOCK');
+                // TODO: futureproofing, split and loop on block_list to produce these classnames
+                if (block_list.match('CIRC')) {
+                    addCSSClass(document.documentElement,'PATRON_HAS_CIRC_BLOCK');
+                }
+                if (block_list.match('RENEW')) {
+                    addCSSClass(document.documentElement,'PATRON_HAS_RENEW_BLOCK');
+                }
+                if (block_list.match('HOLD')) {
+                    addCSSClass(document.documentElement,'PATRON_HAS_HOLD_BLOCK');
+                }
+                if (block_list.match('CAPTURE')) {
+                    addCSSClass(document.documentElement,'PATRON_HAS_CAPTURE_BLOCK');
+                }
+                if (block_list.match('FULFILL')) {
+                    addCSSClass(document.documentElement,'PATRON_HAS_FULFILL_BLOCK');
+                }
+            }
         }
 
         switch(penalties.length) {
index 5a0adbd..52cf928 100644 (file)
@@ -17,6 +17,8 @@ row#row_billing_zip { padding-bottom: 10px; }
 .MULTIPLE_PENALTIES .patronNameLarge { background-color: #CC3300; }
 */
 
+.PATRON_HAS_STAFF_ALERT .patronNameLarge { border: solid thick blue; padding: 10px; }
+
 .PATRON_HAS_BILLS .patronNameLarge { border: solid thick #FFC266; padding: 10px; }
 .PATRON_HAS_BILLS label.bill { color: #AA4400; }
 /* .PATRON_HAS_BILLS label.bill.label { text-decoration: underline; } */