[open-ils-commits] r8241 - branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Search

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Dec 19 19:11:15 EST 2007


Author: miker
Date: 2007-12-19 18:49:36 -0500 (Wed, 19 Dec 2007)
New Revision: 8241

Modified:
   branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
Log:
use in-db source

Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm	2007-12-19 23:31:20 UTC (rev 8240)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm	2007-12-19 23:49:36 UTC (rev 8241)
@@ -84,7 +84,38 @@
 	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 @@
     # -------------------------------------------------------------------
 	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
 	}



More information about the open-ils-commits mailing list