[Koha-patches] [PATCH] process change to lost status when set from Edit Item screen

Michael Hafen mdhafen at tech.washk12.org
Tue Dec 23 22:36:57 CET 2008


Do the apropriate thing if the itemlost status is change on the Edit
Item screen, as opposed to the lost status being changed on the Item
Information screen.
---
 cataloguing/additem.pl |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl
index f8780c2..6e06e39 100755
--- a/cataloguing/additem.pl
+++ b/cataloguing/additem.pl
@@ -177,6 +177,17 @@ if ($op eq "additem") {
     if ($exist_itemnumber && $exist_itemnumber != $itemnumber) {
         push @errors,"barcode_not_unique";
     } else {
+        # check if Lost was change.
+        my $exist_lost = get_item_status( $itemnumber );
+        if ( $exist_lost != $addedolditem->{'lost'} ) {
+            if ( $exist_lost == 0 && $addedolditem->{'lost'} == 1 ) {
+                C4::Accounts::chargelostitem($itemnumber)
+            } elsif ( $exist_lost == 1 && $addedolditem->{'lost'} == 0 ) {
+                # FIXME Should check if the previous borrower lost the item,
+                # and pass their info here instead of an empty hash
+                C4::Circulation::FixAccountForLostAndReturned( $addedolditem, {} );
+            }
+        }
         my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = ModItemFromMarc($itemtosave,$biblionumber,$itemnumber);
     $itemnumber="";
     }
-- 
1.5.6.3



More information about the Koha-patches mailing list