LP#1499537 Fixed kpac.xml caching problem
authorLiam Whalen <liam.whalen@bc.libraries.coop>
Thu, 24 Sep 2015 22:00:17 +0000 (15:00 -0700)
committerLiam Whalen <liam.whalen@bc.libraries.coop>
Thu, 24 Sep 2015 22:14:22 +0000 (15:14 -0700)
The EGKPacLoader.pm file caches the kpac.xml file in a global variable.
However, we are using multiple kpac.xml files, which means sometimes the
incorrect kpac.xml file is cached. This causes a problem becuase the
owner attribute of the of the layout element specifies which OU to load
the grid of images for.  When using separate kpac.xml files there is
only one layout element per file, and if the inccorect kpac.xml file is
loaded for an OU, then no layout will be generated resulting in the
missing images.

Signed-off-by: Liam Whalen <liam.whalen@bc.libraries.coop>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm

index 32e394b..0a0f8dc 100644 (file)
@@ -232,21 +232,19 @@ sub load_kpac_config {
     my $self = shift;
     my $ctx = $self->ctx;
 
-    if (!$kpac_config) {
-        my $path = $self->apache->dir_config('KPacConfigFile');
+    my $path = $self->apache->dir_config('KPacConfigFile');
 
-        if (!$path) {
-            $self->apache->log->error("KPacConfigFile required!");
-            return;
-        }
-        
-        $kpac_config = XMLin(
-            $path,
-            KeyAttr => ['id'],
-            ForceArray => ['layout', 'page', 'cell'],
-            NormaliseSpace => 2
-        );
+    if (!$path) {
+        $self->apache->log->error("KPacConfigFile required!");
+        return;
     }
+    
+    $kpac_config = XMLin(
+        $path,
+        KeyAttr => ['id'],
+        ForceArray => ['layout', 'page', 'cell'],
+        NormaliseSpace => 2
+    );
 
     my $ou = $ctx->{physical_loc} || $self->_get_search_lib;
     my $layout;