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

HKS3 Tadeusz Sośnierz <tade...@sosnierz.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #182813|0                           |1
        is obsolete|                            |

--- Comment #6 from HKS3 Tadeusz Sośnierz <tade...@sosnierz.com> ---
Created attachment 182944
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=182944&action=edit
Bug 40013: Add a way to inject custom filters for OPAC ILL table

Test plan:

1. In KTD, go to
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=master+switch
and enable the ILL module
2. Set the following OPACUserJS:

    document.addEventListener('DOMContentLoaded', function() {
        const listInfo = document.querySelector('#illrequestlist_info');
        if (listInfo) {
            const statusFilters = document.createElement('div');
            listInfo.parentElement.appendChild(statusFilters);

            const shortcuts = [
                ['Show new requests', 'NEW'],
                ['Show ordered requests', 'ORDERED'],
                ['Show all requests', ''],
            ];

            for (const [label, status] of shortcuts) {
                const button = document.createElement('button');
                button.textContent = label;
                button.className = 'btn btn-secondary';
                button.onclick = () => {
                    if (status) {
                        opac_illrequests_additional_filters['me.status'] = {
'=': status };
                    } else {
                        delete
opac_illrequests_additional_filters['me.status'];
                    }
                    $('#illrequestlist').DataTable().draw();
                };
                statusFilters.parentElement.appendChild(button);
            }
        }
    });

2. Run the following in koha-shell to populate the request list for user
`koha`:

    perl -Mt::lib::TestBuilder -e '
      my $builder = t::lib::TestBuilder->new;

      do {
        $builder->build_sample_ill_request({borrowernumber => 51, status => ($_
> 10 ? "NEW" : "ORDERED")});
      } for (1..50);
    '
3. Navigate to http://localhost:8080/cgi-bin/koha/opac-illrequests.pl, log in
as `koha` as needed
4. Observe the new buttons affecting the requests displayed in the table

Sponsored-by: Wiko <https://www.wiko-berlin.de/>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to