From 3fb9b8c5e36ae3969a5f5c454b3b2987d5c55f70 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Wed, 2 Jul 2025 20:17:39 +0000 Subject: [PATCH] Bug 40296: Mark booking as completed when issuing --- C4/Circulation.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index bf93c32a590..60c8c209acc 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1766,6 +1766,17 @@ sub AddIssue { # In the case that the borrower has an on-site checkout # and SwitchOnSiteCheckouts is enabled this converts it to a regular checkout $issue = Koha::Checkouts->find( { itemnumber => $item_object->itemnumber } ); + + #if this checkout is a booking mark it as completed + if ( + my $booking = $item_object->find_booking( + { checkout_date => $issuedate, due_date => $datedue, patron_id => $patron->borrowernumber } + ) + ) + { + $booking->status('completed')->store; + } + if ($issue) { $issue->set($issue_attributes)->store; } else { @@ -1783,6 +1794,7 @@ sub AddIssue { ); } $issue->discard_changes; + $patron->update_lastseen('check_out'); if ( $item_object->location && $item_object->location eq 'CART' -- 2.39.5