[Koha-cvs] CVS: koha/C4/Circulation Circ2.pm,1.67,1.68
Paul POULAIN
tipaul at users.sourceforge.net
Thu Feb 12 10:16:21 CET 2004
Update of /cvsroot/koha/koha/C4/Circulation
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6867/C4/Circulation
Modified Files:
Circ2.pm
Log Message:
new feature : stocktaking/inventory.
Look in reports menu
(no DB changes)
Index: Circ2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -r1.67 -r1.68
*** Circ2.pm 11 Feb 2004 08:40:10 -0000 1.67
--- Circ2.pm 12 Feb 2004 09:16:18 -0000 1.68
***************
*** 53,56 ****
--- 53,57 ----
The functions in this module deal with circulation, issues, and
returns, as well as general information about the library.
+ Also deals with stocktaking.
=head1 FUNCTIONS
***************
*** 64,71 ****
¤tissues &getissues &getiteminformation
&issuebook &returnbook &find_reserves &transferbook &decode
! &calc_charges);
# &getbranches &getprinters &getbranch &getprinter => moved to C4::Koha.pm
=item getpatroninformation
--- 65,103 ----
¤tissues &getissues &getiteminformation
&issuebook &returnbook &find_reserves &transferbook &decode
! &calc_charges &listitemsforinventory &itemseen);
# &getbranches &getprinters &getbranch &getprinter => moved to C4::Koha.pm
+ =item itemseen
+ &itemseen($itemnum)
+ Mark item as seen. Is called when an item is issued, returned or manually marked during inventory/stocktaking
+ C<$itemnum> is the item number
+
+ =back
+
+ =cut
+ sub itemseen {
+ my ($itemnum) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("update items set datelastseen = now() where items.itemnumber = ?");
+ $sth->execute($itemnum);
+ return;
+ }
+
+ sub listitemsforinventory {
+ my ($minlocation,$maxlocation,$datelastseen,$offset,$size) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("select itemnumber,barcode,bulk,title,author from items,biblio where items.biblionumber=biblio.biblionumber and bulk>= ? and bulk <=? and (datelastseen< ? or datelastseen is null) order by bulk,title");
+ $sth->execute($minlocation,$maxlocation,$datelastseen);
+ my @results;
+ while (my $row = $sth->fetchrow_hashref) {
+ $offset-- if ($offset);
+ if ((!$offset) && $size) {
+ push @results,$row;
+ $size--;
+ }
+ }
+ return \@results;
+ }
=item getpatroninformation
***************
*** 445,449 ****
VALUES ($itm, $fbr, now(), $tbr)");
#update holdingbranch in items .....
! $dbh->do("UPDATE items SET datelastseen = now(), holdingbranch = $tbr WHERE items.itemnumber = $itm");
return;
}
--- 477,482 ----
VALUES ($itm, $fbr, now(), $tbr)");
#update holdingbranch in items .....
! $dbh->do("UPDATE items holdingbranch = $tbr WHERE items.itemnumber = $itm");
! &itemseen($itm);
return;
}
***************
*** 757,763 ****
$sth->finish;
$iteminformation->{'issues'}++;
! $sth=$dbh->prepare("update items set issues=?,datelastseen=now() where itemnumber=?");
$sth->execute($iteminformation->{'issues'},$iteminformation->{'itemnumber'});
$sth->finish;
# If it costs to borrow this book, charge it to the patron's account.
my ($charge,$itemtype)=calc_charges($env, $dbh, $iteminformation->{'itemnumber'}, $patroninformation->{'borrowernumber'});
--- 790,797 ----
$sth->finish;
$iteminformation->{'issues'}++;
! $sth=$dbh->prepare("update items set issues=? where itemnumber=?");
$sth->execute($iteminformation->{'issues'},$iteminformation->{'itemnumber'});
$sth->finish;
+ &itemseen($iteminformation->{'itemnumber'});
# If it costs to borrow this book, charge it to the patron's account.
my ($charge,$itemtype)=calc_charges($env, $dbh, $iteminformation->{'itemnumber'}, $patroninformation->{'borrowernumber'});
***************
*** 919,925 ****
$sth->execute($brn,$itm);
$sth->finish;
! $sth=$dbh->prepare("update items set datelastseen=now() where itemnumber=?");
! $sth->execute($itm);
! $sth->finish;
return;
}
--- 953,957 ----
$sth->execute($brn,$itm);
$sth->finish;
! &itemseen($itm);
return;
}
More information about the Koha-cvs
mailing list