From 78bd76622f2cfd6e3a45162fddfc9df4920424cf Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 19 Jan 2024 20:38:32 +0000 Subject: [PATCH] Bug 35840: Fix Local use being double-counted in CanBookBeIssued To test: 1. APPLY PATCH, restart_all 2. Turn on RecordLocalUseOnReturn 3. Create a Statistical patron. 4. Check an item out to a regular patron. 5. Check the item out to a Statistical patron. 6. This should trigger a return and you will see 2 entries in the statistics table, one for localuse and one for a return. 7. Try checking out an item to the Stats patron that is NOT checked out. 8. You should only see 1 entry, localuse, in the statistics table. Signed-off-by: Brendan Lawlor --- C4/Circulation.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 109809d4b9..a8bf926626 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -836,7 +836,7 @@ sub CanBookBeIssued { ); my $block_lost_return = C4::Context->preference("BlockReturnOfLostItems") ? 1 : 0; my ( $stats_return, $stats_messages, $stats_iteminformation, $stats_borrower ) = - AddReturn( $item_object->barcode, C4::Context->userenv->{'branch'} ); + AddReturn( $item_object->barcode, C4::Context->userenv->{'branch'}, undef, undef, 1 ); ModDateLastSeen( $item_object->itemnumber, $block_lost_return ); # FIXME Move to Koha::Item return ( { @@ -2130,7 +2130,7 @@ patron who last borrowed the book. =cut sub AddReturn { - my ( $barcode, $branch, $exemptfine, $return_date ) = @_; + my ( $barcode, $branch, $exemptfine, $return_date, $localuse ) = @_; if ($branch and not Koha::Libraries->find($branch)) { warn "AddReturn error: branch '$branch' not found. Reverting to " . C4::Context->userenv->{'branch'}; @@ -2473,7 +2473,7 @@ sub AddReturn { ccode => $item->ccode, categorycode => $categorycode, interface => C4::Context->interface, - }); + }) unless $localuse; # Send a check-in slip. # NOTE: borrower may be undef. Do not try to send messages then. if ( $patron ) { -- 2.30.2