From fd5c1c72290429f7a16f5b10c1417b87c2dc9449 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 3 Jun 2014 09:38:46 -0400 Subject: [PATCH] LP#1270289 Show cancel reason labels for lineitems/copies In the standard lineitem list page, display lineitem states as translatable strings instead of displaying the raw lineitem state code. Additionally, when the state is 'cancelled', display the cancel_reason label instead of "cancelled" to help differentiate between canceled and delayed items. Similarly, display the cancel reason label for canceled copies in the copy edit grid. Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier Signed-off-by: Ben Shum --- .../src/templates/acq/common/li_table.tt2 | 11 +++- .../web/js/ui/default/acq/common/li_table.js | 64 ++++++++++--------- 2 files changed, 44 insertions(+), 31 deletions(-) diff --git a/Open-ILS/src/templates/acq/common/li_table.tt2 b/Open-ILS/src/templates/acq/common/li_table.tt2 index 0a2151afd8..fd337418ee 100644 --- a/Open-ILS/src/templates/acq/common/li_table.tt2 +++ b/Open-ILS/src/templates/acq/common/li_table.tt2 @@ -208,7 +208,16 @@ - + + + + + + + + + + diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js index c98cec4a54..913f354237 100644 --- a/Open-ILS/web/js/ui/default/acq/common/li_table.js +++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js @@ -1207,41 +1207,45 @@ function AcqLiTable() { self.generateMakeRecTab( li.eg_bib_id(), 'copy_browser', row ); } - var state_cell = nodeByName("li_state", row); + var state_cell = nodeByName("li_state_" + li.state(), row); - switch(li.state()) { + // re-hide any state label nodes which may have been un-hidden + // through previous actions. + dojo.query('[state-label]', row).forEach(function(node) { + openils.Util.hide(node) + }); - case 'cancelled': - if(typeof li.cancel_reason() == "object") { - var holds_state = dojo.create( - "span", { - "style": "border-bottom: 1px dashed #000;", - "innerHTML": li.state() - }, state_cell, "only" - ); - new dijit.Tooltip( - { - "label": "" + li.cancel_reason().label() + - "
" + li.cancel_reason().description(), - "connectId": [holds_state] - }, dojo.create("span", null, state_cell, "last") - ); + if (li.state() == 'cancelled') { + if(typeof li.cancel_reason() == "object") { - if (li.cancel_reason().keep_debits() == 't') { - openils.Util.removeCSSClass(row, /^oils-acq-li-state-/); - openils.Util.addCSSClass(row, "oils-acq-li-state-delayed"); - } - } - return; // all done + // clear the stock "Canceled" label, since we have more + // information to replace it with. + state_cell.innerHTML = ''; - case "on-order": - break; + var holds_state = dojo.create( + "span", { + "style": "border-bottom: 1px dashed #000;", + "innerHTML": li.cancel_reason().label() + }, state_cell, "only" + ); + new dijit.Tooltip( + { + "label": "" + li.cancel_reason().label() + + "
" + li.cancel_reason().description(), + "connectId": [holds_state] + }, dojo.create("span", null, state_cell, "last") + ); - case "received": - break; - } + if (li.cancel_reason().keep_debits() == 't') { + openils.Util.removeCSSClass(row, /^oils-acq-li-state-/); + openils.Util.addCSSClass(row, "oils-acq-li-state-delayed"); + } + } else { + console.log('li cancel_reason is un-fleshed. Please fix'); + } + } - state_cell.innerHTML = li.state(); // TODO i18n state labels + openils.Util.show(state_cell); }; @@ -2468,7 +2472,7 @@ function AcqLiTable() { var holds_reason = dojo.create( "span", { "style": "border-bottom: 1px dashed #000;", - "innerHTML": "Cancelled" /* XXX [sic] and i18n */ + "innerHTML": copy.cancel_reason().label() }, cxl_reason_link, "only" ); new dijit.Tooltip( -- 2.43.2