diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt index b679245c20..0c6130f10f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt @@ -39,8 +39,8 @@ Include resolved [% FOR st IN status %] - | Filter [% st.lib | html %] - + Filter [% st.lib | html %] + [% END %] @@ -87,6 +87,19 @@ } }, source: "catalog", + status: function () { + let avfilters = ["-and"]; + document.querySelectorAll(".status-filter-checkbox:checked").forEach(el => { + let av = el.id.split("_")[1]; + avfilters.push({ "!=": av }); + }); + + if (avfilters.length === 1) { + return; + } + // wrap with or status is NULL to keep rows where status is NULL + return ["-or", avfilters, { "=": null }]; + }, }; let external_filter_nodes = { hide_resolved_concerns: "#hide_resolved_concerns", @@ -264,23 +277,13 @@ statuses.forEach(function (st) { const av = st.authorised_value; + // reset filter for reloaded page + $(`#hide_${av}`).prop("checked", false); + $(`#${av}_filter`).on("click", function () { if ($(`#hide_${av}`).is(":checked")) { - additional_filters.status.find((o, i) => { - if (o["!="] === av) { - additional_filters.status.splice(i, 1); - return true; // stop searching - } - }); - if (additional_filters.status.length === 1) { - delete additional_filters.status; - } $(this).html(' ' + _("Filter ") + st.lib); } else { - if (!additional_filters.hasOwnProperty("status")) { - additional_filters.status = ["-and"]; - } - additional_filters.status.push({ "!=": av }); $(this).html(' ' + _("Include ") + st.lib); } $(`#hide_${av}`).prop("checked", !$(`#hide_${av}`).is(":checked"));