From f9441fad3a8c7fb7d67fed2b59b499acb94bfa78 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Fri, 14 Dec 2012 14:22:20 -0500 Subject: [PATCH] Serials special status support for Items tab The Serial Control interface prevents direct editing of item status, as some status changes require additional updates and/or can create data conflicts. In the current state, though, we have no way to set three important statuses: claimed, not held, and not published. At some point, claims in particular should be more than a simple status, but in the meantime, the ability to set these should not be overlooked. Signed-off-by: Dan Wells Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/web/opac/locale/en-US/lang.dtd | 3 + .../server/locale/en-US/serial.properties | 3 + .../xul/staff_client/server/serial/manage_items.js | 83 +++++++++++++++++++++- .../staff_client/server/serial/manage_items.xul | 6 ++ .../staff_client/server/serial/serctrl_main.xul | 3 + Open-ILS/xul/staff_client/server/skin/serial.css | 9 +++ 6 files changed, 106 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 4134573bf1..6f2543d7b5 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -1749,6 +1749,9 @@ + + + diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties b/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties index 917dd682c7..d41adb7181 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties @@ -67,6 +67,9 @@ staff.serial.manage_dists.delete_sstr.override=Override Delete Failure? Doing so staff.serial.manage_items.subscriber.label=Subscriber staff.serial.manage_items.holder.label=Holder staff.serial.manage_items.notes_column.label=Notes (Item/Dist/Sub) +staff.serial.manage_items.set_claimed_success=Successfully claimed %1$s item(s) +staff.serial.manage_items.set_not_held_success=Successfully set %1$s item(s) to 'Not Held' +staff.serial.manage_items.set_not_published_success=Successfully set %1$s item(s) to 'Not Published' staff.serial.manage_subs.add.error=error adding object in manage_subs.js: staff.serial.manage_subs.delete.error=error deleting object in manage_subs.js: staff.serial.manage_subs.delete_scap.confirm=Are you sure you would like to delete this caption and pattern? diff --git a/Open-ILS/xul/staff_client/server/serial/manage_items.js b/Open-ILS/xul/staff_client/server/serial/manage_items.js index 9b519b4e0b..08a71356dc 100644 --- a/Open-ILS/xul/staff_client/server/serial/manage_items.js +++ b/Open-ILS/xul/staff_client/server/serial/manage_items.js @@ -280,6 +280,18 @@ serial.manage_items.prototype = { } } ], + 'cmd_claim_items' : [ + ['command'], + function () { obj.set_items_special_status('Claimed','staff.serial.manage_items.set_claimed_success') } + ], + 'cmd_set_items_not_published' : [ + ['command'], + function () { obj.set_items_special_status('Not Published','staff.serial.manage_items.set_not_published_success') } + ], + 'cmd_set_items_not_held' : [ + ['command'], + function () { obj.set_items_special_status('Not Held','staff.serial.manage_items.set_not_held_success') } + ], 'cmd_delete_items' : [ ['command'], function() { @@ -728,7 +740,7 @@ serial.manage_items.prototype = { if ($('serial_manage_items_show_all').checked) { obj.lists.main.sitem_retrieve_params = {}; } else { - obj.lists.main.sitem_retrieve_params = {'date_received' : null }; + obj.lists.main.sitem_retrieve_params = { 'date_received' : null, 'status' : {'not in' : ['Not Held', 'Not Published']} }; } obj.lists.main.sitem_extra_params ={'order_by' : {'sitem' : 'date_expected ASC, stream ASC'}}; @@ -797,6 +809,14 @@ serial.manage_items.prototype = { row.my.parent_obj = obj; //params.treeitem_node.setAttribute( 'retrieve_id', js2JSON({'copy_id':copy_id,'circ_id':row.my.circ.id(),'barcode':row.my.acp.barcode(),'doc_id': ( row.my.record ? row.my.record.id() : null ) }) ); params.treeitem_node.setAttribute( 'retrieve_id', js2JSON({'sitem_id':sitem.id()}) ); + if (sitem.status() == 'Claimed') { + params.treeitem_node.firstChild.setAttribute( 'properties', 'makeItGray' ); + } else if (sitem.status() == 'Not Held' || sitem.status() == 'Not Published') { + var treecells = params.treeitem_node.firstChild.childNodes; + for (i = 0; i < treecells.length; i++) { + treecells[i].setAttribute( 'properties', 'crossItOut' ); + } + } dump('dumping... ' + js2JSON(obj.list_sitem_map[sitem.id()])); if (typeof params.on_retrieve == 'function') { params.on_retrieve(row); @@ -899,6 +919,28 @@ serial.manage_items.prototype = { } }, + // accepts a list of ids or a list of objects + 'refresh_rows' : function(list) { + var obj = this; + + var id_list; + + if (typeof list[0] == 'object') { + id_list = util.functional.map_list( + list, + function(o) { + return o.id() + } + ); + } else { + id_list = list; + } + + for (var i = 0; i < id_list.length; i++) { + obj.lists[obj.selected_list].refresh_row(obj.row_map[id_list[i]]); + } + }, + 'retrieve' : function(list_name) { var obj = this; var list = obj.lists[list_name]; @@ -947,6 +989,15 @@ serial.manage_items.prototype = { dump('manage_items.on_select list = ' + js2JSON(list) + '\n'); var obj = this; + obj.controller.view.cmd_claim_items.setAttribute('disabled','false'); + + for (var i = 0; i < list.length; i++) { + var item = obj.list_sitem_map[list[i].sitem_id]; + if (item.status() != 'Expected') { + obj.controller.view.cmd_claim_items.setAttribute('disabled','true'); + break; + } + } /*obj.controller.view.cmd_items_claimed_returned.setAttribute('disabled','false'); obj.controller.view.sel_mark_items_missing.setAttribute('disabled','false');*/ @@ -1027,6 +1078,36 @@ serial.manage_items.prototype = { ); seen_ids[obj_id] = 1; } + }, + + 'set_items_special_status' : function(new_status, message) { + var obj = this; + try { + if (!obj.retrieve_ids || obj.retrieve_ids.length == 0) return; + + JSAN.use('util.functional'); + var list = util.functional.map_list( + obj.retrieve_ids, + function (o) { + var item = obj.list_sitem_map[o.sitem_id]; + item.status(new_status); + obj.list_sitem_map[o.sitem_id] = item; + return item; + } + ); + + var robj = obj.network.request( + 'open-ils.serial', + 'open-ils.serial.item.fleshed.batch.update', + [ ses(), list ] + ); + if (typeof robj.ilsevent != 'undefined') throw(robj); + + alert($('serialStrings').getFormattedString(message, [list.length])); + obj.refresh_rows(list); + } catch(E) { + obj.error.standard_unexpected_error_alert('staff.serial.manage_items.set_items_special_status.error',E); + } } } diff --git a/Open-ILS/xul/staff_client/server/serial/manage_items.xul b/Open-ILS/xul/staff_client/server/serial/manage_items.xul index b9ddaea8a6..6a838c0df5 100644 --- a/Open-ILS/xul/staff_client/server/serial/manage_items.xul +++ b/Open-ILS/xul/staff_client/server/serial/manage_items.xul @@ -41,6 +41,9 @@ vim:noet:sw=4:ts=4: + + + @@ -68,6 +71,9 @@ vim:noet:sw=4:ts=4: + + + diff --git a/Open-ILS/xul/staff_client/server/serial/serctrl_main.xul b/Open-ILS/xul/staff_client/server/serial/serctrl_main.xul index 34b0f31ebf..456c7ada2d 100644 --- a/Open-ILS/xul/staff_client/server/serial/serctrl_main.xul +++ b/Open-ILS/xul/staff_client/server/serial/serctrl_main.xul @@ -52,6 +52,7 @@ vim:noet:sw=4:ts=4: + @@ -74,6 +75,8 @@ vim:noet:sw=4:ts=4: + + diff --git a/Open-ILS/xul/staff_client/server/skin/serial.css b/Open-ILS/xul/staff_client/server/skin/serial.css index 0414871c95..ca88a32af4 100644 --- a/Open-ILS/xul/staff_client/server/skin/serial.css +++ b/Open-ILS/xul/staff_client/server/skin/serial.css @@ -27,3 +27,12 @@ groupbox { description#print_routing_desc { margin: 0; padding: 0 1em; } #pattern_wizard_main > vbox { padding: 0.5em 0; } #pattern_wizard_main { overflow: auto; } +treechildren::-moz-tree-row(makeItGray) { + background-color: #CCCCCC; +} +treechildren::-moz-tree-row(makeItGray, selected) { + background-color: #AAAAAA; +} +treechildren::-moz-tree-cell-text(crossItOut) { + text-decoration: line-through; +} -- 2.11.0