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 <oleonard@myacpl.org>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit da121583a4)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
This commit is contained in:
Jonathan Druart 2026-04-07 10:20:29 +02:00 committed by Wainui Witika-Park
parent 768f2a4882
commit da718a2a57
No known key found for this signature in database
GPG Key ID: 2D0A6AB5DAF1B78D
1 changed files with 2 additions and 2 deletions

View File

@ -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
});