Bug 42505: (follow-up) Generate hold slip after confirming hold

The previous follow-up passed the checked-in itemnumber to the slip, but
the slip was still rendered before ModReserveAffect() confirmed the
hold. Fields updated during confirmation, such as waitingdate and
expirationdate, were therefore missing or stale on the first print.

Open a blank named popup during the user gesture, then submit the
confirmation form with print_slip set. The response page reuses that
popup after the hold has been updated.

This preserves the popup blocker fix and allows ReserveSlip() to use
the persisted hold and item data without passing individual fields as
workarounds.

To test:
1. Set HoldsAutoFill to "Don't".
2. Add the following to the HOLD_SLIP notice:
   Waiting since: [% hold.waitingdate | $KohaDates %]
   Barcode: <<items.barcode>>
3. Place a title-level "Next available" hold with pickup at the
   check-in library.
4. Check in a matching item.
5. Click "Print slip and confirm".
6. Confirm the popup is not blocked.
7. Confirm the first slip contains the item's barcode and today's
   waiting date.
8. Reload the slip and confirm the values are unchanged.

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Slava Shishkin 2026-09-28 15:33:01 +03:00 committed by Pedro Amorim
parent 3ce02836d0
commit 08333dc996
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 8 additions and 6 deletions

View File

@ -1670,13 +1670,15 @@
});
$(".print").on("click", function (e) {
// Open the hold transfer slip synchronously, while the user
// gesture is still active, so it is not blocked as an
// unsolicited popup after the form submission and page reload.
if (this.form && this.form.reserve_id && this.form.reserve_id.value) {
Dopop("hold-transfer-slip.pl?reserve_id=" + encodeURIComponent(this.form.reserve_id.value));
}
if (this.form) {
// Open a blank named popup synchronously, while the user
// gesture is still active, so it is not blocked. The
// response page will load the slip into that popup after
// the hold has been updated.
if (this.form.reserve_id && this.form.reserve_id.value) {
Dopop("");
}
this.form.print_slip.value = 1;
let barcode = document.getElementById("confirm-hold-barcode");
if (barcode) barcode.remove();
this.form.submit();