added a callnumber fetching method with accompanying volume_not_found event
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 17 Jan 2006 15:08:13 +0000 (15:08 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 17 Jan 2006 15:08:13 +0000 (15:08 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2732 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/extras/ils_events.xml
Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm
Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm

index b3bd586..d706385 100644 (file)
                </desc>
        </event>
 
+       <event code='1506' textcode='VOLUME_NOT_FOUND'>
+               <desc>
+                       Someone attempted to retrieve a volume object from the 
+                       system and the object was not found.
+               </desc>
+       </event>
+
+
 
        <!-- ================================================================ -->
        <!-- CIRC EVENTS -->
index ceb572f..bbb3c2a 100644 (file)
@@ -6,6 +6,7 @@ use OpenSRF::EX qw(:try);
 use OpenILS::Perm;
 use OpenSRF::Utils::Logger;
 use OpenILS::Utils::ModsParser;
+use OpenILS::Event;
 my $logger = "OpenSRF::Utils::Logger";
 
 
@@ -596,4 +597,17 @@ sub fetch_copy_locations {
                'open-ils.storage.direct.asset.copy_location.retrieve.all.atomic');
 }
 
+sub fetch_callnumber {
+       my( $self, $id ) = @_;
+       my $evt = undef;
+       $logger->debug("Fetching callnumber $id");
+
+       my $cn = $self->simplereq(
+               'open-ils.storage',
+               'open-ils.storage.direct.asset.call_number.retrieve', $id );
+       $evt = OpenILS::Event->new( 'VOLUME_NOT_FOUND', id => $id ) unless $cn;
+
+       return ( $cn, $evt );
+}
+
 1;
index 1a290d9..65acd80 100644 (file)
@@ -1238,6 +1238,20 @@ sub cn_browse {
 }
 # -------------------------------------------------------------------------------------
 
+__PACKAGE__->register_method(
+       method => "fetch_cn",
+       api_name => "open-ils.search.callnumber.retrieve",
+       notes           => "retrieves a callnumber based on ID",
+       );
+
+sub fetch_cn {
+       my( $self, $client, $id ) = @_;
+       my( $cn, $evt ) = $apputils->fetch_callnumber( $id );
+       return $evt if $evt;
+       return $cn;
+}
+
+