Bug 42912: Fix Uncaught TypeError on opac-readingrecord when no Checkout history
This prevents an 'Uncaught TypeError: can't access property "DataTable", table is undefined' when a patron has no items checked out yet and is visiting opac-readingrecord. The code now checks if table is defined before accessing its properties. Testplan: a) log in in opac, open dev console b) go to /cgi-bin/koha/opac-readingrecord.pl c) without patch applied the error above occurs d) apply patch and reload opac-readingrecord.pl, there should not be any error now e) check out an item in staff to that patron and check that the table on opac-readingrecord.pl is diplayed Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
bb16f1dd29
commit
7d354f3716
|
|
@ -252,18 +252,20 @@
|
|||
],
|
||||
});
|
||||
|
||||
let table_dt = table.DataTable();
|
||||
if (table) {
|
||||
let table_dt = table.DataTable();
|
||||
|
||||
$("#tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) {
|
||||
var id = e.target.id;
|
||||
let pattern = "";
|
||||
if (id == "checkout-tab") {
|
||||
pattern = "standard_checkout";
|
||||
} else if (id == "onsite_checkout-tab") {
|
||||
pattern = "onsite_checkout";
|
||||
}
|
||||
table_dt.columns(0).search(pattern).draw();
|
||||
});
|
||||
$("#tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) {
|
||||
var id = e.target.id;
|
||||
let pattern = "";
|
||||
if (id == "checkout-tab") {
|
||||
pattern = "standard_checkout";
|
||||
} else if (id == "onsite_checkout-tab") {
|
||||
pattern = "onsite_checkout";
|
||||
}
|
||||
table_dt.columns(0).search(pattern).draw();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
[% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue