From 5086a827dfc5c84b9903497cd383eed7d055c826 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Mon, 11 Mar 2024 23:26:17 +0000 Subject: [PATCH] Bug 16122: Increment items.localuse Signed-off-by: Andrew Fuerste Henry Signed-off-by: Martin Renvoize --- C4/Circulation.pm | 3 +++ circ/circulation.pl | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 6df7ff83418..b3bf96131bc 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2152,6 +2152,7 @@ sub AddReturn { my $itemnumber = $item->itemnumber; my $itemtype = $item->effective_itemtype; + my $localuse_count = $item->localuse || 0; my $issue = $item->checkout; if ( $issue ) { @@ -2167,6 +2168,8 @@ sub AddReturn { # No issue, no borrowernumber. ONLY if $doreturn, *might* you have a $borrower later. # Record this as a local use, instead of a return, if the RecordLocalUseOnReturn is on if (C4::Context->preference("RecordLocalUseOnReturn")) { + $localuse_count++; + $item->localuse( $localuse_count )->store; $messages->{'LocalUse'} = 1; $stat_type = 'localuse'; } diff --git a/circ/circulation.pl b/circ/circulation.pl index d61c4851f2d..d5011f4f679 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -369,6 +369,11 @@ if (@$barcodes && $op eq 'cud-checkout') { BORROWER => $stats_borrower, ); } + + #increment items.localuse + my $localuse_count = $item->localuse; + $localuse_count++; + $item->localuse( $localuse_count )->store; } # Fix for bug 7494: optional checkout-time fallback search for a book -- 2.44.0