[Koha-patches] [PATCH] Bug 11096: fallback to the correct defaults if config entries missing

Tomas Cohen Arazi tomascohen at gmail.com
Wed Jan 22 15:46:54 CET 2014


As of bug 7818 misc/migration_tools/rebuild_zebra.pl behaves like:

- bib_index_mode (defaults to 'grs1' if not specified)
- auth_index_mode (defaults to 'dom')

we should do the same in C4::Context. So people having old config files
have a seamless behaviour.

Regards
To+

Sponsored-by: Universidad Nacional de Cordoba
---
 C4/Context.pm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/C4/Context.pm b/C4/Context.pm
index 746d24b..f58092d 100644
--- a/C4/Context.pm
+++ b/C4/Context.pm
@@ -730,12 +730,18 @@ sub _new_Zconn {
     my $tried=0; # first attempt
     my $Zconn; # connection object
     my $elementSetName;
+    my $index_mode;
 
     $server //= "biblioserver";
     $syntax //= "XML";
 
-    if ( ($server eq 'biblioserver' and $context->{'config'}->{'zebra_bib_index_mode'} eq 'grs1')
-        or ($server eq 'authorityserver' and $context->{'config'}->{'zebra_auth_index_mode'} eq 'grs1')) {
+    if ( $server eq 'biblioserver' ) {
+        $index_mode = $context->{'config'}->{'zebra_bib_index_mode'} // 'grs1';
+    } elsif ( $server eq 'authorityserver' ) {
+        $index_mode = $context->{'config'}->{'zebra_auth_index_mode'} // 'dom';
+    }
+
+    if ( $index_mode eq 'grs1' ) {
 
         $elementSetName = 'F';
         $syntax = ( $context->preference("marcflavour") eq 'UNIMARC' )
-- 
1.8.3.2



More information about the Koha-patches mailing list