From 910856781add552db5b30b39bdfde135b3b31675 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 11 Aug 2008 17:06:35 +0000 Subject: [PATCH] allow the pickup lib on a hold to be altered (and subsequently put item into transit to new lib) given permissions. still need to put a perm-check in the opac to prevent giving the option git-svn-id: svn://svn.open-ils.org/ILS/trunk@10335 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../OpenILS/Application/Circ/Holds.pm | 34 +++++++++++++++++++ Open-ILS/src/sql/Pg/950.data.seed-values.sql | 1 + Open-ILS/web/opac/skin/default/js/holds.js | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index 7456a86368..c251dde5b2 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -542,12 +542,46 @@ sub update_hold { return $e->die_event unless $e->allowed('UPDATE_HOLD', $usr->home_ou); } + # -------------------------------------------------------------- + # if the hold is on the holds shelf and the pickup lib changes, + # we need to create a new transit + # -------------------------------------------------------------- + if( ($orig_hold->pickup_lib ne $hold->pickup_lib) and (_hold_status($e, $hold) == 4)) { + return $e->die_event unless $e->allowed('UPDATE_PICKUP_LIB_FROM_HOLDS_SHELF', $orig_hold->pickup_lib); + return $e->die_event unless $e->allowed('UPDATE_PICKUP_LIB_FROM_HOLDS_SHELF', $hold->pickup_lib); + my $evt = transit_hold($e, $orig_hold, $hold, + $e->retrieve_asset_copy($hold->current_copy)); + return $evt if $evt; + } + update_hold_if_frozen($self, $e, $hold, $orig_hold); $e->update_action_hold_request($hold) or return $e->die_event; $e->commit; return $hold->id; } +sub transit_hold { + my($e, $orig_hold, $hold, $copy) = @_; + my $src = $orig_hold->pickup_lib; + my $dest = $hold->pickup_lib; + + $logger->info("putting hold into transit on pickup_lib update"); + + my $transit = Fieldmapper::action::transit_copy->new; + $transit->source($src); + $transit->dest($dest); + $transit->target_copy($copy->id); + $transit->source_send_time('now'); + $transit->copy_status(OILS_COPY_STATUS_ON_HOLDS_SHELF); + + $copy->status(OILS_COPY_STATUS_IN_TRANSIT); + $copy->editor($e->requestor->id); + $copy->edit_date('now'); + + $e->create_action_transit_copy($transit) or return $e->die_event; + $e->update_asset_copy($copy) or return $e->die_event; + return undef; +} # if the hold is frozen, this method ensures that the hold is not "targeted", # that is, it clears the current_copy and prev_check_time to essentiallly diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 3a82100b59..a0a4f66ca9 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -1120,6 +1120,7 @@ INSERT INTO permission.perm_list (code) VALUES ('UPDATE_VOLUME_NOTE'); INSERT INTO permission.perm_list (code) VALUES ('UPDATE_VR_FORMAT'); INSERT INTO permission.perm_list (code) VALUES ('UPDATE_XML_TRANSFORM'); INSERT INTO permission.perm_list (code) VALUES ('MERGE_BIB_RECORDS'); +INSERT INTO permission.perm_list (code) VALUES ('UPDATE_PICKUP_LIB_FROM_HOLDS_SHELF'); INSERT INTO permission.grp_tree (id, name, parent, description, perm_interval, usergroup, application_perm) VALUES diff --git a/Open-ILS/web/opac/skin/default/js/holds.js b/Open-ILS/web/opac/skin/default/js/holds.js index b201d35c94..a96543a975 100644 --- a/Open-ILS/web/opac/skin/default/js/holds.js +++ b/Open-ILS/web/opac/skin/default/js/holds.js @@ -108,7 +108,7 @@ function _holdsUpdateEditHold() { setSelector(orgsel, hold.pickup_lib()); if( hold.capture_time() || status > 2 ) { - orgsel.disabled = true; + //orgsel.disabled = true; frozenbox.disabled = true; $('holds_frozen_thaw_input').disabled = true; -- 2.43.2