Bug 12616: Locale in subscriptions not preselecting correctly

There is a problem if a language is present but
don't have ISO639-2 code. Locale pulldown on serial
suscription is malformed.

To reproduce on master:
a) remove some entries on language_rfc4646_to_iso639
b) go to Serials > New suscription
c) Put any value on Vendor and record, press Next>>
d) Look at locale pulldown, it must default to last
removed lang from a), also other langs has no value
and are also 'selected' on html

To test:
1) Reproduce the problem
2) Apply the patch
3) Add New suscription, pulldown must be fixed

NOTE: Deleted Urdu and Chinese.
      Master had both "selected" in the HTML.
      Applied patch, neither were added.
      Defaults to first item, which is blank meaning English.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
This commit is contained in:
Bernardo Gonzalez Kriegel 2015-06-17 13:22:49 -03:00 committed by Tomas Cohen Arazi
parent 67881bd907
commit b9c4061479
1 changed files with 2 additions and 1 deletions

View File

@ -249,7 +249,8 @@ sub getLanguages {
$language_subtag_registry->{language_description} = $language_descriptions->{description};
}
}
if ( !$language_list || index ( $language_list, $language_subtag_registry->{ iso639_2_code } ) >= 0) {
# 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;
}
}