[open-ils-commits] r15474 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Feb 8 15:18:17 EST 2010


Author: phasefx
Date: 2010-02-08 15:18:12 -0500 (Mon, 08 Feb 2010)
New Revision: 15474

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Log:
some cleanup of the change_hold_title method

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2010-02-08 19:49:10 UTC (rev 15473)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2010-02-08 20:18:12 UTC (rev 15474)
@@ -2354,30 +2354,27 @@
     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;



More information about the open-ils-commits mailing list