[Koha-cvs] CVS: koha/C4/Circulation Circ2.pm,1.65.2.3,1.65.2.4

Paul POULAIN tipaul at users.sourceforge.net
Thu Feb 26 11:22:00 CET 2004


Update of /cvsroot/koha/koha/C4/Circulation
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22284/C4/Circulation

Modified Files:
      Tag: rel_2_0
	Circ2.pm 
Log Message:
porting inventory feature to rel_2_0

Index: Circ2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.65.2.3
retrieving revision 1.65.2.4
diff -C2 -r1.65.2.3 -r1.65.2.4
*** Circ2.pm	22 Jan 2004 21:21:56 -0000	1.65.2.3
--- Circ2.pm	26 Feb 2004 10:21:57 -0000	1.65.2.4
***************
*** 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 ****
  	&currentissues &getissues &getiteminformation
  	&issuebook &returnbook &find_reserves &transferbook &decode
! 	&calc_charges);
  
  # &getbranches &getprinters &getbranch &getprinter => moved to C4::Koha.pm
  
  =item getpatroninformation
  
--- 65,103 ----
  	&currentissues &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