make in-db authoritative, but allow config file values as well
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 28 Sep 2008 20:52:36 +0000 (20:52 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 28 Sep 2008 20:52:36 +0000 (20:52 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10719 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm

index 97cf08b..6cc8efb 100755 (executable)
@@ -86,43 +86,42 @@ sub query_services {
        return $e->event unless $e->checkauth;
        return $e->event unless $e->allowed('REMOTE_Z3950_QUERY');
 
        return $e->event unless $e->checkauth;
        return $e->event unless $e->allowed('REMOTE_Z3950_QUERY');
 
-    if($e->can('search_config_z3950_source')) {
-
-        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 $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, 
-                }; 
-            } 
-        } 
+    my $hash = $sclient->config_value('z3950', 'services');
 
 
-        return \%hash; 
+    # overlay config file values with in-db values
+    if($e->can('search_config_z3950_source')) {
 
 
-    } else {
-        return $sclient->config_value('z3950', 'services');
+        my $sources = $e->search_config_z3950_source(
+            [ { name => { '!=' => undef } },
+              { flesh => 1, flesh_fields => { czs => ['attrs'] } } ]
+        );
+
+        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;
 }
 
 
 }