Bugzilla – Attachment 163849 Details for
Bug 36347
Return claims table is loaded twice
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36347: Avoid return claims table being loaded twice
Bug-36347-Avoid-return-claims-table-being-loaded-t.patch (text/plain), 2.57 KB, created by
Lucas Gass (lukeg)
on 2024-03-25 18:01:08 UTC
(
hide
)
Description:
Bug 36347: Avoid return claims table being loaded twice
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2024-03-25 18:01:08 UTC
Size:
2.57 KB
patch
obsolete
>From ab198101bd1fdcad495138c9d5e76707cdb8d0be Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 18 Mar 2024 16:07:02 +0100 >Subject: [PATCH] Bug 36347: Avoid return claims table being loaded twice > >The issue is caused by these lines in circulation.js: > >$("#finesholdsissues a[data-toggle='tab']").on("shown.bs.tab", function(e){ > $(this).click(); >}); > >When the user clicks on a hidden tab, 'shown.bs.tab' is triggered and >then another click event is triggered. And because the table was loaded >on tab click, it was loaded twice. >Visually it could have caused the rows to be duplicated (it was random, >probably due to timing, network latency, ...) > >I don't know why we need to trigger a click in this case, but removing >this will probably break something else, so the fix here is to load the >table on 'shown.bs.tab' event instead of 'click' > >This patch also contains a small fix in refreshReturnClaimsTable which >was reloading the table right after the table initialization. > >Test plan: >1. Check out an item, and in the checkouts table, click "Claim returned" >2. Open the network tab of your browser's developer tools >3. Click on the "Claims" tab, verify that only one call is made to > svc/return_claims >4. Verify that the claims table is displayed correctly > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index dacdbd8001..57a9d96c70 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -993,15 +993,19 @@ $(document).ready(function() { > issuesTable.api().ajax.reload(); > }); > >- // Don't load return claims table unless it is clicked on >+ // Don't load return claims table unless its tab is shown > var returnClaimsTable; >- $("#return-claims-tab").click( function() { >+ $("#return-claims-tab").on('shown.bs.tab', function() { > refreshReturnClaimsTable(); > }); > > function refreshReturnClaimsTable(){ >- loadReturnClaimsTable(); >- $("#return-claims-table").DataTable().ajax.reload(); >+ const table = $('#return-claims-table'); >+ if ($.fn.dataTable.isDataTable(table)) { >+ table.DataTable().ajax.reload(); >+ } else { >+ loadReturnClaimsTable(); >+ } > } > function loadReturnClaimsTable() { > if ( ! returnClaimsTable ) { >-- >2.30.2
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 36347
:
163340
|
163747
| 163849