From da718a2a577c698f24f29aac4242010ac562aa68 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 --- .../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 6d25533f1a..21f4ffc6dc 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 @@ -497,8 +497,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 });