moving another hold fetch inside a xact block
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 21 Jan 2007 19:03:42 +0000 (19:03 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 21 Jan 2007 19:03:42 +0000 (19:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6796 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm

index 0a93498..285fb2e 100644 (file)
@@ -746,10 +746,6 @@ sub new_hold_copy_targeter {
 
        for my $hold (@$holds) {
                try {
-                       #first, re-fetch the hold, to make sure it's not captured already
-                       $hold = action::hold_request->retrieve( $hold->id );
-                       die "OK\n" if (!$hold or $hold->capture_time);
-
                        #start a transaction if needed
                        if ($self->method_lookup('open-ils.storage.transaction.current')->run) {
                                $log->debug("Cleaning up after previous transaction\n");
@@ -758,6 +754,10 @@ sub new_hold_copy_targeter {
                        $self->method_lookup('open-ils.storage.transaction.begin')->run( $client );
                        $log->info("Processing hold ".$hold->id."...\n");
 
+                       #first, re-fetch the hold, to make sure it's not captured already
+                       $hold = action::hold_request->retrieve( $hold->id );
+                       die "OK\n" if (!$hold or $hold->capture_time);
+
                        # remove old auto-targeting maps
                        my @oldmaps = action::hold_copy_map->search( hold => $hold->id );
                        $_->delete for (@oldmaps);