https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38196

Brendan Lawlor <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Signed Off                  |Failed QA

--- Comment #13 from Brendan Lawlor <[email protected]> ---
There is a bug in concerns.tt line 93 when looping over the checked checkboxes:
let av = el.id.split("_")[1]; 

This takes the checkbox id, splits on "_" and takes the second element, which
should be the authorized value for the filter to use.

But in line 43 the checkbox ids are rendered like this:
id="hide_[% st.authorised_value | html %]"

If you create an authorized value with an underscore like IN_PROGRESS the
checkbox id  will be hide_IN_PROGRESS. Then splitting on '_' and taking the
second element makes av = 'IN' and the filter will be { "!=": "IN" } which
doesn't match, or could even match a different authorized value.

Instead of trying to get the authorized values of the statuses from the
checkbox ids, it'd be cleaner to use the statuses array that is already built
in lines 71-77:
       var statuses = [];
        [% FOR st IN status %]
            statuses.push({
                authorised_value: "[% st.authorised_value | html %]",
                lib: "[% st.lib | html %]",
            });
        [% END %]

Then at line 90 you could loop over the statuses and check if the checkbox is
checked like this:
status: function () {
    let avfilters = ["-and"];
    statuses.forEach(s => {
        if ($(`#hide_${s.authorised_value}`).is(":checked")) {
            avfilters.push({ "!=": s.authorised_value });
        }
    });

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to