From 5391859b5e7598d80c1a41565dc7e1e766dd0d65 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 26 Apr 2005 22:07:02 +0000 Subject: [PATCH] circ rules fixups git-svn-id: svn://svn.open-ils.org/ILS/trunk@579 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../OpenILS/Application/Storage/CDBI.pm | 1 + .../Application/Storage/Driver/Pg/dbi.pm | 8 ++-- .../OpenILS/Application/Storage/Publisher.pm | 10 +++-- .../Application/Storage/Publisher/asset.pm | 40 +++++++++++++++++++ .../Application/Storage/Publisher/biblio.pm | 9 ++++- .../Application/Storage/Publisher/config.pm | 2 +- 6 files changed, 60 insertions(+), 10 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm index 53d91b712e..fb1a68d419 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm @@ -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' ); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm index 95c7f833d9..15e082e042 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm @@ -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; @@ -104,8 +104,8 @@ #--------------------------------------------------------------------- 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; diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher.pm index cf6215ea97..5944ce39ee 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher.pm @@ -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; diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm index b09175ca1e..8e91f35aa9 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm @@ -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; diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm index 4cdd0aad83..d9c7fb44ab 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm @@ -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, ); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/config.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/config.pm index b4981f6eb1..8897fb3af2 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/config.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/config.pm @@ -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, -- 2.43.2