added call args to open-ils.circ.hold.details.*.retrieve to allow the caller to scale...
authorBill Erickson <berick@esilibrary.com>
Wed, 26 Jan 2011 13:37:50 +0000 (08:37 -0500)
committerBill Erickson <berick@esilibrary.com>
Wed, 26 Jan 2011 13:37:50 +0000 (08:37 -0500)
Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm

index c95bafe..f2a2006 100644 (file)
@@ -2629,10 +2629,10 @@ __PACKAGE__->register_method(
 );
 
 sub uber_hold {
-       my($self, $client, $auth, $hold_id) = @_;
+       my($self, $client, $auth, $hold_id, $args) = @_;
        my $e = new_editor(authtoken=>$auth);
        $e->checkauth or return $e->event;
-    return uber_hold_impl($e, $hold_id);
+    return uber_hold_impl($e, $hold_id, $args);
 }
 
 __PACKAGE__->register_method(
@@ -2643,17 +2643,18 @@ __PACKAGE__->register_method(
 );
 
 sub batch_uber_hold {
-       my($self, $client, $auth, $hold_ids) = @_;
+       my($self, $client, $auth, $hold_ids, $args) = @_;
        my $e = new_editor(authtoken=>$auth);
        $e->checkauth or return $e->event;
-    $client->respond(uber_hold_impl($e, $_)) for @$hold_ids;
+    $client->respond(uber_hold_impl($e, $_, $args)) for @$hold_ids;
     return undef;
 }
 
 sub uber_hold_impl {
-    my($e, $hold_id) = @_;
+    my($e, $hold_id, $args) = @_;
 
        my $resp = {};
+    $args ||= {};
 
        my $hold = $e->retrieve_action_hold_request(
                [
@@ -2682,27 +2683,33 @@ sub uber_hold_impl {
        my $user = $hold->usr;
        $hold->usr($user->id);
 
-       my $card = $e->retrieve_actor_card($user->card)
-               or return $e->event;
 
-       my( $mvr, $volume, $copy ) = find_hold_mvr($e, $hold);
+       my( $mvr, $volume, $copy, $issuance, $bre ) = find_hold_mvr($e, $hold, $args->{suppress_mvr});
 
-       flesh_hold_notices([$hold], $e);
-       flesh_hold_transits([$hold]);
+       flesh_hold_notices([$hold], $e) unless $args->{suppress_notices};
+       flesh_hold_transits([$hold]) unless $args->{suppress_transits};
 
     my $details = retrieve_hold_queue_status_impl($e, $hold);
 
-    return {
+    my $resp = {
         hold           => $hold,
         copy           => $copy,
         volume         => $volume,
-        mvr            => $mvr,
-        patron_first   => $user->first_given_name,
-        patron_last    => $user->family_name,
-        patron_barcode => $card->barcode,
-        patron_alias   => $user->alias,
         %$details
     };
+
+    $resp->{mvr} = $mvr unless $args->{suppress_mvr};
+    unless($args->{suppress_patron_details}) {
+           my $card = $e->retrieve_actor_card($user->card) or return $e->event;
+        $resp->{patron_first}   = $user->first_given_name,
+        $resp->{patron_last}    = $user->family_name,
+        $resp->{patron_barcode} = $card->barcode,
+        $resp->{patron_alias}   = $user->alias,
+    };
+
+    $resp->{bre} = $bre if $args->{include_bre};
+
+    return $resp;
 }
 
 
@@ -2712,7 +2719,7 @@ sub uber_hold_impl {
 # hold is all about
 # -----------------------------------------------------
 sub find_hold_mvr {
-       my( $e, $hold ) = @_;
+       my( $e, $hold, $no_mvr ) = @_;
 
        my $tid;
        my $copy;
@@ -2761,7 +2768,7 @@ sub find_hold_mvr {
 
     # TODO return metarcord mvr for M holds
        my $title = $e->retrieve_biblio_record_entry($tid);
-       return ( $U->record_to_mvr($title), $volume, $copy, $issuance );
+       return ( ($no_mvr) ? undef : $U->record_to_mvr($title), $volume, $copy, $issuance, $title );
 }
 
 __PACKAGE__->register_method(