Bugzilla – Attachment 42944 Details for
Bug 14912
Sort Advanced Search Languages by priority
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14912: Sort Advanced Search Languages by priority
Bug-14912-Sort-Advanced-Search-Languages-by-priori.patch (text/plain), 2.21 KB, created by
Marc Véron
on 2015-09-29 06:53:38 UTC
(
hide
)
Description:
Bug 14912: Sort Advanced Search Languages by priority
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2015-09-29 06:53:38 UTC
Size:
2.21 KB
patch
obsolete
>From 8f9a321b26d53b8669dac7775e82738a3f42c532 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <larit@student.uef.fi> >Date: Mon, 28 Sep 2015 12:00:10 +0000 >Subject: [PATCH] Bug 14912: Sort Advanced Search Languages by priority >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Libraries should be able to control the priority of languages in the advanced >search drop-down list. This could be achieved by sorting them according to the >AdvancedSearchLanguages system preference. > >To test: >-1. Set some languages into AdvancedSearchLanguages system preference > >1. Go to advanced search and look at Languages drop-down list >2. Note that the list is in alphabetical order >3. Apply patch >4. Repeat step 1 >5. Note that the list is sorted like AdvancedSearchLanguages > >Works as expected >Signed-off-by: Marc Véron <veron@veron.ch> >--- > C4/Languages.pm | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > >diff --git a/C4/Languages.pm b/C4/Languages.pm >index 384fd7a..b3f377e 100644 >--- a/C4/Languages.pm >+++ b/C4/Languages.pm >@@ -205,6 +205,7 @@ sub getLanguages { > my $isFiltered = shift; > > my @languages_loop; >+ my $languages_hash; > my $dbh=C4::Context->dbh; > my $default_language = 'en'; > my $current_language = $default_language; >@@ -251,9 +252,18 @@ sub getLanguages { > } > # Do not push unless valid iso639-2 code > if ( $language_subtag_registry->{ iso639_2_code } and ( !$language_list || index ( $language_list, $language_subtag_registry->{ iso639_2_code } ) >= 0) ) { >- push @languages_loop, $language_subtag_registry; >+ $languages_hash->{$language_subtag_registry->{ iso639_2_code }} = $language_subtag_registry; >+ push @languages_loop, $language_subtag_registry if not $language_list; > } > } >+ if ($language_list) { >+ # sort @languages_loop into order defined in AdvancedSearchLanguages preference >+ my @adv_search_languages = split /[,|]+/, $language_list; >+ foreach my $adv_search_lang (@adv_search_languages){ >+ push @languages_loop, $languages_hash->{$adv_search_lang} if $languages_hash->{$adv_search_lang}; >+ } >+ } >+ > return \@languages_loop; > } > >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14912
:
42914
|
42915
| 42944 |
43251
|
43333