Bug 31364: Check length of the multiple syspref array instead whether it is null

The multiple systempreferences are always defined as an empty array at
the minimum, so in order to determine whether we need to remove all
the selections from the systempreference we should check whether the
array is empty and not whether the array doesn't exist.

To test:
 1) Set at least 1 value for OPACHoldsIfAvailableAtPickupExceptions
 2) Remove all the values for OPACHoldsIfAvailableAtPickupExceptions
 and notice you get the message "Nothing to save"
 3) Apply patch and repeat, removing all the values should work now.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit ce1efe7de0)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 191aad389e)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
Joonas Kylmälä 2022-09-04 14:37:46 +03:00 committed by Arthur Suzuki
parent a858d135e1
commit d18b6ab84d
1 changed files with 1 additions and 1 deletions

View File

@ -13,7 +13,7 @@ KOHA.Preferences = {
// If a multiple select has all its entries unselected
var unserialized = new Array();
$(modified_prefs).each(function(){
if ( $(this).attr('multiple') && $(this).val() == null ) {
if ( $(this).attr('multiple') && $(this).val().length == 0 ) {
unserialized.push($(this));
}
});