From 4577ebb5df391b35a60642a5bb1d369683bf6c35 Mon Sep 17 00:00:00 2001 From: miker Date: Sun, 21 Jan 2007 19:03:42 +0000 Subject: [PATCH] moving another hold fetch inside a xact block git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_0@6796 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Storage/Publisher/action.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm index 0ebb08d3be..14c1b241f9 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm @@ -687,6 +687,7 @@ sub new_hold_copy_targeter { try { if ($one_hold) { + $self->method_lookup('open-ils.storage.transaction.begin')->run( $client ); $holds = [ action::hold_request->search_where( { id => $one_hold, fulfillment_time => undef, cancel_time => undef } ) ]; } elsif ( $check_expire ) { @@ -744,10 +745,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"); @@ -756,6 +753,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); -- 2.11.0