From 82bc2c471a11419f2dd7845ac588b24b3d6e38b5 Mon Sep 17 00:00:00 2001
From: miker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Thu, 24 Sep 2009 19:00:06 +0000
Subject: [PATCH] correcting thinko that caused calling a cstore method before
 cstore is started

git-svn-id: svn://svn.open-ils.org/ILS/trunk@14155 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
index 79a937ce1c..27362a9c02 100755
--- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
@@ -94,7 +94,6 @@ sub query_services {
 # -------------------------------------------------------------------
 sub fetch_service_defs {
 
-    $sclient = OpenSRF::Utils::SettingsClient->new();
     my $hash = $sclient->config_value('z3950', 'services');
 
     # overlay config file values with in-db values
@@ -159,7 +158,7 @@ sub fetch_service_defs {
 # Load the pre-defined Z server configs
 # -------------------------------------------------------------------
 sub child_init {
-    fetch_service_defs();
+    $sclient = OpenSRF::Utils::SettingsClient->new();
     $default_service = $sclient->config_value("z3950", "default" );
 }
 
@@ -169,6 +168,8 @@ sub child_init {
 # -------------------------------------------------------------------
 sub do_class_search {
 
+    	fetch_service_defs() unless (scalar(keys(%services)));
+
 	my $self			= shift;
 	my $conn			= shift;
 	my $auth			= shift;
@@ -249,6 +250,8 @@ sub do_class_search {
 # -------------------------------------------------------------------
 sub do_service_search {
 
+    	fetch_service_defs() unless (scalar(keys(%services)));
+
 	my $self			= shift;
 	my $conn			= shift;
 	my $auth			= shift;
@@ -272,6 +275,8 @@ sub do_service_search {
 # -------------------------------------------------------------------
 sub do_search {
 
+    	fetch_service_defs() unless (scalar(keys(%services)));
+
 	my $self	= shift;
 	my $conn	= shift;
 	my $auth = shift;
@@ -344,6 +349,9 @@ sub do_search {
 # and mvr objects
 # -------------------------------------------------------------------
 sub process_results {
+
+    	fetch_service_defs() unless (scalar(keys(%services)));
+
 	my $results	= shift;
 	my $limit	= shift || 10;
 	my $offset	= shift || 0;
@@ -420,6 +428,8 @@ sub process_results {
 # -------------------------------------------------------------------
 sub compile_query {
 
+    	fetch_service_defs() unless (scalar(keys(%services)));
+
 	my $seperator	= shift;
 	my $service		= shift;
 	my $hash			= shift;
-- 
2.11.0