Bugzilla – Attachment 182944 Details for
Bug 40013
Allow custom/plugable filtering options for OPAC ILL table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40013: Add a way to inject custom filters for OPAC ILL table
Bug-40013-Add-a-way-to-inject-custom-filters-for-O.patch (text/plain), 3.15 KB, created by
HKS3 Tadeusz Sośnierz
on 2025-06-04 11:24:52 UTC
(
hide
)
Description:
Bug 40013: Add a way to inject custom filters for OPAC ILL table
Filename:
MIME Type:
Creator:
HKS3 Tadeusz Sośnierz
Created:
2025-06-04 11:24:52 UTC
Size:
3.15 KB
patch
obsolete
>From 2e42ac6e878f1fd4077faef0db55533c92c79982 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Tadeusz=20=E2=80=9Etadzik=E2=80=9D=20So=C5=9Bnierz?= > <tadeusz@sosnierz.com> >Date: Wed, 28 May 2025 11:35:32 +0200 >Subject: [PATCH] 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/> >--- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >index 20b8fea762..bcbcf04f25 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >@@ -421,6 +421,7 @@ > > return status_label; > } >+ let opac_illrequests_additional_filters = {}; > $("#illrequestlist").kohaTable({ > order: [[ 0, "desc" ]], > dom: '<"dt-info"i><"top pager"<"table_entries"lp>t<"bottom pager"pi>', >@@ -494,7 +495,7 @@ > }, > } > ] >- }); >+ }, undefined, undefined, opac_illrequests_additional_filters); > $("#backend-dropdown-options").removeClass("nojs"); > [% IF services_json.length > 0 %] > var services = [% services_json | $raw %]; >-- >2.49.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40013
:
182813
| 182944 |
182945
|
182947