diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index 06540ae8ef..3442ac24ed 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -213,6 +213,24 @@ $(document).ready(function () { ); } + if (previous_patrons.length) { + let p = previous_patrons[0]; + $("#lastborrowerlink").show(); + $("#lastborrowerlink").prop("title", `${p["name"]} (${p["card"]})`); + $("#lastborrowerlink").prop( + "href", + `/cgi-bin/koha/circ/circulation.pl?borrowernumber=${p["borrowernumber"]}` + ); + $("#lastborrower-window").css("display", "inline-flex"); + + previous_patrons.reverse(); + for (i in previous_patrons) { + p = previous_patrons[i]; + const el = `
  • ${p["name"]} (${p["card"]})
  • `; + $("#lastBorrowerList").prepend(el); + } + } + if ($("#hiddenborrowernumber").val()) { // Remove this patron from the list if they are already there previous_patrons = previous_patrons.filter(function (p) { @@ -234,24 +252,6 @@ $(document).ready(function () { JSON.stringify(previous_patrons) ); } - - if (previous_patrons.length) { - let p = previous_patrons[0]; - $("#lastborrowerlink").show(); - $("#lastborrowerlink").prop("title", `${p["name"]} (${p["card"]})`); - $("#lastborrowerlink").prop( - "href", - `/cgi-bin/koha/circ/circulation.pl?borrowernumber=${p["borrowernumber"]}` - ); - $("#lastborrower-window").css("display", "inline-flex"); - - previous_patrons.reverse(); - for (i in previous_patrons) { - p = previous_patrons[i]; - const el = `
  • ${p["name"]} (${p["card"]})
  • `; - $("#lastBorrowerList").prepend(el); - } - } } if ($("#hiddenborrowernumber").val()) {