Bugzilla – Attachment 183174 Details for
Bug 40107
Article requests: some DataTables functionality is broken
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40107: Article requests: Some DataTables functionality is broken
Bug-40107-Article-requests-Some-DataTables-functio.patch (text/plain), 6.03 KB, created by
Owen Leonard
on 2025-06-11 18:03:54 UTC
(
hide
)
Description:
Bug 40107: Article requests: Some DataTables functionality is broken
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2025-06-11 18:03:54 UTC
Size:
6.03 KB
patch
obsolete
>From 03233374a738a90017f79aee0e91a3cec4cdf437 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 11 Jun 2025 14:43:46 +0000 >Subject: [PATCH] Bug 40107: Article requests: Some DataTables functionality is > broken > >Bug 38255 standardized our DataTables using kohaTable. kohaTable returns >the affected table as a jQuery object, but JavaScript on the article >requests page in the staff client expects a DataTable object. This patch >updates the template accordingly. > >To test, apply the patch and enable the ArticleRequests system >preference if necessary. > >- Log in to the OPAC and place several article requests. >- In the staff interface, go to Circulation -> Article requests. >- From the list of new article requests, test the menu options under > "Actions." >- Changing the status of a request should make it disappear from the > "New" tab and appear under the tab for the new status (or it should > be removed, in case of cancel or complete). >- Test the same processes under the "Pending" and "Processing" tabs. >- Each time you perform one of these tasks the counters on each tab > should be updated correctly. > >Sponsored-by: Athens County Public Libraries >--- > .../prog/en/modules/circ/article-requests.tt | 29 +++++++++++-------- > 1 file changed, 17 insertions(+), 12 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt >index 22a1f994a05..a92f177f8d7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt >@@ -524,7 +524,7 @@ > [% INCLUDE 'datatables.inc' %] > <script> > var active_tab = "#article-requests-requested_panel"; >- var last_cancel_reason, requested_datatable, pending_datatable, processing_datatable, active_datatable; >+ var last_cancel_reason, requested_datatable, pending_datatable, processing_datatable, active_datatable, requested_dt, pending_dt, processing_dt; > $(document).ready(function() { > > $("#article-request-tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { >@@ -575,8 +575,14 @@ > }); > > requested_datatable = $("#article-requests-requested-table").kohaTable(); >+ requested_dt = requested_datatable.DataTable(); >+ > pending_datatable = $("#article-requests-pending-table").kohaTable(); >+ pending_dt = pending_datatable.DataTable(); >+ > processing_datatable = $("#article-requests-processing-table").kohaTable(); >+ processing_dt = processing_datatable.DataTable(); >+ > active_datatable = requested_datatable; > activateBatchActions( active_tab ); > }); >@@ -634,12 +640,11 @@ > > > a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide(); >- > $.ajax({ > type: "DELETE", > url: '/api/v1/article_requests/'+id+query, > success: function( data ) { >- active_datatable.row( a.closest('tr') ).remove().draw(); >+ active_datatable.DataTable().row( table_row ).remove().draw(); > UpdateTabCounts(); > activateBatchActions( active_tab ); > } >@@ -674,7 +679,7 @@ > async function Process( id, a ) { > var table_row = a.closest('tr'); > var table = a.closest('table'); >- var orig_datatable = table.attr('id')==='article-requests-pending-table'?pending_datatable:requested_datatable; >+ var orig_dt = table.attr('id')==='article-requests-pending-table'?pending_dt:requested_dt; > > a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" class="spinner"/>').find('div.dropdown').hide(); > >@@ -684,8 +689,8 @@ > $("img.spinner").remove(); > table_row.find('.ar-process-request').remove(); > table_row.find('input[type="checkbox"]').prop('checked', false); >- orig_datatable.row( table_row ).remove().draw(); >- processing_datatable.row.add( table_row ).draw(); >+ orig_dt.row( table_row ).remove().draw(); >+ processing_dt.row.add( table_row ).draw(); > UpdateTabCounts(); > activateBatchActions( active_tab ); > }, >@@ -711,7 +716,7 @@ > await client.articleRequests.complete(id).then( > success => { > $("img.spinner").remove(); >- active_datatable.row( a.closest('tr') ).remove().draw(); >+ active_datatable.DataTable().row( a.closest('tr') ).remove().draw(); > UpdateTabCounts(); > activateBatchActions( active_tab ); > }, >@@ -734,8 +739,8 @@ > await client.articleRequests.pending(id).then( > success => { > $("img.spinner").remove(); >- requested_datatable.row( table_row ).remove().draw(); >- pending_datatable.row.add( table_row ).draw(); >+ requested_dt.row( table_row ).remove().draw(); >+ pending_dt.row.add( table_row ).draw(); > UpdateTabCounts(); > activateBatchActions( active_tab ); > }, >@@ -750,9 +755,9 @@ > }); > > function UpdateTabCounts() { >- $("#ar_requested_count").html( requested_datatable.rows().count() ); >- $("#ar_pending_count").html( pending_datatable.rows().count() ); >- $("#ar_processing_count").html( processing_datatable.rows().count() ); >+ $("#ar_requested_count").html( requested_dt.rows().count() ); >+ $("#ar_pending_count").html( pending_dt.rows().count() ); >+ $("#ar_processing_count").html( processing_dt.rows().count() ); > } > > function EditURLs(id) { >-- >2.39.5
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 40107
:
183174
|
183251
|
183459