From e7a36d25787d8914e6ba4d30155bffac88370470 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 30 Jan 2019 19:58:25 +0000 Subject: [PATCH] Bug 22239: JavaScript error on subscription detail page when there are no orders This page modifies the subscription detail page so that a JavaScript error isn't triggered when a subscription has no acquisition details. To test, apply the patch and go to Serials. - Locate a subscription which isn't tied to acquisitions. In the browser console there should be no errors. - Locate a subscription which is part of an order. There should be an 'Acquisitions details' tab and the order information on that tab should be displayed as a collapsible tree. Signed-off-by: Charles Farmer Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens (cherry picked from commit a27a6e6d729cd3b6be0251c1c6bda5a763fea6bc) Signed-off-by: Martin Renvoize --- .../prog/en/modules/serials/subscription-detail.tt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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 9f14fbbfb4..4f95a2432d 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,10 +497,12 @@ 'bSort': false, }, columns_settings); - $(table).treetable({ - expandable: true - }); - $(table).treetable('expandAll'); + [% IF orders_grouped.size %] + $(table).treetable({ + expandable: true + }); + $(table).treetable('expandAll'); + [% END %] $("#hide_received_orders").click(function(e){ e.preventDefault(); -- 2.39.5