Bug 10986: add system preference to limit the list of languages in advanced search
authorblou <philippe.blouin@inlibro.com>
Wed, 2 Oct 2013 19:05:38 +0000 (15:05 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Sat, 19 Apr 2014 17:18:32 +0000 (17:18 +0000)
commit92d021f989227fa798b13f63abae4ebf53744d17
tree8fa409e1a58c7a7a4b81890542f08fa8bdfe6444
parent3ba6d35c8999d7133e7f5519ff3128af56a6686c
Bug 10986: add system preference to limit the list of languages in advanced search

In Advanced Search, the list of available language is long and will only
get longer.  For a library offering books in 2-3 languages, that is
offering too many options to the user (most of the small libraries we
deal with only offer documents in two languages).

Code changes:
Languages.pm: Extract getAllLanguages to make a more customizable
getLanguages (have getAllLanguage call it, so rest of codebase is
oblivious to the change).  Build array returned based on system pref if
corresponding argument is set.

search.pl and opac-search.pl: call getLanguages instead of
getAllLanguages.

TESTING
0) All language codes are iso 639-2 (three characters)
1) in OPAC, Advanced search, open Language box, acknowledge 30+ items.
2) in Intranet, go to system preferences AdvancedSearchLanguages,
   enter "ita|eng"
3) back in OPAC, refresh screen, acknowledge only Italian and English
   are listed.
4) in Intranet, click Search then click "More options" to make the
   Language box appear.  Acknowledge limited options.
5) Regression Test: Back to the preference, empty the field then save.
   Go back to the OPAC and Intranet search, refresh the page, then the
   Language drop-box will now contain 30+ items.

Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Languages.pm
catalogue/search.pl
installer/data/mysql/sysprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref
opac/opac-search.pl