Bug 42443: (QA follow-up) Use library selects for Sent from and Home library filters

Replace the free-text filter inputs for the "Sent from" and "Home library"
columns with select dropdowns populated from the full library list, consistent
with other DataTables pages such as the pending bookings page.

The "Sent from" column is made visible again (it was previously hidden since
rowGroup provides the visual grouping); showing it also allows its filter cell
to render.

The "On hold for" column intentionally has no filter: it is computed from two
different embedded sub-objects (item.first_hold.patron or item.recall.patron)
and has no single API field to filter against server-side.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-06-11 18:14:39 +01:00 committed by Pedro Amorim
parent dcb423b766
commit d7a87e2cbd
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 12 additions and 5 deletions

View File

@ -4,6 +4,7 @@
[% USE KohaDates %]
[% USE Branches %]
[% USE TablesSettings %]
[% USE To %]
[% PROCESS 'i18n.inc' %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
@ -53,6 +54,12 @@
var table_settings = [% TablesSettings.GetTableSettings( 'circ', 'transferstoreceive', 'transferstoreceive', 'json' ) | $raw %];
var TransfersMaxDaysWarning = [% TransfersMaxDaysWarning ? TransfersMaxDaysWarning : 0 | html %];
var all_libraries = [% To.json(Branches.all) | $raw %].map(function (e) {
e["_id"] = e.branchcode;
e["_str"] = e.branchname;
return e;
});
// Mirror the legacy "late transfer" calculation: a transfer is late once it has been
// sent for more than TransfersMaxDaysWarning days without arriving
function days_late(sent_date) {
@ -89,16 +96,14 @@
dataSrc: "from_library_id",
startRender: function (rows, group) {
var first = rows.data()[0];
return first.from_library
? escape_str(first.from_library.name)
: escape_str(group);
return first.from_library ? escape_str(first.from_library.name) : escape_str(group);
},
},
columnDefs: [{ visible: false, targets: [0] }],
columns: [
{
data: "me.from_library_id",
title: _("Sent from"),
dataFilter: "libraries",
searchable: true,
orderable: false,
render: function (data, type, row, meta) {
@ -171,6 +176,7 @@
{
data: "item.home_library_id",
title: _("Home library"),
dataFilter: "libraries",
searchable: true,
orderable: true,
render: function (data, type, row, meta) {
@ -201,7 +207,8 @@
},
table_settings,
1,
additional_filters
additional_filters,
{ libraries: all_libraries }
);
$("#transferstoreceive").on("click", ".cancel-transfer", function (e) {