From 7a23fcc6d6ce572b808624c877bb78c76afad78c Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 22 Jan 2014 09:57:26 -0300 Subject: [PATCH] Bug 11096: fallback to the correct defaults if config entries missing 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 Signed-off-by: Jonathan Druart Without this patch, I got Can't call method "data" on an undefined value at /home/koha/src/C4/Search.pm line 1740. without zebra_bib_index_mode entry in my koha config file. With this patch, the search works as before. --- 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.7.10.4