From cbcf2cfbd6a7fcbac02e296daf8eec078c42325e Mon Sep 17 00:00:00 2001 From: Srdjan Jankovic Date: Fri, 2 Dec 2011 13:26:50 +1300 Subject: [PATCH] bug_5211: LostItem() - added charge_fee param to control fee charging Pass charge_fee = yes wherever is LostItem() called, which effectively means tha there's no change. Signed-off-by: Paul Poulain (cherry picked from commit 1713133fddbd5ee8f722061ef8e1a9b836db1fa0) Signed-off-by: Chris Nighswonger --- C4/Circulation.pm | 5 +++-- catalogue/updateitem.pl | 2 +- misc/cronjobs/longoverdue.pl | 2 +- tools/batchMod.pl | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index d2c5f5926b..02e13c03a3 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2961,7 +2961,7 @@ sub ReturnLostItem{ sub LostItem{ - my ($itemnumber, $mark_returned) = @_; + my ($itemnumber, $mark_returned, $charge_fee) = @_; my $dbh = C4::Context->dbh(); my $sth=$dbh->prepare("SELECT issues.*,items.*,biblio.title @@ -2976,7 +2976,8 @@ sub LostItem{ # if a borrower lost the item, add a replacement cost to the their record if ( my $borrowernumber = $issues->{borrowernumber} ){ - C4::Accounts::chargelostitem($borrowernumber, $itemnumber, $issues->{'replacementprice'}, "Lost Item $issues->{'title'} $issues->{'barcode'}"); + C4::Accounts::chargelostitem($borrowernumber, $itemnumber, $issues->{'replacementprice'}, "Lost Item $issues->{'title'} $issues->{'barcode'}") + if $charge_fee; #FIXME : Should probably have a way to distinguish this from an item that really was returned. #warn " $issues->{'borrowernumber'} / $itemnumber "; MarkIssueReturned($borrowernumber,$itemnumber) if $mark_returned; diff --git a/catalogue/updateitem.pl b/catalogue/updateitem.pl index 379c12c76d..7f93ee1d79 100755 --- a/catalogue/updateitem.pl +++ b/catalogue/updateitem.pl @@ -74,6 +74,6 @@ if (defined $itemnotes) { # i.e., itemnotes parameter passed from form ModItem($item_changes, $biblionumber, $itemnumber); -LostItem($itemnumber, 'MARK RETURNED') if $itemlost; +LostItem($itemnumber, 'MARK RETURNED', 'CHARGE FEE') if $itemlost; print $cgi->redirect("moredetail.pl?biblionumber=$biblionumber&itemnumber=$itemnumber#item$itemnumber"); diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl index 2179d10889..38435446d3 100755 --- a/misc/cronjobs/longoverdue.pl +++ b/misc/cronjobs/longoverdue.pl @@ -154,7 +154,7 @@ foreach my $startrange (sort keys %$lost) { printf ("Due %s: item %5s from borrower %5s to lost: %s\n", $row->{date_due}, $row->{itemnumber}, $row->{borrowernumber}, $lostvalue) if($verbose); if($confirm) { ModItem({ itemlost => $lostvalue }, $row->{'biblionumber'}, $row->{'itemnumber'}); - LostItem($row->{'itemnumber'}) if( $charge && $charge eq $lostvalue); + LostItem($row->{'itemnumber'}, undef, 'CHARGE FEE') if( $charge && $charge eq $lostvalue); } $count++; } diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 701d421e28..94cfa695de 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -177,7 +177,7 @@ if ($op eq "action") { UpdateMarcWith( $marcitem, $localmarcitem ); eval{ if ( my $item = ModItemFromMarc( $localmarcitem, $itemdata->{biblionumber}, $itemnumber ) ) { - LostItem($itemnumber, 'MARK RETURNED') if $item->{itemlost}; + LostItem($itemnumber, 'MARK RETURNED', 'CHARGE FEE') if $item->{itemlost}; } }; } -- 2.39.5