From 4777fc62768571282daef25072215d0197b70d5d 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 --- C4/Circulation.pm | 3 +++ circ/circulation.pl | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 522ac9d768..a2e24d9850 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2151,6 +2151,7 @@ sub AddReturn { my $itemnumber = $item->itemnumber; my $itemtype = $item->effective_itemtype; + my $localuse_count = $item->localuse || 0; my $issue = $item->checkout; if ( $issue ) { @@ -2166,6 +2167,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 d61c4851f2..d5011f4f67 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.30.2