new FM stuff; trimmed search_fts methods
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 31 Mar 2006 04:47:50 +0000 (04:47 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 31 Mar 2006 04:47:50 +0000 (04:47 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3484 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.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/config.pm
Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm
Open-ILS/src/sql/Pg/040.schema.asset.sql

index 46e629c..9d13e2b 100644 (file)
@@ -39,7 +39,7 @@ __PACKAGE__->columns( Essential => qw/call_number barcode creator create_date ed
                                   edit_date copy_number status loan_duration circ_lib
                                   fine_level circulate deposit price ref opac_visible
                                   circ_as_type circ_modifier deposit_amount location
-                                  holdable dummy_title dummy_author deleted/ );
+                                  holdable dummy_title dummy_author deleted alert_message/ );
 
 #-------------------------------------------------------------------------------
 package asset::stat_cat;
index 54c497f..7129a19 100644 (file)
        #-------------------------------------------------------------------------------
 
        package config::language_map;
-       config::item_form_map->table('config.language_map');
+       config::language_map->table('config.language_map');
 
        #-------------------------------------------------------------------------------
 
        #-------------------------------------------------------------------------------
 
        package config::lit_form_map;
-       config::item_form_map->table('config.lit_form_map');
+       config::lit_form_map->table('config.lit_form_map');
 
        #-------------------------------------------------------------------------------
 
        package config::item_type_map;
-       config::item_form_map->table('config.item_type_map');
+       config::item_type_map->table('config.item_type_map');
 
        #-------------------------------------------------------------------------------
        package config::audience_map;
-       config::item_form_map->table('config.audience_map');
+       config::audience_map->table('config.audience_map');
 
        #-------------------------------------------------------------------------------
 
index bcd3368..de8cd51 100644 (file)
@@ -490,7 +490,7 @@ for my $fmclass ( (Fieldmapper->classes) ) {
                );
        }
 
