@EXPORT = qw(
&getFrameworkLanguages
&getTranslatedLanguages
+ &getLanguages
&getAllLanguages
);
- @EXPORT_OK = qw(getFrameworkLanguages getTranslatedLanguages getAllLanguages get_bidi regex_lang_subtags language_get_description accept_language);
+ @EXPORT_OK = qw(getFrameworkLanguages getTranslatedLanguages getAllLanguages getLanguages get_bidi regex_lang_subtags language_get_description accept_language);
$DEBUG = 0;
}
=cut
sub getAllLanguages {
+ return getLanguages(shift);
+}
+
+=head2 getLanguages
+
+Returns a reference to an array of hashes.
+Extracted from getAllLanguages to limit effect on the code base.
+This new function (name) will allow for more arguments to customize the values returned.
+
+- If no parameter is passed to the function, it returns english languages names
+- If a $lang parameter conforming to RFC4646 syntax is passed, the function returns languages names translated in $lang
+ If a language name is not translated in $lang in database, the function returns english language name
+- If $isFiltered is set to true, only the detail of the languages selected in system preferences AdvanceSearchLanguages is returned.
+
+=cut
+
+sub getLanguages {
my $lang = shift;
-# if no parameter is passed to the function, it returns english languages names
-# if a $lang parameter conforming to RFC4646 syntax is passed, the function returns languages names translated in $lang
-# if a language name is not translated in $lang in database, the function returns english language name
+ my $isFiltered = shift;
+
my @languages_loop;
my $dbh=C4::Context->dbh;
my $default_language = 'en';
my $current_language = $default_language;
+ my $language_list=C4::Context->preference("AdvancedSearchLanguages") if $isFiltered;
if ($lang) {
$current_language = regex_lang_subtags($lang)->{'language'};
}
$language_subtag_registry->{language_description} = $language_descriptions->{description};
}
}
- push @languages_loop, $language_subtag_registry;
+ if ( !$language_list || index ( $language_list, $language_subtag_registry->{ iso639_2_code } ) >= 0) {
+ push @languages_loop, $language_subtag_registry;
+ }
}
return \@languages_loop;
}
use C4::Output;
use C4::Auth qw(:DEFAULT get_session);
use C4::Search;
-use C4::Languages qw(getAllLanguages);
+use C4::Languages qw(getLanguages);
use C4::Koha;
use C4::Members qw(GetMember);
use C4::VirtualShelves;
search_boxes_loop => \@search_boxes_array);
# load the language limits (for search)
- my $languages_limit_loop = getAllLanguages($lang);
+ my $languages_limit_loop = getLanguages($lang, 1);
$template->param(search_languages_loop => $languages_limit_loop,);
# Expanded search options in advanced search:
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
('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')
+('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')
;
SetVersion($DBversion);
}
+<<<<<<< HEAD
$DBversion = "3.13.00.023";
if ( CheckVersion($DBversion) ) {
$dbh->do("ALTER TABLE borrowers CHANGE password password VARCHAR(60);");
if ( CheckVersion($DBversion) ) {
$dbh->do(q{ALTER TABLE z3950servers ADD COLUMN recordtype VARCHAR(45) NOT NULL DEFAULT 'biblio' AFTER description;});
print "Upgrade to $DBversion done (Bug 10096 - Add a Z39.50 interface for authority searching)\n";
+}
+
+$DBversion = "3.13.00.XXX";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('AdvancedSearchLanguages','','','ISO 639-2 codes of languages you wish to see appear as an Advanced search option. Example: eng|fra|ita','Textarea')");
+ print "Upgrade to $DBversion done (Bug 10986: system preferences to limit languages in Advanced search )\n";
SetVersion ($DBversion);
}
class: long
- "fields (separate values with |). Tabs appear in the order listed.<br/>"
- "<em>Currently supported values</em>: Item types (<strong>itemtypes</strong>), Collection Codes (<strong>ccode</strong>) and Shelving Location (<strong>loc</strong>)."
+ -
+ - Limit the languages listed in the advanced search drop-down to the
+ - pref: AdvancedSearchLanguages
+ class: long
+ - "ISO 639-2 language codes (separate values with | or ,)."
+ - "For example, to limit listing to French and Italian, enter <em>ita|fre</em>."
-
- By default,
- pref: expandedSearchOption
use C4::Output;
use C4::Auth qw(:DEFAULT get_session ParseSearchHistorySession SetSearchHistorySession);
-use C4::Languages qw(getAllLanguages);
+use C4::Languages qw(getLanguages);
use C4::Search;
use C4::Biblio; # GetBiblioData
use C4::Koha;
);
# load the language limits (for search)
-my $languages_limit_loop = getAllLanguages($lang);
+my $languages_limit_loop = getLanguages($lang, 1);
$template->param(search_languages_loop => $languages_limit_loop,);
# load the Type stuff