From 73e5666912d527018ae186a4e3ce0f932257b427 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@biblibre.com>
Date: Thu, 7 Nov 2013 14:24:07 +0100
Subject: [PATCH] Bug 10986: QA followup

This patch fixes some qa issues:

 FAIL   C4/Languages.pm
   FAIL   critic
        # Variables::ProhibitConditionalDeclarations: Got 1 violation(s).
 FAIL   installer/data/mysql/updatedatabase.pl
   FAIL   forbidden patterns
        forbidden pattern: merge marker (<<<<<<<) (line 7157)

 FAIL   installer/data/mysql/sysprefs.sql
   FAIL   sysprefs_order
        Not blocker: Sysprefs AdvancedSearchLanguages is bad placed (see bug 10610)

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
---
 C4/Languages.pm                        |    2 +-
 installer/data/mysql/sysprefs.sql      |    2 +-
 installer/data/mysql/updatedatabase.pl |    3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/C4/Languages.pm b/C4/Languages.pm
index 75b9690..371b5be 100644
--- a/C4/Languages.pm
+++ b/C4/Languages.pm
@@ -203,7 +203,7 @@ sub getLanguages {
     my $dbh=C4::Context->dbh;
     my $default_language = 'en';
     my $current_language = $default_language;
-    my $language_list=C4::Context->preference("AdvancedSearchLanguages") if $isFiltered;
+    my $language_list = $isFiltered ? C4::Context->preference("AdvancedSearchLanguages") : undef;
     if ($lang) {
         $current_language = regex_lang_subtags($lang)->{'language'};
     }
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 1cc34d3..a731d6c 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -5,6 +5,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'),
 ('AddPatronLists','categorycode','categorycode|category_type','Allow user to choose what list to pick up from when adding patrons','Choice'),
 ('advancedMARCeditor','0','','If ON, the MARC editor won\'t display field/subfield descriptions','YesNo'),
+('AdvancedSearchLanguages','','','ISO 639-2 codes of languages you wish to see appear as an Advanced search option.  Example: eng|fre|ita','Textarea'),
 ('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields comprise the Type limit in the advanced search','Choice'),
 ('AgeRestrictionMarker','',NULL,'Markers for age restriction indication, e.g. FSK|PEGI|Age|','free'),
 ('AgeRestrictionOverride','0',NULL,'Allow staff to check out an item with age restriction.','YesNo'),
@@ -423,5 +424,4 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('yuipath','local','local|http://yui.yahooapis.com/2.5.1/build','Insert the path to YUI libraries, choose local if you use koha offline','Choice'),
 ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
 ('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
-('AdvancedSearchLanguages','','','ISO 639-2 codes of languages you wish to see appear as an Advanced search option.  Example: eng|fre|ita','Textarea')
 ;
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index ab75020..0fa1173 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -7154,7 +7154,6 @@ if ( CheckVersion($DBversion) ) {
     SetVersion($DBversion);
 }
 
-<<<<<<< HEAD
 $DBversion = "3.13.00.023";
 if ( CheckVersion($DBversion) ) {
     $dbh->do("ALTER TABLE borrowers CHANGE password password VARCHAR(60);");
@@ -7740,7 +7739,7 @@ if(CheckVersion($DBversion)) {
     $dbh->do(q{
         INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AcqItemSetSubfieldsWhenReceived','','Set subfields for item when items are created when receiving (e.g. o=5|a="foo bar")','','Free');
     });
-    print "Upgrade to $DBversion done (Added AcqItemSetSubfieldsWhenReceived syspref)\n";
+    print "Upgrade to $DBversion done (Bug 10986: Added AcqItemSetSubfieldsWhenReceived syspref)\n";
     SetVersion($DBversion);
 }
 
-- 
1.7.10.4