-       if (\&Class::DBI::search_fts) {
+       if (\&Class::DBI::search_fts and $cdbi->columns('FTS')) {
                unless ( __PACKAGE__->is_registered( $api_prefix.'.search_fts' ) ) {
                        __PACKAGE__->register_method(
                                api_name        => $api_prefix.'.search_fts',
@@ -580,7 +580,7 @@ for my $fmclass ( (Fieldmapper->classes) ) {
                                argc            => 1,
                        );
                }
-               if (\&Class::DBI::search_fts) {
+               if (\&Class::DBI::search_fts and grep { $field eq $_ } $cdbi->columns('FTS')) {
                        unless ( __PACKAGE__->is_registered( $api_prefix.'.search_fts.'.$field ) ) {
                                __PACKAGE__->register_method(
                                        api_name        => $api_prefix.'.search_fts.'.$field,
index 08570b4..fb9d2ac 100644 (file)
@@ -3,90 +3,32 @@ use base qw/OpenILS::Application::Storage/;
 use OpenILS::Application::Storage::CDBI::config;
 
 
-sub metabib_field_all {
+sub retrieve_all {
        my $self = shift;
        my $client = shift;
 
-       for my $rec ( config::metabib_field->retrieve_all ) {
+       $self->api_name =~ /direct\.config\.(.+)\.retrieve/o;
+       
+       my $class = 'config::'.$1;
+       for my $rec ( $class->retrieve_all ) {
                $client->respond( $rec->to_fieldmapper );
        }
 
        return undef;
 }
-__PACKAGE__->register_method(
-       method          => 'metabib_field_all',
-       api_name        => 'open-ils.storage.direct.config.metabib_field.retrieve.all',
-       argc            => 0,
-       stream          => 1,
-);
 
-sub standing_all {
-       my $self = shift;
-       my $client = shift;
-
-       for my $rec ( config::standing->retrieve_all ) {
-               $client->respond( $rec->to_fieldmapper );
-       }
-
-       return undef;
+for my $class (
+               qw/metabib_field standing identification_type copy_status
+                  non_cataloged_type audience_map item_form_map item_type_map
+                  language_map lit_form_map / ) {
+
+       __PACKAGE__->register_method(
+               method          => 'retrieve_all',
+               api_name        => "open-ils.storage.direct.config.$class.retrieve.all",
+               argc            => 0,
+               stream          => 1,
+       );
 }
-__PACKAGE__->register_method(
-       method          => 'standing_all',
-       api_name        => 'open-ils.storage.direct.config.standing.retrieve.all',
-       argc            => 0,
-       stream          => 1,
-);
-
-sub ident_type_all {
-       my $self = shift;
-       my $client = shift;
-
-       for my $rec ( config::identification_type->retrieve_all ) {
-               $client->respond( $rec->to_fieldmapper );
-       }
-
-       return undef;
-}
-__PACKAGE__->register_method(
-       method          => 'ident_type_all',
-       api_name        => 'open-ils.storage.direct.config.identification_type.retrieve.all',
-       argc            => 0,
-       stream          => 1,
-);
-
-sub config_status_all {
-       my $self = shift;
-       my $client = shift;
-
-       for my $rec ( config::copy_status->retrieve_all ) {
-               $client->respond( $rec->to_fieldmapper );
-       }
-
-       return undef;
-}
-__PACKAGE__->register_method(
-       method          => 'config_status_all',
-       api_name        => 'open-ils.storage.direct.config.copy_status.retrieve.all',
-       argc            => 0,
-       stream          => 1,
-);
-
-sub config_non_cat {
-       my $self = shift;
-       my $client = shift;
-
-       for my $rec ( config::non_cataloged_type->retrieve_all ) {
-               $client->respond( $rec->to_fieldmapper );
-       }
-
-       return undef;
-}
-__PACKAGE__->register_method(
-       method          => 'config_non_cat',
-       api_name        => 'open-ils.storage.direct.config.non_cataloged_type.retrieve.all',
-       argc            => 0,
-       stream          => 1,
-);
 
 
 # XXX arg, with the descendancy SPs...
index 666a645..a5cf565 100644 (file)
@@ -15,6 +15,7 @@ use OpenILS::Application::Storage::CDBI::config;
 use OpenILS::Application::Storage::CDBI::metabib;
 use OpenILS::Application::Storage::CDBI::money;
 use OpenILS::Application::Storage::CDBI::container;
+use OpenILS::Application::Storage::CDBI::config;
 
 use vars qw/$fieldmap $VERSION/;
 
@@ -196,6 +197,17 @@ sub _init {
                'Fieldmapper::config::standing'                 => { hint => 'cst'   },
                'Fieldmapper::config::copy_status'              => { hint => 'ccs'   },
 
+               'Fieldmapper::config::audience_map'             => { hint       => 'cam',
+                                                                    readonly   => 1 },
+               'Fieldmapper::config::language_map'             => { hint       => 'clm',
+                                                                    readonly   => 1 },
+               'Fieldmapper::config::item_form_map'            => { hint       => 'cifm',
+                                                                    readonly   => 1 },
+               'Fieldmapper::config::item_type_map'            => { hint       => 'citm',
+                                                                    readonly   => 1 },
+               'Fieldmapper::config::lit_form_map'             => { hint       => 'clfm',
+                                                                    readonly   => 1 },
+
                'Fieldmapper::authority::full_rec'              => { hint => 'afr'  },
                'Fieldmapper::authority::record_descriptor'     => { hint => 'ard'  },
 
index 271c5f0..9a95639 100644 (file)
@@ -38,6 +38,7 @@ CREATE TABLE asset.copy (
        circ_as_type    TEXT,
        dummy_title     TEXT,
        dummy_author    TEXT,
+       alert_message   TEXT,
        opac_visible    BOOL                            NOT NULL DEFAULT TRUE,
        deleted         BOOL                            NOT NULL DEFAULT FALSE
 );