From 2cdc3d4b1eb374f855b4d6c63664595310af2dd5 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Sun, 18 Feb 2024 17:25:33 +0000 Subject: [PATCH] Bug 33737: Fix undefined variable issues This patch resolves the undefined bookings_table variable issue reported and also further fixes a subsequent undefined timeline bug that was exposed by the original fix. Signed-off-by: esther --- koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt | 4 +--- koha-tmpl/intranet-tmpl/prog/js/cancel_booking_modal.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index 4339769d06..c4f938fe74 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -732,6 +732,7 @@ table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %] table_settings_holds_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'holds-table', 'json' ) | $raw %] + var bookings_table; $(document).ready(function() { $("#info_digests").tooltip(); @@ -751,7 +752,6 @@ }); // Bookings - var bookings_table; // Load bookings table on tab selection $("#bookings-tab").on( "click", function(){ if ( !bookings_table ) { @@ -831,8 +831,6 @@ }, [], 0, { patron_id: "[% patron.borrowernumber | html %]", end_date: { ">=": today.toISOString() } }); }; }); - // Bookings - }); function uncheck_sibling(me){ diff --git a/koha-tmpl/intranet-tmpl/prog/js/cancel_booking_modal.js b/koha-tmpl/intranet-tmpl/prog/js/cancel_booking_modal.js index 3b325f0fc5..03c9e0b83b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cancel_booking_modal.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cancel_booking_modal.js @@ -20,7 +20,7 @@ $("#cancelBookingForm").on('submit', function(e) { if (bookings_table) { bookings_table.api().ajax.reload(); } - if (timeline) { + if (typeof timeline !== 'undefined') { timeline.itemsData.remove(Number(booking_id)); } $('.bookings_count').html(parseInt($('.bookings_count').html(), 10)-1); -- 2.30.2