Serials special status support for Items tab
authorDan Wells <dbw2@calvin.edu>
Fri, 14 Dec 2012 19:22:20 +0000 (14:22 -0500)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 13 Mar 2013 16:18:01 +0000 (12:18 -0400)
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 <dbw2@calvin.edu>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/locale/en-US/serial.properties
Open-ILS/xul/staff_client/server/serial/manage_items.js
Open-ILS/xul/staff_client/server/serial/manage_items.xul
Open-ILS/xul/staff_client/server/serial/serctrl_main.xul
Open-ILS/xul/staff_client/server/skin/serial.css

index 4134573..6f2543d 100644 (file)
 <!ENTITY staff.serial.ssub_editor.notes.label "Subscription Notes">
 <!ENTITY staff.serial.ssub_editor.notes.accesskey "N">
 <!ENTITY staff.serial.manage_dists.actions.cmd_add_sstr.label "Add Stream">
+<!ENTITY staff.serial.manage_items.actions.cmd_claim_items.label "Claim Item">
+<!ENTITY staff.serial.manage_items.actions.cmd_set_items_not_held.label "Set 'Not Held'">
+<!ENTITY staff.serial.manage_items.actions.cmd_set_items_not_published.label "Set 'Not Published'">
 <!ENTITY staff.serial.manage_dists.actions.cmd_delete_sstr.label "Delete Stream">
 <!ENTITY staff.serial.manage_items.actions.cmd_edit_items.label "Edit Item Attributes">
 <!ENTITY staff.serial.manage_items.actions.cmd_edit_items.accesskey "E">
index 917dd68..d41adb7 100644 (file)
@@ -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?
index 9b519b4..08a7135 100644 (file)
@@ -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);
+        }
     }
 }
 
index b9ddaea..6a838c0 100644 (file)
@@ -41,6 +41,9 @@ vim:noet:sw=4:ts=4:
         <menupopup id="serial_manage_items_popup">
             <menuitem command="cmd_edit_items" label="&staff.serial.manage_items.actions.cmd_edit_items.label;" accesskey="&staff.serial.manage_items.actions.cmd_edit_items.accesskey;"/>
             <menuitem command="cmd_reset_items" label="&staff.serial.manage_items.actions.cmd_reset_items.label;" />
+            <menuitem command="cmd_claim_items" label="&staff.serial.manage_items.actions.cmd_claim_items.label;" />
+            <menuitem command="cmd_set_items_not_published" label="&staff.serial.manage_items.actions.cmd_set_items_not_published.label;" />
+            <menuitem command="cmd_set_items_not_held" label="&staff.serial.manage_items.actions.cmd_set_items_not_held.label;" />
             <menuitem command="cmd_delete_items" label="&staff.serial.manage_items.actions.cmd_delete_items.label;" accesskey="&staff.serial.manage_items.actions.cmd_delete_items.accesskey;"/>
             <menuitem command="cmd_view_sitem_notes" label="&staff.serial.manage_items.actions.cmd_view_sitem_notes.label;" accesskey="&staff.serial.manage_items.actions.cmd_view_sitem_notes.accesskey;"/>
             <menuitem command="cmd_view_sdist_notes" label="&staff.serial.manage_items.actions.cmd_view_sdist_notes.label;" accesskey="&staff.serial.manage_items.actions.cmd_view_sdist_notes.accesskey;"/>
@@ -68,6 +71,9 @@ vim:noet:sw=4:ts=4:
                     <menupopup>
                         <menuitem command="cmd_edit_items" label="&staff.serial.manage_items.actions.cmd_edit_items.label;" accesskey="&staff.serial.manage_items.actions.cmd_edit_items.accesskey;"/>
                         <menuitem command="cmd_reset_items" label="&staff.serial.manage_items.actions.cmd_reset_items.label;" />
+                        <menuitem command="cmd_claim_items" label="&staff.serial.manage_items.actions.cmd_claim_items.label;" />
+                        <menuitem command="cmd_set_items_not_published" label="&staff.serial.manage_items.actions.cmd_set_items_not_published.label;" />
+                        <menuitem command="cmd_set_items_not_held" label="&staff.serial.manage_items.actions.cmd_set_items_not_held.label;" />
                         <menuitem command="cmd_delete_items" label="&staff.serial.manage_items.actions.cmd_delete_items.label;" accesskey="&staff.serial.manage_items.actions.cmd_delete_items.accesskey;"/>
                         <menuitem command="cmd_view_sitem_notes" label="&staff.serial.manage_items.actions.cmd_view_sitem_notes.label;" accesskey="&staff.serial.manage_items.actions.cmd_view_sitem_notes.accesskey;"/>
                         <menuitem command="cmd_view_sdist_notes" label="&staff.serial.manage_items.actions.cmd_view_sdist_notes.label;" accesskey="&staff.serial.manage_items.actions.cmd_view_sdist_notes.accesskey;"/>
index 34b0f31..456c7ad 100644 (file)
@@ -52,6 +52,7 @@ vim:noet:sw=4:ts=4:
                <command id="cmd_add_sstr"/>
                <command id="cmd_add_subscriptions"/>
                <command id="cmd_broken" />
+               <command id="cmd_claim_items"/>
                <command id="cmd_clear" />
                <command id="cmd_edit_items"/>
         <command id="cmd_edit_sdists"/>
@@ -74,6 +75,8 @@ vim:noet:sw=4:ts=4:
                <command id="cmd_refresh_list"/>
                <command id="cmd_replace_barcode"/>
         <command id="cmd_reset_items"/>
+        <command id="cmd_set_items_not_held"/>
+        <command id="cmd_set_items_not_published"/>
         <command id="cmd_set_sunit" />
         <command id="cmd_set_other_sunit" />
         <command id="cmd_show_all_libs" />
index 0414871..ca88a32 100644 (file)
@@ -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;
+}