Bug 41563: Remove JS error from newordersuggestion

Not caused by this patchset but it's a good place to fix it (and not add
a conflict)

Uncaught TypeError: can't access property "DataTable", suggestionst is undefined

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2026-01-26 13:12:49 +01:00 committed by Lucas Gass
parent d45c6ce115
commit ebff6e124d
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 23 additions and 21 deletions

View File

@ -130,28 +130,30 @@
[% Asset.js("js/acquisitions-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'calendar.inc' %]
<script>
const logged_in_user = [% To.json(logged_in_user.unblessed) | $raw %];
</script>
<script>
$(document).ready(function () {
var suggestionst = $("#suggestionst").kohaTable({
columnDefs: [
{ targets: [0], visible: false, searchable: true }, // must be searchable for filtering
],
pagingType: "full",
[% IF suggestions.size %]
<script>
const logged_in_user = [% To.json(logged_in_user.unblessed) | $raw %];
</script>
<script>
$(document).ready(function () {
var suggestionst = $("#suggestionst").kohaTable({
columnDefs: [
{ targets: [0], visible: false, searchable: true }, // must be searchable for filtering
],
pagingType: "full",
});
let table_dt = suggestionst.DataTable();
$("#show_only_mine").on("click", function (e) {
e.preventDefault();
table_dt.columns(0).search(`^${logged_in_user.borrowernumber}$`, true).draw();
});
$("#show_all").on("click", function (e) {
e.preventDefault();
table_dt.columns(0).search("").draw();
});
});
let table_dt = suggestionst.DataTable();
$("#show_only_mine").on("click", function (e) {
e.preventDefault();
table_dt.columns(0).search(`^${logged_in_user.borrowernumber}$`, true).draw();
});
$("#show_all").on("click", function (e) {
e.preventDefault();
table_dt.columns(0).search("").draw();
});
});
</script>
</script>
[% END %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]