[open-ils-commits] r19276 - in branches/rel_2_0/Open-ILS: src/perlmods/OpenILS/Application xul/staff_client/server/serial (dbwells)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Jan 24 18:33:13 EST 2011


Author: dbwells
Date: 2011-01-24 18:33:07 -0500 (Mon, 24 Jan 2011)
New Revision: 19276

Modified:
   branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm
   branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/manage_items.js
   branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/manage_items.xul
   branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/serctrl_main.xul
Log:
Expose (in a very basic way) existing serial item reset functionality, fix small bug in reset code (resetting an item with no unit)

Apologies in advance if this shouldn't be backported at this point, but from my perspective, it is both high-value and low-risk.


Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm	2011-01-24 23:19:53 UTC (rev 19275)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm	2011-01-24 23:33:07 UTC (rev 19276)
@@ -1095,12 +1095,14 @@
             $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;

Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/manage_items.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/manage_items.js	2011-01-24 23:19:53 UTC (rev 19275)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/manage_items.js	2011-01-24 23:33:07 UTC (rev 19276)
@@ -206,6 +206,36 @@
                             }
                         }
                     ],
+                    '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() {

Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/manage_items.xul
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/manage_items.xul	2011-01-24 23:19:53 UTC (rev 19275)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/manage_items.xul	2011-01-24 23:33:07 UTC (rev 19276)
@@ -41,6 +41,7 @@
     <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 @@
                 <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;"/>

Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/serctrl_main.xul
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/serctrl_main.xul	2011-01-24 23:19:53 UTC (rev 19275)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/serctrl_main.xul	2011-01-24 23:33:07 UTC (rev 19276)
@@ -72,6 +72,7 @@
 		<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" />



More information about the open-ils-commits mailing list