[Patches] [PATCH] bug_5211: LostItem() - added charge_fee param to control fee charging

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Sat Dec 3 14:15:09 NZDT 2011


From: Srdjan Jankovic <srdjan at catalyst.net.nz>
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.
---
 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 debef01..3d63224 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -3021,7 +3021,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 
@@ -3036,7 +3036,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 379c12c..7f93ee1 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 2179d10..3843544 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 701d421..94cfa69 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};
                 }
             };
 		    }
-- 
1.6.5




More information about the Patches mailing list