[open-ils-commits] r10719 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Search

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Sep 28 16:52:41 EDT 2008


Author: miker
Date: 2008-09-28 16:52:36 -0400 (Sun, 28 Sep 2008)
New Revision: 10719

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
Log:
make in-db authoritative, but allow config file values as well

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm	2008-09-28 20:48:10 UTC (rev 10718)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm	2008-09-28 20:52:36 UTC (rev 10719)
@@ -86,43 +86,42 @@
 	return $e->event unless $e->checkauth;
 	return $e->event unless $e->allowed('REMOTE_Z3950_QUERY');
 
+    my $hash = $sclient->config_value('z3950', 'services');
+
+    # overlay config file values with in-db values
     if($e->can('search_config_z3950_source')) {
 
-        my $sources = $e->search_config_z3950_source( 
-            [ { name => { '!=' => undef } }, 
-            { flesh => 1, flesh_fields => { czs => ['attrs'] } }]  
-        ); 
+        my $sources = $e->search_config_z3950_source(
+            [ { name => { '!=' => undef } },
+              { flesh => 1, flesh_fields => { czs => ['attrs'] } } ]
+        );
 
-        my %hash = (); 
-        for my $s ( @$sources ) { 
-            $hash{ $s->name } = { 
-                name => $s->name, 
-                label => $s->label, 
-                host => $s->host, 
-                port => $s->port, 
-                db => $s->db, 
-                record_format => $s->record_format, 
-                transmission_format => $s->transmission_format, 
-                auth => $s->auth, 
-            }; 
+        for my $s ( @$sources ) {
+            $$hash{ $s->name } = {
+                name => $s->name,
+                label => $s->label,
+                host => $s->host,
+                port => $s->port,
+                db => $s->db,
+                record_format => $s->record_format,
+                transmission_format => $s->transmission_format,
+                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, 
-                    truncation => $a->truncation, 
-                }; 
-            } 
-        } 
-
-        return \%hash; 
-
-    } else {
-        return $sclient->config_value('z3950', 'services');
+            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,
+                    truncation => $a->truncation,
+                };
+            }
+        }
     }
+
+    return $hash;
 }
 
 



More information about the open-ils-commits mailing list