Bug 40107 - Article requests: some DataTables functionality is broken
Summary: Article requests: some DataTables functionality is broken
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Owen Leonard
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-10 11:46 UTC by Owen Leonard
Modified: 2025-06-24 19:43 UTC (History)
5 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes JavaScript errors in the staff interface article requests table. The tables weren't refreshing, and the tab numbers weren't updating, when selecting an action for individual or multiple requests (such as 'Set request as pending').
Version(s) released in:
25.11.00
Circulation function: Article requests


Attachments
Bug 40107: Article requests: Some DataTables functionality is broken (6.03 KB, patch)
2025-06-11 18:03 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 40107: Article requests: Some DataTables functionality is broken (6.07 KB, patch)
2025-06-13 19:54 UTC, David Nind
Details | Diff | Splinter Review
Bug 40107: Article requests: Some DataTables functionality is broken (6.17 KB, patch)
2025-06-24 13:31 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2025-06-10 11:46:56 UTC
When you change the status of an article request using the "Actions" menu, the affect row should be removed and the table redrawn. Instead there is an error in the console:

Uncaught (in promise) TypeError: requested_datatable.rows is not a function
    UpdateTabCounts http://127.0.0.1:8081/cgi-bin/koha/circ/article-requests.pl?branchcode=:11710
    SetPending http://127.0.0.1:8081/cgi-bin/koha/circ/article-requests.pl?branchcode=:11696
Comment 1 Owen Leonard 2025-06-11 18:03:54 UTC
Created attachment 183174 [details] [review]
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
Comment 2 Andrii Nugged 2025-06-12 12:34:17 UTC
.kohaTable() is jquery object?

... .kohaTable().DataTable();

then?
Comment 3 Owen Leonard 2025-06-13 13:40:02 UTC
(In reply to Andrii Nugged from comment #2)
> ... .kohaTable().DataTable();
> 
> then?

In this case both the jQuery object and the DataTables object are used.
Comment 4 David Nind 2025-06-13 19:54:39 UTC
Created attachment 183251 [details] [review]
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
Signed-off-by: David Nind <david@davidnind.com>
Comment 5 Andrii Nugged 2025-06-14 00:51:33 UTC
(In reply to Owen Leonard from comment #3)

> In this case both the jQuery object and the DataTables object are used.

thanks, clear.



(In reply to David Nind from comment #4)

> Created attachment 183251 [details] [review] [review]
> Bug 40107: Article requests: Some DataTables functionality is broken
> ...

Taking this to our productions on 25.05, let's see what they say on Monday, if issue is gone.
Comment 6 Marcel de Rooy 2025-06-24 13:31:56 UTC
Created attachment 183459 [details] [review]
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
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 7 Lucas Gass (lukeg) 2025-06-24 13:52:41 UTC
Nice work everyone!

Pushed to main for 25.11