Bugzilla – Attachment 191938 Details for
Bug 29800
Add option to calculate fines when an item is marked lost
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29800: Add calculation and update of fine to LostItem
Bug-29800-Add-calculation-and-update-of-fine-to-Lo.patch (text/plain), 3.09 KB, created by
Nick Clemens (kidclamp)
on 2026-01-23 13:53:35 UTC
(
hide
)
Description:
Bug 29800: Add calculation and update of fine to LostItem
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2026-01-23 13:53:35 UTC
Size:
3.09 KB
patch
obsolete
>From 1782560c9a3a706c82168143d9700729ade0f711 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 23 Jan 2026 12:45:40 +0000 >Subject: [PATCH] Bug 29800: Add calculation and update of fine to LostItem > >This patch adds a call to 'CalculateAndUpdateFine' to LostItem, checking if >the new syspref WhenLostUpdateFine is enabled >--- > C4/Circulation.pm | 35 ++++++++++++++++++----------------- > 1 file changed, 18 insertions(+), 17 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 163e1560d1f..9f0a3833567 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -4410,6 +4410,8 @@ $params: > sub LostItem { > my ( $itemnumber, $mark_lost_from, $force_mark_returned, $params ) = @_; > >+ my $item = Koha::Items->find($itemnumber); >+ > unless ($mark_lost_from) { > > # Temporary check to avoid regressions >@@ -4424,20 +4426,20 @@ sub LostItem { > $mark_returned = ( $pref =~ m|$mark_lost_from| ); > } > >- my $dbh = C4::Context->dbh(); >- my $sth = $dbh->prepare( >- "SELECT issues.*,items.*,biblio.title >- FROM issues >- JOIN items USING (itemnumber) >- JOIN biblio USING (biblionumber) >- WHERE issues.itemnumber=?" >- ); >- $sth->execute($itemnumber); >- my $issues = $sth->fetchrow_hashref(); >+ my $issue = $item->checkout; > > # If a borrower lost the item, add a replacement cost to the their record >- if ( my $borrowernumber = $issues->{borrowernumber} ) { >- my $patron = Koha::Patrons->find($borrowernumber); >+ if ($issue) { >+ my $patron = $issue->patron; >+ my $borrowernumber = $patron->borrowernumber; >+ >+ _CalculateAndUpdateFine( >+ { >+ issue => $issue, >+ item => $item->unblessed, >+ borrower => $patron->unblessed, >+ } >+ ) if C4::Context->preference('WhenLostUpdateFine'); > > my $fix = _FixOverduesOnReturn( > $borrowernumber, $itemnumber, C4::Context->preference('WhenLostForgiveFine'), >@@ -4450,12 +4452,12 @@ sub LostItem { > C4::Accounts::chargelostitem( > $borrowernumber, > $itemnumber, >- $issues->{'replacementprice'}, >+ $item->replacementprice, > sprintf( > "%s %s %s", >- $issues->{'title'} || q{}, >- $issues->{'barcode'} || q{}, >- $issues->{'itemcallnumber'} || q{}, >+ $item->biblio->title || q{}, >+ $item->barcode || q{}, >+ $item->itemcallnumber || q{}, > ), > ); > >@@ -4467,7 +4469,6 @@ sub LostItem { > } > > # When an item is marked as lost, we should automatically cancel its outstanding transfers. >- my $item = Koha::Items->find($itemnumber); > my $transfers = $item->get_transfers; > while ( my $transfer = $transfers->next ) { > $transfer->cancel( { reason => 'ItemLost', force => 1 } ); >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29800
:
191937
|
191938
|
191968
|
191969