Bug 38196: Fix filter in catalog concerns to show tickets where status is NULL
This patch fixes issues on catalog concerns when filtering for self defined authorized values (AV). When querying for status != AV, also rows with status = NULL are omitted as SQL here only checks for defined values in status. The patch wraps the a filter query with an 'or status is NULL'. Test plan: apply patch dependencies (42283) if not already included and run restart_all a) enable system preference CatalogConcerns b) create some authorised values in TICKET_STATUS c) create several concerns/tickets (biblio detail page -> new catalog concern) d) go to /cgi-bin/koha/cataloguing/concerns.pl and change some ticket status to have some variation for filtering e) play with the filters on the top (resolved and self created TICKET_STATUS) - when clicking 'Filter resolved' tickets with status 'Resolved by ... date' get filtered - when filtering self created TICKET_STATUS values tickets with that status AND tickets with status Open are disappearing f) apply patch and run restart_all g) retry steps in e) and check that only the filtered status are filtered from the results list. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
f4bd0afa1b
commit
69217a2bc4
|
|
@ -39,8 +39,8 @@
|
|||
<a id="resolved_filter"><i class="fa fa-bars"></i> Include resolved</a>
|
||||
<input type="checkbox" id="hide_resolved_concerns" style="display:none;" />
|
||||
[% FOR st IN status %]
|
||||
| <a id="[% st.authorised_value | html %]_filter"><i class="fa fa-filter"></i> Filter [% st.lib | html %]</a>
|
||||
<input type="checkbox" id="hide_[% st.authorised_value | html %]" style="display:none;" />
|
||||
<a id="[% st.authorised_value | html %]_filter"><i class="fa fa-filter"></i> Filter [% st.lib | html %]</a>
|
||||
<input type="checkbox" id="hide_[% st.authorised_value | html %]" style="display:none;" class="status-filter-checkbox" />
|
||||
[% END %]
|
||||
</fieldset>
|
||||
|
||||
|
|
@ -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('<i class="fa fa-filter"></i> ' + _("Filter ") + st.lib);
|
||||
} else {
|
||||
if (!additional_filters.hasOwnProperty("status")) {
|
||||
additional_filters.status = ["-and"];
|
||||
}
|
||||
additional_filters.status.push({ "!=": av });
|
||||
$(this).html('<i class="fa fa-bars"></i> ' + _("Include ") + st.lib);
|
||||
}
|
||||
$(`#hide_${av}`).prop("checked", !$(`#hide_${av}`).is(":checked"));
|
||||
|
|
|
|||
Loading…
Reference in New Issue