From 98d2995b1091cbaf982fd8e63ba53424512fddd5 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Fri, 13 Apr 2012 02:54:13 -0400 Subject: [PATCH] add more penalty related CSS hooks 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 Signed-off-by: Thomas Berezansky --- Open-ILS/xul/staff_client/server/patron/util.js | 26 ++++++++++++++++++++++ .../staff_client/server/skin/patron_display.css | 2 ++ 2 files changed, 28 insertions(+) diff --git a/Open-ILS/xul/staff_client/server/patron/util.js b/Open-ILS/xul/staff_client/server/patron/util.js index 19aab0fdf4..f6f2cd01b4 100644 --- a/Open-ILS/xul/staff_client/server/patron/util.js +++ b/Open-ILS/xul/staff_client/server/patron/util.js @@ -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) { diff --git a/Open-ILS/xul/staff_client/server/skin/patron_display.css b/Open-ILS/xul/staff_client/server/skin/patron_display.css index 5a0adbdafa..52cf9288da 100644 --- a/Open-ILS/xul/staff_client/server/skin/patron_display.css +++ b/Open-ILS/xul/staff_client/server/skin/patron_display.css @@ -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; } */ -- 2.11.0