[Koha-cvs] CVS: koha/C4 Stats.pm,1.17,1.18

MJ Ray slef at users.sourceforge.net
Mon Dec 15 11:53:49 CET 2003


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1:/tmp/cvs-serv30610/C4

Modified Files:
	Stats.pm 
Log Message:
DBI call fix for bug 662

Index: Stats.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Stats.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** Stats.pm	20 Jun 2003 12:34:48 -0000	1.17
--- Stats.pm	15 Dec 2003 10:53:47 -0000	1.18
***************
*** 94,101 ****
  	my $query="Select * from accountlines,borrowers where (accounttype = 'Pay' or accounttype ='W')
  					and accountlines.borrowernumber = borrowers.borrowernumber";
  	if ($time eq 'today'){
  		$query .= " and date = now()";
  	} else {
! 		$query.=" and date>='$time' and date<='$time2'";
  	}
  	#  my $query="Select * from statistics,borrowers
--- 94,103 ----
  	my $query="Select * from accountlines,borrowers where (accounttype = 'Pay' or accounttype ='W')
  					and accountlines.borrowernumber = borrowers.borrowernumber";
+ 	my @bind = ();
  	if ($time eq 'today'){
  		$query .= " and date = now()";
  	} else {
! 		$query.=" and date>=? and date<=?";
! 		@bind = ($time,$time2);
  	}
  	#  my $query="Select * from statistics,borrowers
***************
*** 110,114 ****
  	#  print $query;
  	my $sth=$dbh->prepare($query);
! 	$sth->execute;
  	my @results;
  	my $i=0;
--- 112,116 ----
  	#  print $query;
  	my $sth=$dbh->prepare($query);
! 	$sth->execute(@bind);
  	my @results;
  	my $i=0;
***************
*** 127,136 ****
  	my $dbh = C4::Context->dbh;
  	my $timestamp2=$timestamp-1;
! 	my $query="Select * from accountlines where borrowernumber=$borrowerno
! 	and timestamp = '$timestamp' and accounttype <> 'Pay' and
! 	accounttype <> 'W'";
! 	my $sth=$dbh->prepare($query);
  	#  print $query,"<br>";
! 	$sth->execute;
  	my $i=0;
  	my @results;
--- 129,138 ----
  	my $dbh = C4::Context->dbh;
  	my $timestamp2=$timestamp-1;
! 	my $query="";
! 	my $sth=$dbh->prepare("Select * from accountlines where borrowernumber=?
! 	and timestamp = ? and accounttype <> 'Pay' and
! 	accounttype <> 'W'");
  	#  print $query,"<br>";
! 	$sth->execute($borrowerno,$timestamp);
  	my $i=0;
  	my @results;
***************
*** 148,154 ****
  	my($date,$borrno)=@_;
  	my $dbh = C4::Context->dbh;
! 	my $query="select * from statistics where type='payment' and datetime >'$date' and  borrowernumber='$borrno'";
! 	my $sth=$dbh->prepare($query);
! 	$sth->execute;
  	#  print $query;
  	my $data=$sth->fetchrow_hashref;
--- 150,155 ----
  	my($date,$borrno)=@_;
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("select * from statistics where type='payment' and datetime >? and  borrowernumber=?");
! 	$sth->execute($date,$borrno);
  	#  print $query;
  	my $data=$sth->fetchrow_hashref;
***************
*** 162,166 ****
  sub unfilledreserves {
  	my $dbh = C4::Context->dbh;
! 	my $query="select *,biblio.title from reserves,reserveconstraints,biblio,borrowers,biblioitems where found <> 'F' and cancellationdate
  								is NULL and biblio.biblionumber=reserves.biblionumber and
  								reserves.constrainttype='o'
--- 163,167 ----
  sub unfilledreserves {
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("select *,biblio.title from reserves,reserveconstraints,biblio,borrowers,biblioitems where found <> 'F' and cancellationdate
  								is NULL and biblio.biblionumber=reserves.biblionumber and
  								reserves.constrainttype='o'
***************
*** 170,175 ****
  								reserves.borrowernumber=borrowers.borrowernumber and
  								biblioitems.biblioitemnumber=reserveconstraints.biblioitemnumber order by
! 								biblio.title,reserves.reservedate";
! 	my $sth=$dbh->prepare($query);
  	$sth->execute;
  	my $i=0;
--- 171,175 ----
  								reserves.borrowernumber=borrowers.borrowernumber and
  								biblioitems.biblioitemnumber=reserveconstraints.biblioitemnumber order by
! 								biblio.title,reserves.reservedate");
  	$sth->execute;
  	my $i=0;
***************
*** 180,189 ****
  	}
  	$sth->finish;
! 	$query="select *,biblio.title from reserves,biblio,borrowers where found <> 'F' and cancellationdate
  		is NULL and biblio.biblionumber=reserves.biblionumber and reserves.constrainttype='a' and
  		reserves.borrowernumber=borrowers.borrowernumber
  		order by
! 		biblio.title,reserves.reservedate";
! 	$sth=$dbh->prepare($query);
  	$sth->execute;
  	while (my $data=$sth->fetchrow_hashref){
--- 180,188 ----
  	}
  	$sth->finish;
! 	$sth=$dbh->prepare("select *,biblio.title from reserves,biblio,borrowers where found <> 'F' and cancellationdate
  		is NULL and biblio.biblionumber=reserves.biblionumber and reserves.constrainttype='a' and
  		reserves.borrowernumber=borrowers.borrowernumber
  		order by
! 		biblio.title,reserves.reservedate");
  	$sth->execute;
  	while (my $data=$sth->fetchrow_hashref){





More information about the Koha-cvs mailing list