Bugzilla – Attachment 43333 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: (follow-up) Use priority sorting only if AdvancedSearchLanguagesSort is set to priority.
Bug-14912-follow-up-Use-priority-sorting-only-if-A.patch (text/plain), 5.58 KB, created by
Josef Moravec
on 2015-10-12 06:07:43 UTC
(
hide
)
Description:
Bug 14912: (follow-up) Use priority sorting only if AdvancedSearchLanguagesSort is set to priority.
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2015-10-12 06:07:43 UTC
Size:
5.58 KB
patch
obsolete
>From 5e1a3263faef657356c1377c377aec1672e5f9bd Mon Sep 17 00:00:00 2001 >From: Lari Taskula <larit@student.uef.fi> >Date: Thu, 8 Oct 2015 13:40:38 +0300 >Subject: [PATCH] Bug 14912: (follow-up) Use priority sorting only if > AdvancedSearchLanguagesSort is set to priority. > >This patch adds a system preference "AdvancedSearchLanguagesSort" that defines >whether the drop-down list should be sorted by priority in AdvancedSearchLanguages >or alphabetically like before. > >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 patches and run database update >4. Change system preference AdvancedSearchLanguagesSort to "by priority" >5. Repeat step 1 >6. Note that the list is sorted like AdvancedSearchLanguages >7. Change system preference AdvancedSearchLanguagesSort to "alphabetically" >8. Repeat step 1 >9. Note that the list is again in alphabetical order > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >Works as expected >--- > C4/Languages.pm | 5 +++-- > .../Bug_14912-Sort_Advanced_Search_Languages_by_priority.sql | 1 + > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/searching.pref | 8 ++++++++ > 4 files changed, 13 insertions(+), 2 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/Bug_14912-Sort_Advanced_Search_Languages_by_priority.sql > >diff --git a/C4/Languages.pm b/C4/Languages.pm >index b3f377e..0ece5e5 100644 >--- a/C4/Languages.pm >+++ b/C4/Languages.pm >@@ -206,6 +206,7 @@ sub getLanguages { > > my @languages_loop; > my $languages_hash; >+ my $priority_sorting = C4::Context->preference("AdvancedSearchLanguagesSort"); > my $dbh=C4::Context->dbh; > my $default_language = 'en'; > my $current_language = $default_language; >@@ -253,10 +254,10 @@ 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) ) { > $languages_hash->{$language_subtag_registry->{ iso639_2_code }} = $language_subtag_registry; >- push @languages_loop, $language_subtag_registry if not $language_list; >+ push @languages_loop, $language_subtag_registry if not $language_list or not $priority_sorting; > } > } >- if ($language_list) { >+ if ($language_list and $priority_sorting) { > # sort @languages_loop into order defined in AdvancedSearchLanguages preference > my @adv_search_languages = split /[,|]+/, $language_list; > foreach my $adv_search_lang (@adv_search_languages){ >diff --git a/installer/data/mysql/atomicupdate/Bug_14912-Sort_Advanced_Search_Languages_by_priority.sql b/installer/data/mysql/atomicupdate/Bug_14912-Sort_Advanced_Search_Languages_by_priority.sql >new file mode 100644 >index 0000000..8d255d0 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/Bug_14912-Sort_Advanced_Search_Languages_by_priority.sql >@@ -0,0 +1 @@ >+INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('AdvancedSearchLanguagesSort', '0', NULL, 'Use AdvancedSearchLanguages to sort the drop-down list. The leftmost language has the highest priority and appears on top of the drop-down.', 'YesNo'); >\ No newline at end of file >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 13639f0..cf4545e 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -9,6 +9,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('AddressFormat','us','','Choose format to display postal addresses', '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'), >+('AdvancedSearchLanguagesSort','0',NULL,'Use AdvancedSearchLanguages to sort the drop-down list. The leftmost language has the highest priority and appears on top of the drop-down.','YesNo'), > ('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'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >index 8b04d39..dc05d7f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >@@ -92,6 +92,14 @@ Searching: > - "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, sort advanced search languages >+ - pref: AdvancedSearchLanguagesSort >+ type: boolean >+ choices: >+ yes: by priority >+ no: alphabetically >+ - '. The leftmost language in the AdvancedSearchLanguages preference has the highest priority and appears on top of the drop-down list.' >+ - > - By default, > - pref: expandedSearchOption > type: boolean >-- >2.1.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