[open-ils-commits] r10335 - in trunk/Open-ILS: src/perlmods/OpenILS/Application/Circ src/sql/Pg web/opac/skin/default/js

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Aug 11 13:06:38 EDT 2008


Author: erickson
Date: 2008-08-11 13:06:35 -0400 (Mon, 11 Aug 2008)
New Revision: 10335

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
   trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
   trunk/Open-ILS/web/opac/skin/default/js/holds.js
Log:
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

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2008-08-11 17:05:16 UTC (rev 10334)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2008-08-11 17:06:35 UTC (rev 10335)
@@ -542,13 +542,47 @@
         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 
 # reset the hold.  If it is being activated, it runs the targeter in the background

Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2008-08-11 17:05:16 UTC (rev 10334)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2008-08-11 17:06:35 UTC (rev 10335)
@@ -1120,6 +1120,7 @@
 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

Modified: trunk/Open-ILS/web/opac/skin/default/js/holds.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/holds.js	2008-08-11 17:05:16 UTC (rev 10334)
+++ trunk/Open-ILS/web/opac/skin/default/js/holds.js	2008-08-11 17:06:35 UTC (rev 10335)
@@ -108,7 +108,7 @@
 	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;
 



More information about the open-ils-commits mailing list