Bug 40296: Mark booking as completed when issuing to booking patron
This patch adds logic to automatically mark a patron's booking as 'completed' when they check out the item they have booked. When AddIssue is called, the system now: - Checks if there's a conflicting booking for the checkout period - Marks the booking status as 'completed' if found This ensures booking status accurately reflects when items are actually checked out to fulfill bookings. Test plan: 1. Enable bookings system preference 2. Create a bookable item (set bookable = 1 in items table or via item editor) 3. Create a booking for a patron for that item with start date = today, end date = 7 days from now 4. Go to circulation and check out the item to the same patron who made the booking 5. Check the booking status in the database or via the bookings interface 6. Verify the booking status has changed from 'new' to 'completed' 7. Confirm the checkout was successful and shows normally in patron's checkouts list Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> (cherry picked from commita8fd9734c6) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> (cherry picked from commitaeb8648326) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
54cd13659d
commit
342b27c3a4
|
|
@ -1719,6 +1719,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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue