From 86de50b9d8bb19aacd2b70a04435c4056c3e7983 Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 8 Feb 2010 20:18:12 +0000 Subject: [PATCH] some cleanup of the change_hold_title method git-svn-id: svn://svn.open-ils.org/ILS/trunk@15474 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Circ/Holds.pm | 37 ++++++++++------------ 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index 327b63d3dc..6f98016316 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -2354,30 +2354,27 @@ sub change_hold_title { my $e = new_editor(authtoken=>$auth, xact=>1); return $e->event unless $e->checkauth; - my $holds = $e->json_query({ - "select"=>{"ahr"=>["id"]}, - "from"=>"ahr", - "where"=>{ - cancel_time => undef, - fulfillment_time => undef, - hold_type => 'T', - target => $bib_ids + my $holds = $e->search_action_hold_request( + [ + { + cancel_time => undef, + fulfillment_time => undef, + hold_type => 'T', + target => $bib_ids + },{ + flesh => 1, + flesh_fields => {ahr => ['usr']} + } + ], { + substream => 1 } - }); + ); - for my $hold_id (@$holds) { - my $hold = $e->retrieve_action_hold_request([$hold_id->{id}, { - flesh=> 1, - flesh_fields=>{ahr=>['usr']} - } - ]); - $e->allowed('UPDATE_HOLD', $hold->usr->home_ou) or return $e->event; + for my $hold (@$holds) { + $e->allowed('UPDATE_HOLD', $hold->usr->home_ou) or return $e->die_event; $logger->info("Changing hold " . $hold->id . " target from " . $hold->target . " to $new_bib_id in title hold target change"); $hold->target( $new_bib_id ); - unless ($e->update_action_hold_request($hold)) { - my $evt = $e->event; - $logger->error("Error updating hold " . $evt->textcode . ":" . $evt->desc . ":" . $evt->stacktrace); - } + $e->update_action_hold_request($hold) or return $e->die_event; } $e->commit; -- 2.11.0