circ rules fixups
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 Apr 2005 22:07:02 +0000 (22:07 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 Apr 2005 22:07:02 +0000 (22:07 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@579 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/config.pm

index 53d91b7..fb1a68d 100644 (file)
@@ -309,6 +309,7 @@ sub modify_from_fieldmapper {
        asset::copy->has_a( editor => 'actor::user' );
        asset::copy->has_a( status => 'config::copy_status' );
        asset::copy->has_a( location => 'asset::copy_location' );
+       asset::copy->has_a( circ_lib => 'actor::org_unit' );
 
        asset::call_number_note->has_a( owning_call_number => 'asset::call_number' );
 
index 95c7f83..15e082e 100644 (file)
@@ -26,8 +26,8 @@
        #---------------------------------------------------------------------
        package config::copy_status;
        
-       config::standing->table( 'config.copy_status' );
-       config::standing->sequence( 'config.copy_status_id_seq' );
+       config::copy_status->table( 'config.copy_status' );
+       config::copy_status->sequence( 'config.copy_status_id_seq' );
 
        #---------------------------------------------------------------------
        package config::rules::circ_duration;
        #---------------------------------------------------------------------
        package asset::copy_location;
        
-       asset::copy->table( 'asset.copy_location' );
-       asset::copy->sequence( 'asset.copy_location_id_seq' );
+       asset::copy_location->table( 'asset.copy_location' );
+       asset::copy_location->sequence( 'asset.copy_location_id_seq' );
 
        #---------------------------------------------------------------------
        package asset::copy;
index cf6215e..5944ce3 100644 (file)
@@ -95,9 +95,10 @@ sub retrieve_node {
                next unless ($id);
 
                my ($rec) = $cdbi->fast_fieldmapper($id);
-               $client->respond( $rec ) if ($rec);
-
-               last if ($self->api_name !~ /batch/o);
+               if ($self->api_name !~ /batch/o) {
+                       return $rec if ($rec);
+               }
+               $client->respond($rec);
        }
        return undef;
 }
@@ -131,6 +132,9 @@ sub search_one_field {
 
        for my $term (@terms) {
                $log->debug("Searching $cdbi for $col using type $search_type, value '$term'",DEBUG);
+               if (@terms == 1) {
+                       return [ $cdbi->fast_fieldmapper($term,$col,$like) ];
+               }
                $client->respond( [ $cdbi->fast_fieldmapper($term,$col,$like) ] );
        }
        return undef;
index b09175c..8e91f35 100644 (file)
@@ -6,4 +6,44 @@ use base qw/OpenILS::Application::Storage/;
 #
 #my $log = 'OpenSRF::Utils::Logger';
 
+sub fleshed_copy {
+       my $self = shift;
+       my $client = shift;
+       my $id = ''.shift;
+
+       my $cp = asset::copy->retrieve($id);
+
+       my $cp_fm = $cp->to_fieldmapper;
+       $cp_fm->circ_lib( $cp->circ_lib->to_fieldmapper );
+       $cp_fm->location( $cp->location->to_fieldmapper );
+       return $cp_fm;
+}
+__PACKAGE__->register_method(
+       api_name        => 'open-ils.storage.fleshed.asset.copy.retrieve',
+       method          => 'fleshed_copy',
+       argc            => 1,
+);
+
+sub fleshed_copy_by_barcode {
+       my $self = shift;
+       my $client = shift;
+       my $bc = ''.shift;
+
+       my ($cp) = asset::copy->search( { barcode => $bc } );
+
+       my $cp_fm = $cp->to_fieldmapper;
+       $cp_fm->circ_lib( $cp->circ_lib->to_fieldmapper );
+       $cp_fm->location( $cp->location->to_fieldmapper );
+       $cp_fm->status( $cp->status->to_fieldmapper );
+
+       return [ $cp_fm ];
+}      
+__PACKAGE__->register_method(
+       api_name        => 'open-ils.storage.fleshed.asset.copy.search.barcode',
+       method          => 'fleshed_copy_by_barcode',
+       argc            => 1,
+       stream          => 1,
+);
+
+
 1;
index 4cdd0aa..d9c7fb4 100644 (file)
@@ -73,12 +73,17 @@ sub record_by_copy {
                  WHERE cp.id = ?
        SQL
 
-       return biblio::record_entry->retrieve( $r )->to_fieldmapper;
+       my $rec = biblio::record_entry->retrieve( $r );
+       my $r_fm = $rec->to_fieldmapper;
+       $r_fm->fixed_fields( $rec->record_descriptor->next->to_fieldmapper );
+
+       return $r_fm;
 }
 __PACKAGE__->register_method(
-       api_name        => 'open-ils.storage.biblio.record_entry.retrieve_by_copy',
+       api_name        => 'open-ils.storage.fleshed.biblio.record_entry.retrieve_by_copy',
        method          => 'record_by_copy',
        api_level       => 1,
+       cachable        => 1,
 );
 
 
index b4981f6..8897fb3 100644 (file)
@@ -65,7 +65,7 @@ sub config_status_all {
        return undef;
 }
 __PACKAGE__->register_method(
-       method          => 'ident_type_all',
+       method          => 'config_status_all',
        api_name        => 'open-ils.storage.direct.config.copy_status.retrieve.all',
        argc            => 0,
        stream          => 1,