added a circ flesher call
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 11 Oct 2006 21:18:11 +0000 (21:18 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 11 Oct 2006 21:18:11 +0000 (21:18 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6444 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ.pm

index 5c000f4..240043c 100644 (file)
@@ -932,6 +932,56 @@ sub magic_fetch {
 # ----------------------------------------------------------------------
 
 
+__PACKAGE__->register_method(
+       method  => "fleshed_circ_retrieve",
+       api_name        => "open-ils.circ.fleshed.retrieve",);
+
+sub fleshed_circ_retrieve {
+       my( $self, $client, $id ) = @_;
+       my $e = new_editor();
+       my $circ = $e->retrieve_action_circulation(
+               [
+                       $id,
+                       { 
+                               flesh                           => 4,
+                               flesh_fields    => { 
+                                       circ => [ qw/ target_copy / ],
+                                       acp => [ qw/ location status stat_cat_entry_copy_maps notes age_protect call_number / ],
+                                       ascecm => [ qw/ stat_cat stat_cat_entry / ],
+                                       acn => [ qw/ record / ],
+                               }
+                       }
+               ]
+       ) or return $e->event;
+       
+       my $copy = $circ->target_copy;
+       my $vol = $copy->call_number;
+       my $rec = $circ->target_copy->call_number->record;
+
+       $vol->record($rec->id);
+       $copy->call_number($vol->id);
+       $circ->target_copy($copy->id);
+
+       my $mvr;
+
+       if( $rec->id == OILS_PRECAT_RECORD ) {
+               $rec = undef;
+               $vol = undef;
+       } else { 
+               $mvr = $U->record_to_mvr($rec);
+               # trim the buly marc data
+               $rec->marc('');
+       }
+       
+
+       return {
+               circ => $circ,
+               copy => $copy,
+               volume => $vol,
+               record => $rec,
+               mvr => $mvr,
+       };
+}