From 88388c3dac21efb09c5988d8e1f408d55b096694 Mon Sep 17 00:00:00 2001 From: dbwells Date: Mon, 24 Jan 2011 23:33:07 +0000 Subject: [PATCH] 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. git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_2_0@19276 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Serial.pm | 10 +++++--- .../xul/staff_client/server/serial/manage_items.js | 30 ++++++++++++++++++++++ .../staff_client/server/serial/manage_items.xul | 2 ++ .../staff_client/server/serial/serctrl_main.xul | 1 + 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm b/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm index ac68ada789..d44219e864 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm @@ -1095,12 +1095,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 120fc5d337..e7812378f2 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 94a80977f2..b218ff0fdf 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 0fe7d21603..376f27ce3c 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: + -- 2.11.0