From: miker Date: Wed, 19 Dec 2007 23:49:36 +0000 (+0000) Subject: use in-db source X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3073331cd1a0537464d608b3865362ddef8e5a42;p=Evergreen.git use in-db source git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8241 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm index afcc3f9948..064a0af2e1 100755 --- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm @@ -84,7 +84,38 @@ sub query_services { my $e = new_editor(authtoken=>$auth); return $e->event unless $e->checkauth; return $e->event unless $e->allowed('REMOTE_Z3950_QUERY'); - return $sclient->config_value('z3950', 'services'); + + my $cstore = OpenSRF::AppSession->connect('open-ils.cstore'); + my $sources = $cstore->request( + 'open-ils.cstore.direct.config.z3950_source.search.atomic', + { id => { '!=' => null } }, + { flesh => 1, flesh_fields => { czs => ['attrs'] } } + )->gather(1); + $cstore->disconnect; + + my %hash = (); + for my $s ( @$sources ) { + $hash{ $s->name } = { + name => $s->name, + label => $s->label, + host => $s->host, + port => $s->port, + db => $s->db, + auth => $s->auth, + }; + + for my $a ( @{ $s->attrs } ) { + $hash{ $a->source }{attrs}{ $a->name } = { + name => $a->name, + label => $a->label, + code => $a->code, + format => $a->format, + source => $a->source, + }; + } + } + + return \%hash; } @@ -325,7 +356,7 @@ sub compile_query { # ------------------------------------------------------------------- for( keys %$hash ) { next unless ( exists $services{$service}->{attrs}->{$_} ); - $str .= '@attr 1=' . $services{$service}->{attrs}->{$_}->{code} . # add the use attribute + $str .= '@attr 1=' . $services{$service}->{attrs}->{$_}->{code} . # add the use attribute ' @attr 4=' . $services{$service}->{attrs}->{$_}->{format} . # add the structure attribute " \"" . $$hash{$_} . "\" "; # add the search term }