Bug 41074: Don't reverse previous_patrons arrary

This patch alters the code to append instead of prepend, removing the need to reverse the list

To test:
1 - Write a report to get some patron
SELECT cardnumber,surname FROM borrowers WHERE cardnumber <>'' ORDER BY rand() LIMit 6
2 - Enabled 'showLastPatron' and set count to 3
    http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=showLastPatron
3 - Copy the barcodes in order from the report and search for them in patron search, you'll want two tabs so you can keep report open
4 - Notice at 4th patron that list order has changed
5 - When 5th patron is loaded, the 4th is removed from the list
6 - Apply patch
7 - Clear the list
8 - Repeat the test plan, but note that list order does not change
9 - Confirm the patrons are removed from the list in expected order when adding new
10 - Change the count to 1 and search for several patrons, ensuring the last patron link is always correct

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2025-10-22 18:00:33 +00:00 committed by Lucas Gass
parent 2d063d00d5
commit f689133aaf
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 1 additions and 2 deletions

View File

@ -256,11 +256,10 @@ $(document).ready(function () {
);
$("#lastborrower-window").css("display", "inline-flex");
previous_patrons.reverse();
for (i in previous_patrons) {
p = previous_patrons[i];
const el = `<li><a class="dropdown-item" href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=${p["borrowernumber"]}">${p["name"]} (${p["card"]})</a></li>`;
$("#lastBorrowerList").prepend(el);
$("#lastBorrowerList").append(el);
}
}