From 2dbb13abd4f7f3bd2a1c29effc6788f84b73c783 Mon Sep 17 00:00:00 2001 From: rangi Date: Thu, 22 Sep 2005 23:30:37 +0000 Subject: [PATCH] Marks the item borrowed now on the items table --- C4/Circulation/Circ2.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/C4/Circulation/Circ2.pm b/C4/Circulation/Circ2.pm index 657a0c6286..6e1feb17ad 100755 --- a/C4/Circulation/Circ2.pm +++ b/C4/Circulation/Circ2.pm @@ -86,6 +86,22 @@ sub itemseen { return; } +=head2 itemborrowed + +&itemseen($itemnum) +Mark item as borrowed. Is called when an item is issued. +C<$itemnum> is the item number + +=cut + +sub itemborrowed { + my ($itemnum) = @_; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare("update items set itemlost=0, datelastborrowed = now() where items.itemnumber = ?"); + $sth->execute($itemnum); + return; +} + sub listitemsforinventory { my ($minlocation,$maxlocation,$datelastseen,$offset,$size) = @_; my $dbh = C4::Context->dbh; @@ -890,6 +906,7 @@ sub issuebook { $sth->execute($iteminformation->{'issues'},$iteminformation->{'itemnumber'}); $sth->finish; &itemseen($iteminformation->{'itemnumber'}); + itemborrowed($iteminformation->{'itemnumber'}); # If it costs to borrow this book, charge it to the patron's account. my ($charge,$itemtype)=calc_charges($env, $iteminformation->{'itemnumber'}, $borrower->{'borrowernumber'}); if ($charge > 0) { -- 2.39.5