From: dbwells Date: Mon, 24 Jan 2011 23:19:53 +0000 (+0000) Subject: Expose (in a very basic way) existing serial item reset functionality, fix small... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2ff4b4d679cec7af750363863497d5782dc23656;p=evergreen%2Fbjwebb.git Expose (in a very basic way) existing serial item reset functionality, fix small bug in reset code (resetting an item with no unit) git-svn-id: svn://svn.open-ils.org/ILS/trunk@19275 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm b/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm index 0a94974cf..9612a7bd5 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm @@ -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; 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 120fc5d33..e7812378f 100644 --- a/Open-ILS/xul/staff_client/server/serial/manage_items.js +++ b/Open-ILS/xul/staff_client/server/serial/manage_items.js @@ -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() { 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 94a80977f..b218ff0fd 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,7 @@ vim:noet:sw=4:ts=4: + @@ -63,6 +64,7 @@ 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 0fe7d2160..376f27ce3 100644 --- a/Open-ILS/xul/staff_client/server/serial/serctrl_main.xul +++ b/Open-ILS/xul/staff_client/server/serial/serctrl_main.xul @@ -72,6 +72,7 @@ vim:noet:sw=4:ts=4: +