From e3cf3da12fd1ba4a5eb0ee164c44fbe93f3900a1 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 52f2330967..688b071514 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2144,6 +2144,7 @@ sub AddReturn { my $itemnumber = $item->itemnumber; my $itemtype = $item->effective_itemtype; + my $localuse_count = $item->localuse || 0; my $issue = $item->checkout; if ( $issue ) { @@ -2159,6 +2160,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 cb139f0f59..f5c82fdef6 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -376,6 +376,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.30.2