chaning status to reshelving if on-holds-shelf for a copy on a retargeted hold
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 11 Aug 2006 16:06:39 +0000 (16:06 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 11 Aug 2006 16:06:39 +0000 (16:06 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5469 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm

index cc47772..e6f8958 100644 (file)
@@ -784,25 +784,34 @@ sub reset_hold {
 }
 
 sub _reset_hold {
-       my ($self, $reqr, $hold, $session) = @_;
+       my ($self, $reqr, $hold) = @_;
 
-       my $x;
-       if(!$session) {
-               $x = 1;
-               $session = $U->start_db_session();
+       my $e = new_editor(xact =>1, requestor => $reqr);
+
+       if( $hold->capture_time and $hold->current_copy ) {
+
+               my $copy = $e->retrieve_asset_copy($hold->current_copy)
+                       or return $e->event;
+
+               if( $copy->status == OILS_COPY_STATUS_ON_HOLDS_SHELF ) {
+                       $logger->info("setting copy to status 'reshelving' on hold retarget");
+                       $copy->status(OILS_COPY_STATUS_RESHELVING);
+                       $copy->editor($e->requestor->id);
+                       $copy->edit_date('now');
+                       $e->update_asset_copy($copy) or return $e->event;
+               }
        }
 
        $hold->clear_capture_time;
        $hold->clear_current_copy;
 
-       return $U->DB_UPDATE_FAILED($hold) unless 
-               $session->request(
-                       'open-ils.storage.direct.action.hold_request.update', $hold )->gather(1);
+       $e->update_action_hold_request($hold) or return $e->event;
+
+       $e->commit;
 
-       $session->request(
-               'open-ils.storage.action.hold_request.copy_targeter', undef, $hold->id )->gather(1);
+       $U->storagereq(
+               'open-ils.storage.action.hold_request.copy_targeter', undef, $hold->id );
 
-       $U->commit_db_session($session) unless $x;
        return undef;
 }