Bug 42997: (QA follow-up) Keep on-site checkouts due at the end of the day

circulation.pl still replaced the due date of an on-site checkout of a
booked item with the booking end date: with SpecifyDueDate disabled
the end-of-today due date computed for on-site checkouts was
clobbered, and with it enabled the same happened whenever staff left
the due date field empty. An on-site loan could therefore be due back
days after the on-site session.

- never stretch an on-site checkout to the booking end date; the due
  date behaves exactly as for a non-booked on-site checkout and
  AddIssue shrinks the booking end_date to the actual due date instead

Test plan:
1. Enable OnSiteCheckouts, disable SpecifyDueDate
2. Book an item for a patron starting today
3. Check the item out to them with 'On-site checkout' ticked
4. Without this patch the checkout is due at the booking end date;
   with it the checkout is due at the end of today and the booking
   end date follows it
5. Repeat with SpecifyDueDate enabled and the due date field left
   empty; the due date follows the circulation rules instead of the
   booking end date

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Paul Derscheid 2026-07-24 11:27:00 +02:00 committed by Pedro Amorim
parent 90281d5a1f
commit 987f302777
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 5 additions and 2 deletions

View File

@ -584,9 +584,12 @@ if ( @$barcodes && $op eq 'cud-checkout' ) {
# If booked (alerts or confirmation) update datedue to end of booking,
# unless staff explicitly specified a due date - AddIssue will sync
# the booking end_date with the override where possible
# the booking end_date with the override where possible. On-site
# checkouts are due back the same day and must never stretch to the
# booking end date; AddIssue shrinks the booking to match instead
if ( my $booked = $needsconfirmation->{BOOKED_EARLY} // $alerts->{BOOKED} ) {
$datedue = $booked->end_date unless ( $duedatespec_allow && $duedatespec );
$datedue = $booked->end_date
unless ( ( $duedatespec_allow && $duedatespec ) || $onsite_checkout );
}
# If renewing an item on hold, use renewonholdduedate (similar to renew.pl)