View | Details | Raw Unified | Return to bug 10986
Collapse All | Expand All

(-)a/C4/Languages.pm (-5 / +25 lines)
Lines 43-51 BEGIN { Link Here
43
    @EXPORT = qw(
43
    @EXPORT = qw(
44
        &getFrameworkLanguages
44
        &getFrameworkLanguages
45
        &getTranslatedLanguages
45
        &getTranslatedLanguages
46
        &getLanguages
46
        &getAllLanguages
47
        &getAllLanguages
47
    );
48
    );
48
    @EXPORT_OK = qw(getFrameworkLanguages getTranslatedLanguages getAllLanguages get_bidi regex_lang_subtags language_get_description accept_language);
49
    @EXPORT_OK = qw(getFrameworkLanguages getTranslatedLanguages getAllLanguages getLanguages get_bidi regex_lang_subtags language_get_description accept_language);
49
    $DEBUG = 0;
50
    $DEBUG = 0;
50
}
51
}
51
52
Lines 178-191 Returns a reference to an array of hashes: Link Here
178
=cut
179
=cut
179
180
180
sub getAllLanguages {
181
sub getAllLanguages {
182
    return getLanguages(shift);
183
}
184
185
=head2 getLanguages
186
187
Returns a reference to an array of hashes.
188
Extracted from getAllLanguages to limit effect on the code base.
189
This new function (name) will allow for more arguments to customize the values returned.
190
191
- If no parameter is passed to the function, it returns english languages names
192
- If a $lang parameter conforming to RFC4646 syntax is passed, the function returns languages names translated in $lang
193
  If a language name is not translated in $lang in database, the function returns english language name
194
- If $isFiltered is set to true, only the detail of the languages selected in system preferences AdvanceSearchLanguages is returned.
195
196
=cut
197
198
sub getLanguages {
181
    my $lang = shift;
199
    my $lang = shift;
182
# if no parameter is passed to the function, it returns english languages names
200
    my $isFiltered = shift;
183
# if a $lang parameter conforming to RFC4646 syntax is passed, the function returns languages names translated in $lang
201
184
# if a language name is not translated in $lang in database, the function returns english language name
185
    my @languages_loop;
202
    my @languages_loop;
186
    my $dbh=C4::Context->dbh;
203
    my $dbh=C4::Context->dbh;
187
    my $default_language = 'en';
204
    my $default_language = 'en';
188
    my $current_language = $default_language;
205
    my $current_language = $default_language;
206
    my $language_list=C4::Context->preference("AdvancedSearchLanguages") if $isFiltered;
189
    if ($lang) {
207
    if ($lang) {
190
        $current_language = regex_lang_subtags($lang)->{'language'};
208
        $current_language = regex_lang_subtags($lang)->{'language'};
191
    }
209
    }
Lines 226-232 sub getAllLanguages { Link Here
226
                $language_subtag_registry->{language_description} = $language_descriptions->{description};
244
                $language_subtag_registry->{language_description} = $language_descriptions->{description};
227
            }
245
            }
228
        }
246
        }
229
        push @languages_loop, $language_subtag_registry;
247
        if ( !$language_list || index (  $language_list, $language_subtag_registry->{ iso639_2_code } ) >= 0) {
248
            push @languages_loop, $language_subtag_registry;
249
        }
230
    }
250
    }
231
    return \@languages_loop;
251
    return \@languages_loop;
232
}
252
}
(-)a/catalogue/search.pl (-2 / +2 lines)
Lines 144-150 use C4::Context; Link Here
144
use C4::Output;
144
use C4::Output;
145
use C4::Auth qw(:DEFAULT get_session);
145
use C4::Auth qw(:DEFAULT get_session);
146
use C4::Search;
146
use C4::Search;
147
use C4::Languages qw(getAllLanguages);
147
use C4::Languages qw(getLanguages);
148
use C4::Koha;
148
use C4::Koha;
149
use C4::Members qw(GetMember);
149
use C4::Members qw(GetMember);
150
use C4::VirtualShelves;
150
use C4::VirtualShelves;
Lines 339-345 if ( $template_type eq 'advsearch' ) { Link Here
339
                      search_boxes_loop => \@search_boxes_array);
339
                      search_boxes_loop => \@search_boxes_array);
340
340
341
    # load the language limits (for search)
341
    # load the language limits (for search)
342
    my $languages_limit_loop = getAllLanguages($lang);
342
    my $languages_limit_loop = getLanguages($lang, 1);
343
    $template->param(search_languages_loop => $languages_limit_loop,);
343
    $template->param(search_languages_loop => $languages_limit_loop,);
