From 98cb9971ffcb1167c062f5252ec5382af2e68ed8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 7 Apr 2026 10:20:29 +0200 Subject: [PATCH] Bug 42277: Remove JS error when viewing a subscription If no orders exist yet, there is a JS error in the console: Uncaught TypeError: can't access property "DataTable", table is undefined Test plan: 0. Do no apply this patch 1. Create a new subscription and go to the detail view 2. Open the console and notice the JS error 3. Apply this patch 4. Confirm that the JS error is gone 5. Create an order from this subscription 6. Confirm that the orders table is displayed Signed-off-by: Owen Leonard Signed-off-by: Brendan Lawlor Signed-off-by: Lucas Gass (cherry picked from commit da121583a4dd3f69406e3f5cde0505b85c186342) Signed-off-by: Jacob O'Mara Signed-off-by: Wainui Witika-Park (cherry picked from commit da718a2a577c698f24f29aac4242010ac562aa68) Signed-off-by: Fridolin Somers --- .../prog/en/modules/serials/subscription-detail.tt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt index 53b43ff26e..967af3f859 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt @@ -486,8 +486,8 @@ [% END %] - let table_dt = table.DataTable(); - $("#hide_received_orders").click(function(e){ + let table_dt = table?.DataTable(); + $("#hide_received_orders").click(function (e) { e.preventDefault(); table_dt.columns(4).search('^$', {regex: true}).draw(); // Not empty "Receive date" columns });