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

(-)a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js (-5 / +18 lines)
Lines 10-19 KOHA.Preferences = { Link Here
10
10
11
        let sysprefs = $(form).find('.modified').not('.preference-checkbox').toArray().reduce((map, e) => ({ ...map, [$(e).attr('name')]: [$(e).val()].flat()}), {});
11
        let sysprefs = $(form).find('.modified').not('.preference-checkbox').toArray().reduce((map, e) => ({ ...map, [$(e).attr('name')]: [$(e).val()].flat()}), {});
12
12
13
        // language prefs
13
        // checkbox prefs
14
        $(form).find('.modified.preference-checkbox:checked').toArray().forEach((elt) => {
14
        let modified_boxes = $(form).find(".modified.preference-checkbox");
15
            (sysprefs[$(elt).attr('name')] = sysprefs[$(elt).attr('name')] || []).push($(elt).val());
15
        let all_boxes_unchecked = true;
16
        });
16
        if (modified_boxes.length > 0) {
17
            modified_boxes
18
                .toArray()
19
                .filter(elt => $(elt).prop("checked"))
20
                .forEach(elt => {
21
                    all_boxes_unchecked = false;
22
                    (sysprefs[$(elt).attr("name")] =
23
                        sysprefs[$(elt).attr("name")] || []).push($(elt).val());
24
                });
25
            if (all_boxes_unchecked) {
26
                modified_boxes.toArray().forEach(elt => {
27
                    sysprefs[$(elt).attr("name")] = [];
28
                });
29
            }
30
        }
17
31
18
        if ( !Object.keys(sysprefs).length ) {
32
        if ( !Object.keys(sysprefs).length ) {
19
            humanMsg.displayAlert( __("Nothing to save") );
33
            humanMsg.displayAlert( __("Nothing to save") );
20
- 

Return to bug 36521