344
344
345
    # Expanded search options in advanced search:
345
    # Expanded search options in advanced search:
(-)a/installer/data/mysql/sysprefs.sql (-1 / +2 lines)
Lines 418-422 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
418
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
418
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
419
('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'),
419
('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'),
420
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
420
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
421
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
421
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
422
('AdvancedSearchLanguages','','','ISO 639-2 codes of languages you wish to see appear as an Advanced search option.  Example: eng|fre|ita','Textarea')
422
;
423
;
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 7155-7160 if ( CheckVersion($DBversion) ) { Link Here
7155
    SetVersion($DBversion);
7155
    SetVersion($DBversion);
7156
}
7156
}
7157
7157
7158
<<<<<<< HEAD
7158
$DBversion = "3.13.00.023";
7159
$DBversion = "3.13.00.023";
7159
if ( CheckVersion($DBversion) ) {
7160
if ( CheckVersion($DBversion) ) {
7160
    $dbh->do("ALTER TABLE borrowers CHANGE password password VARCHAR(60);");
7161
    $dbh->do("ALTER TABLE borrowers CHANGE password password VARCHAR(60);");
Lines 7166-7171 $DBversion = "3.13.00.024"; Link Here
7166
if ( CheckVersion($DBversion) ) {
7167
if ( CheckVersion($DBversion) ) {
7167
    $dbh->do(q{ALTER TABLE z3950servers ADD COLUMN recordtype VARCHAR(45) NOT NULL DEFAULT 'biblio' AFTER description;});
7168
    $dbh->do(q{ALTER TABLE z3950servers ADD COLUMN recordtype VARCHAR(45) NOT NULL DEFAULT 'biblio' AFTER description;});
7168
    print "Upgrade to $DBversion done (Bug 10096 - Add a Z39.50 interface for authority searching)\n";
7169
    print "Upgrade to $DBversion done (Bug 10096 - Add a Z39.50 interface for authority searching)\n";
7170
}
7171
7172
$DBversion = "3.13.00.XXX";
7173
if ( CheckVersion($DBversion) ) {
7174
    $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')");
7175
    print "Upgrade to $DBversion done (Bug 10986: system preferences to limit languages in Advanced search )\n";
7169
    SetVersion ($DBversion);
7176
    SetVersion ($DBversion);
7170
}
7177
}
7171
7178
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref (+6 lines)
Lines 79-84 Searching: Link Here
79
            - "fields (separate values with |). Tabs appear in the order listed.<br/>"
79
            - "fields (separate values with |). Tabs appear in the order listed.<br/>"
80
            - "<em>Currently supported values</em>: Item types (<strong>itemtypes</strong>), Collection Codes (<strong>ccode</strong>) and Shelving Location (<strong>loc</strong>)."
80
            - "<em>Currently supported values</em>: Item types (<strong>itemtypes</strong>), Collection Codes (<strong>ccode</strong>) and Shelving Location (<strong>loc</strong>)."
81
        -
81
        -
82
            - Limit the languages listed in the advanced search drop-down to the
83
            - pref: AdvancedSearchLanguages
84
              class: long
85
            - "ISO 639-2 language codes (separate values with | or ,)."
86
            - "For example, to limit listing to French and Italian, enter <em>ita|fre</em>."
87
        -
82
            - By default,
88
            - By default,
83
            - pref: expandedSearchOption
89
            - pref: expandedSearchOption
84
              type: boolean
90
              type: boolean
(-)a/opac/opac-search.pl (-3 / +2 lines)
Lines 43-49 for ( $searchengine ) { Link Here
43
43
44
use C4::Output;
44
use C4::Output;
45
use C4::Auth qw(:DEFAULT get_session ParseSearchHistoryCookie);
45
use C4::Auth qw(:DEFAULT get_session ParseSearchHistoryCookie);
46
use C4::Languages qw(getAllLanguages);
46
use C4::Languages qw(getLanguages);
47
use C4::Search;
47
use C4::Search;
48
use C4::Biblio;  # GetBiblioData
48
use C4::Biblio;  # GetBiblioData
49
use C4::Koha;
49
use C4::Koha;
Lines 198-204 $template->param( Link Here
198
);
198
);
199
199
200
# load the language limits (for search)
200
# load the language limits (for search)
201
my $languages_limit_loop = getAllLanguages($lang);
201
my $languages_limit_loop = getLanguages($lang, 1);
202
$template->param(search_languages_loop => $languages_limit_loop,);
202
$template->param(search_languages_loop => $languages_limit_loop,);
203
203
204
# load the Type stuff
204
# load the Type stuff
205
- 

Return to bug 10986