Bug 41898: (follow-up) Guard bookings.js against missing DOM when patron has no bookings
js/tables/bookings.js unconditionally called AdditionalFilters.init() for 'filter-completed' and 'filter-cancelled' on every page load where the script is included. patron-detail-tabs.inc only renders those filter elements (and #bookings_table itself) when the patron has at least one booking, past or present. For any patron with no booking history, this produced two console.debug 'Element not found' messages on moremember.pl and circ/circulation.pl. Guard the ready handler on the presence of #bookings_table, mirroring the existing pattern in holds.js. Test plan: 1) Open moremember.pl for a patron with no bookings; confirm no AdditionalFilters console messages appear. 2) Open moremember.pl / circ/circulation.pl for a patron with bookings; confirm the Bookings tab, filters, and table still work as before. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
d0a79a677c
commit
85c37deb77
|
|
@ -1,6 +1,10 @@
|
|||
// Bookings
|
||||
var bookings_table;
|
||||
$(document).ready(function () {
|
||||
if (!$("#bookings_table").length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const af = AdditionalFilters.init([
|
||||
"filter-completed",
|
||||
"filter-cancelled",
|
||||
|
|
|
|||
Loading…
Reference in New Issue