Expose (in a very basic way) existing serial item reset functionality, fix small...
authordbwells <dbwells@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 24 Jan 2011 23:19:53 +0000 (23:19 +0000)
committerdbwells <dbwells@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 24 Jan 2011 23:19:53 +0000 (23:19 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@19275 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Serial.pm
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

index 0a94974..9612a7b 100644 (file)
@@ -1222,12 +1222,14 @@ sub unitize_items {
             $item->unit($unit_id);
         }
 
-        $found_unit_ids{$unit_id} = 1;
         $found_stream_ids{$stream_id} = 1;
 
-        # save the stream_id for this unit_id
-        # TODO: prevent items from different streams in same unit? (perhaps in interface)
-        $stream_ids_by_unit_id{$unit_id} = $stream_id;
+        if (defined($unit_id)) {
+            $found_unit_ids{$unit_id} = 1;
+            # save the stream_id for this unit_id
+            # TODO: prevent items from different streams in same unit? (perhaps in interface)
+            $stream_ids_by_unit_id{$unit_id} = $stream_id;
+        }
 
         my $evt = _update_sitem($editor, undef, $item);
         return $evt if $evt;
index 120fc5d..e781237 100644 (file)
@@ -206,6 +206,36 @@ serial.manage_items.prototype = {
                             }
                         }
                     ],
+                    'cmd_reset_items' : [
+                        ['command'],
+                        function() {
+                            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) {
+                                            return o.sitem_id;
+                                        }
+                                    );
+
+                                var robj = obj.network.request(
+                                            'open-ils.serial',
+                                            'open-ils.serial.reset_items',
+                                            [ ses(), list ]
+                                        );
+                                if (typeof robj.ilsevent != 'undefined') throw(robj);
+
+                                alert('Successfully reset '+robj.num_items+' item(s)');
+
+                                obj.refresh_list('main');
+                                obj.refresh_list('workarea');
+                            } catch(E) {
+                                obj.error.standard_unexpected_error_alert('staff.serial.manage_items.reset_items.error',E);
+                            }
+                        }
+                    ],
                     'cmd_delete_items' : [
                         ['command'],
                         function() {
index 94a8097..b218ff0 100644 (file)
@@ -41,6 +41,7 @@ vim:noet:sw=4:ts=4:
     <popupset>
         <popup id="serial_manage_items_popup">
             <menuitem command="cmd_edit_items" label="Edit Item Attributes" accesskey="&staff.cat.copy_browser.actions.cmd_edit_items.accesskey;"/>
+            <menuitem command="cmd_reset_items" label="Reset Item to Expected" />
             <menuitem command="cmd_delete_items" label="Delete Item" accesskey="&staff.cat.copy_browser.actions.cmd_delete_items.accesskey;"/>
         </popup>
     </popupset>
@@ -63,6 +64,7 @@ vim:noet:sw=4:ts=4:
                 <menu label="&staff.cat.copy_browser.holdings_maintenance.actions.label;" accesskey="&staff.cat.copy_browser.holdings_maintenance.actions.accesskey;">
                     <menupopup>
                         <menuitem command="cmd_edit_items" label="Edit Item Attributes" accesskey="&staff.cat.copy_browser.actions.cmd_edit_items.accesskey;"/>
+                        <menuitem command="cmd_reset_items" label="Reset Item to Expected" />
                         <menuitem command="cmd_delete_items" label="Delete Item" accesskey="&staff.cat.copy_browser.actions.cmd_delete_items.accesskey;"/>
                         <menuseparator/>
                         <menuitem command="cmd_refresh_list" label="&staff.cat.copy_browser.holdings_maintenance.cmd_refresh_list.label;" accesskey="&staff.cat.copy_browser.holdings_maintenance.cmd_refresh_list.accesskey;"/>
index 0fe7d21..376f27c 100644 (file)
@@ -72,6 +72,7 @@ vim:noet:sw=4:ts=4:
                <command id="cmd_receive_items"/>
                <command id="cmd_refresh_list"/>
                <command id="cmd_replace_barcode"/>
+        <command id="cmd_reset_items"/>
         <command id="cmd_set_sunit" />
         <command id="cmd_set_other_sunit" />
         <command id="cmd_show_all_libs" />