[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha bookcount.pl,1.7,1.8 deletemem.pl,1.9,1.10 overdue.
From: |
Paul POULAIN |
Subject: |
[Koha-cvs] CVS: koha bookcount.pl,1.7,1.8 deletemem.pl,1.9,1.10 overdue.pl,1.8,1.9 pay.pl,1.8,1.9 stats2.pl,1.4,1.5 thesaurus_popup.pl,1.13,1.14 updateitem.pl,1.8,1.9 |
Date: |
Mon, 12 Jan 2004 08:58:22 -0800 |
Update of /cvsroot/koha/koha
In directory sc8-pr-cvs1:/tmp/cvs-serv19731
Modified Files:
bookcount.pl deletemem.pl overdue.pl pay.pl stats2.pl
thesaurus_popup.pl updateitem.pl
Log Message:
sync'ing with rel_2_0 (mostly prepare/execute pb, bug #662)
Index: bookcount.pl
===================================================================
RCS file: /cvsroot/koha/koha/bookcount.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** bookcount.pl 8 May 2003 13:19:39 -0000 1.7
--- bookcount.pl 12 Jan 2004 16:58:20 -0000 1.8
***************
*** 108,115 ****
my ($itemnumber)address@hidden;
my $dbh = C4::Context->dbh;
! my $itm = $dbh->quote("$itemnumber");
! my $query = "select * from items where itemnumber=$itm";
! my $sth=$dbh->prepare($query);
! $sth->execute;
my $data=$sth->fetchrow_hashref;
$sth->finish;
--- 108,113 ----
my ($itemnumber)address@hidden;
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("select * from items where itemnumber=?");
! $sth->execute($itemnumber);
my $data=$sth->fetchrow_hashref;
$sth->finish;
***************
*** 120,131 ****
my ($itemnumber)address@hidden;
my $dbh = C4::Context->dbh;
! my $var1 = $dbh->quote($itemnumber);
! my $sth =$dbh->prepare("select max(branchtransfers.datearrived) from
branchtransfers where branchtransfers.itemnumber=$var1");
! $sth->execute;
my ($date) = $sth->fetchrow_array;
return(0, "Item has no branch transfers record") if not $date;
! my $var2 = $dbh->quote($date);
! $sth=$dbh->prepare("Select * from branchtransfers where
branchtransfers.itemnumber=$var1 and branchtransfers.datearrived=$var2");
! $sth->execute;
my ($data) = $sth->fetchrow_hashref;
return(0, "Item has no branch transfers record") if not $data;
--- 118,127 ----
my ($itemnumber)address@hidden;
my $dbh = C4::Context->dbh;
! my $sth =$dbh->prepare("select max(branchtransfers.datearrived) from
branchtransfers where branchtransfers.itemnumber=?");
! $sth->execute($itemnumber);
my ($date) = $sth->fetchrow_array;
return(0, "Item has no branch transfers record") if not $date;
! $sth=$dbh->prepare("Select * from branchtransfers where
branchtransfers.itemnumber=? and branchtransfers.datearrived=?");
! $sth->execute($itemnumber,$date);
my ($data) = $sth->fetchrow_hashref;
return(0, "Item has no branch transfers record") if not $data;
***************
*** 137,144 ****
my ($itemnumber, $date)address@hidden;
my $dbh = C4::Context->dbh;
! my $itm = $dbh->quote($itemnumber);
! my $dat = $dbh->quote($date);
! my $sth=$dbh->prepare("Select count(*) from issues where
issues.itemnumber=$itm and issues.timestamp > $dat");
! $sth->execute;
my $count=$sth->fetchrow_hashref;
$sth->finish;
--- 133,138 ----
my ($itemnumber, $date)address@hidden;
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("Select count(*) from issues where
issues.itemnumber=? and issues.timestamp > ?");
! $sth->execute($itemnumber,$date);
my $count=$sth->fetchrow_hashref;
$sth->finish;
***************
*** 149,157 ****
my ($itemnumber, $brcd)address@hidden;
my $dbh = C4::Context->dbh;
! my $itm = $dbh->quote($itemnumber);
! my $brc = $dbh->quote($brcd);
! my $query = "Select count(*) from issues where itemnumber=$itm and
branchcode = $brc";
! my $sth=$dbh->prepare($query);
! $sth->execute;
my ($count)=$sth->fetchrow_array;
$sth->finish;
--- 143,148 ----
my ($itemnumber, $brcd)address@hidden;
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("Select count(*) from issues where itemnumber=?
and branchcode = ?");
! $sth->execute($itemnumber,$brcd);
my ($count)=$sth->fetchrow_array;
$sth->finish;
***************
*** 160,178 ****
sub lastseenat {
! my ($itemnumber, $brcd)address@hidden;
my $dbh = C4::Context->dbh;
! my $itm = $dbh->quote($itemnumber);
! my $brc = $dbh->quote($brcd);
! my $query = "Select max(timestamp) from issues where itemnumber=$itm
and branchcode = $brc";
! my $sth=$dbh->prepare($query);
! $sth->execute;
my ($date1)=$sth->fetchrow_array;
$sth->finish;
! $query = "Select max(datearrived) from branchtransfers where
itemnumber=$itm and tobranch = $brc";
! # FIXME - There's already a $sth in this scope.
! my $sth=$dbh->prepare($query);
! $sth->execute;
my ($date2)=$sth->fetchrow_array;
$sth->finish;
$date2 =~ s/-//g;
$date2 =~ s/://g;
--- 151,165 ----
sub lastseenat {
! my ($itm, $brc)address@hidden;
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("Select max(timestamp) from issues where
itemnumber=? and branchcode = ?");
! $sth->execute($itm,$brc);
my ($date1)=$sth->fetchrow_array;
$sth->finish;
! $sth=$dbh->prepare("Select max(datearrived) from branchtransfers where
itemnumber=? and tobranch = ?");
! $sth->execute($itm,$brc);
my ($date2)=$sth->fetchrow_array;
$sth->finish;
+ #FIXME: MJR thinks unsafe
$date2 =~ s/-//g;
$date2 =~ s/://g;
Index: deletemem.pl
===================================================================
RCS file: /cvsroot/koha/koha/deletemem.pl,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** deletemem.pl 8 May 2003 11:57:35 -0000 1.9
--- deletemem.pl 12 Jan 2004 16:58:20 -0000 1.10
***************
*** 57,63 ****
my ($bor,$flags)=getpatroninformation(\%env, $member,'');
my $dbh = C4::Context->dbh;
! my $query="Select * from borrowers where guarantor='$member'";
! my $sth=$dbh->prepare($query);
! $sth->execute;
my $data=$sth->fetchrow_hashref;
$sth->finish;
--- 57,62 ----
my ($bor,$flags)=getpatroninformation(\%env, $member,'');
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("Select * from borrowers where guarantor=?");
! $sth->execute($member);
my $data=$sth->fetchrow_hashref;
$sth->finish;
***************
*** 86,113 ****
my ($member)address@hidden;
my $dbh = C4::Context->dbh;
! my $query="Select * from borrowers where borrowernumber='$member'";
! my $sth=$dbh->prepare($query);
! $sth->execute;
my @data=$sth->fetchrow_array;
$sth->finish;
! $query="Insert into deletedborrowers values (";
! foreach my $temp (@data){
! $query .= "'$temp',";
! }
! $query=~ s/\,$/\)/;
! # print $query;
! # FIXME - Use $dbh->do()
! $sth=$dbh->prepare($query);
! $sth->execute;
$sth->finish;
! # FIXME - Use $dbh->do()
! $query = "Delete from borrowers where borrowernumber='$member'";
! $sth=$dbh->prepare($query);
! $sth->execute;
$sth->finish;
! # FIXME - Use $dbh->do()
! $query="Delete from reserves where borrowernumber='$member'";
! $sth=$dbh->prepare($query);
! $sth->execute;
$sth->finish;
}
--- 85,100 ----
my ($member)address@hidden;
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("Select * from borrowers where borrowernumber=?");
! $sth->execute($member);
my @data=$sth->fetchrow_array;
$sth->finish;
! $sth=$dbh->prepare("Insert into deletedborrowers values
(".("?,"x(scalar(@data)-1))."?)");
! $sth->execute(@data);
$sth->finish;
! $sth=$dbh->prepare("Delete from borrowers where borrowernumber=?");
! $sth->execute($member);
$sth->finish;
! $sth=$dbh->prepare("Delete from reserves where borrowernumber=?");
! $sth->execute($member);
$sth->finish;
}
Index: overdue.pl
===================================================================
RCS file: /cvsroot/koha/koha/overdue.pl,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** overdue.pl 3 Jul 2003 22:00:21 -0000 1.8
--- overdue.pl 12 Jan 2004 16:58:20 -0000 1.9
***************
*** 57,63 ****
my $dbh = C4::Context->dbh;
! my $query="select date_due,borrowernumber,itemnumber from issues where
isnull(returndate) && date_due<'$todaysdate' order by date_due,borrowernumber";
! my $sth=$dbh->prepare($query);
! $sth->execute;
my @overduedata;
--- 57,62 ----
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("select date_due,borrowernumber,itemnumber from issues
where isnull(returndate) && date_due<? order by date_due,borrowernumber");
! $sth->execute($todaysdate);
my @overduedata;
***************
*** 67,73 ****
$itemnum=$data->{'itemnumber'};
! my $query="select concat(firstname,' ',surname),phone,emailaddress from
borrowers where borrowernumber='$bornum'";
! my $sth1=$dbh->prepare($query);
! $sth1->execute;
$data1=$sth1->fetchrow_hashref;
$name=$data1->{'concat(firstname,\' \',surname)'};
--- 66,71 ----
$itemnum=$data->{'itemnumber'};
! my $sth1=$dbh->prepare("select concat(firstname,'
',surname),phone,emailaddress from borrowers where borrowernumber=?");
! $sth1->execute($bornum);
$data1=$sth1->fetchrow_hashref;
$name=$data1->{'concat(firstname,\' \',surname)'};
***************
*** 76,91 ****
$sth1->finish;
! # FIXME - There's already a $query in this scope.
! my $query="select biblionumber from items where itemnumber='$itemnum'";
! my $sth2=$dbh->prepare($query);
! $sth2->execute;
$data2=$sth2->fetchrow_hashref;
$biblionumber=$data2->{'biblionumber'};
$sth2->finish;
! # FIXME - There's already a $query in this scope.
! my $query="select title,author from biblio where
biblionumber='$biblionumber'";
! my $sth3=$dbh->prepare($query);
! $sth3->execute;
$data3=$sth3->fetchrow_hashref;
$title=$data3->{'title'};
--- 74,85 ----
$sth1->finish;
! my $sth2=$dbh->prepare("select biblionumber from items where itemnumber=?");
! $sth2->execute($itemnum);
$data2=$sth2->fetchrow_hashref;
$biblionumber=$data2->{'biblionumber'};
$sth2->finish;
! my $sth3=$dbh->prepare("select title,author from biblio where
biblionumber=?");
! $sth3->execute($biblionumber);
$data3=$sth3->fetchrow_hashref;
$title=$data3->{'title'};
Index: pay.pl
===================================================================
RCS file: /cvsroot/koha/koha/pay.pl,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** pay.pl 6 Feb 2003 06:32:57 -0000 1.8
--- pay.pl 12 Jan 2004 16:58:20 -0000 1.9
***************
*** 158,183 ****
my $dbh = C4::Context->dbh;
my $env;
! my $query="Update accountlines set amountoutstanding=0 where ";
if ($accounttype eq 'Res'){
! $query.="accounttype='Res' and accountno='$accountnum' and
borrowernumber='$bornum'";
} else {
! $query.="accounttype='$accounttype' and itemnumber='$itemnum'
and borrowernumber='$bornum'";
}
- my $sth=$dbh->prepare($query);
- # print $query;
- $sth->execute;
$sth->finish;
! $query="select max(accountno) from accountlines";
! $sth=$dbh->prepare($query);
$sth->execute;
my $account=$sth->fetchrow_hashref;
$sth->finish;
$account->{'max(accountno)'}++;
! $query="insert into accountlines
(borrowernumber,accountno,itemnumber,date,amount,description,accounttype)
! values
('$bornum','$account->{'max(accountno)'}','$itemnum',now(),'$amount','Writeoff','W')";
! $sth=$dbh->prepare($query);
! $sth->execute;
$sth->finish;
- # print $query;
UpdateStats($env,$user,'writeoff',$amount,'','','',$bornum);
}
--- 158,179 ----
my $dbh = C4::Context->dbh;
my $env;
! my $sth;
if ($accounttype eq 'Res'){
! $sth=$dbh->prepare("Update accountlines set amountoutstanding=0
where accounttype='Res' and accountno=? and borrowernumber=?");
! $sth->execute($accountnum,$bornum);
} else {
! $sth=$dbh->prepare("Update accountlines set amountoutstanding=0
where accounttype=? and itemnumber=? and borrowernumber=?");
! $sth->execute($accounttype,$itemnum,$bornum);
}
$sth->finish;
! $sth=$dbh->prepare("select max(accountno) from accountlines");
$sth->execute;
my $account=$sth->fetchrow_hashref;
$sth->finish;
$account->{'max(accountno)'}++;
! $sth=$dbh->prepare("insert into accountlines
(borrowernumber,accountno,itemnumber,date,amount,description,accounttype)
! values
(?,?,?,now(),?,'Writeoff','W')");
! $sth->execute($bornum,$account->{'max(accountno)'},$itemnum,$amount);
$sth->finish;
UpdateStats($env,$user,'writeoff',$amount,'','','',$bornum);
}
Index: stats2.pl
===================================================================
RCS file: /cvsroot/koha/koha/stats2.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** stats2.pl 13 Oct 2002 07:35:23 -0000 1.4
--- stats2.pl 12 Jan 2004 16:58:20 -0000 1.5
***************
*** 63,67 ****
my $dbh = C4::Context->dbh;
! my $query="select *
from accountlines,accountoffsets,borrowers where
accountlines.borrowernumber=accountoffsets.borrowernumber and
--- 63,67 ----
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("select *
from accountlines,accountoffsets,borrowers where
accountlines.borrowernumber=accountoffsets.borrowernumber and
***************
*** 69,75 ****
=accountoffsets.offsetaccount) and accountlines.timestamp >=20000621000000
and borrowers.borrowernumber=accountlines.borrowernumber
! group by accountlines.borrowernumber,accountlines.accountno";
! my $sth=$dbh->prepare($query);
! $sth->execute;
--- 69,74 ----
=accountoffsets.offsetaccount) and accountlines.timestamp >=20000621000000
and borrowers.borrowernumber=accountlines.borrowernumber
! group by accountlines.borrowernumber,accountlines.accountno");
! $sth->execute();
Index: thesaurus_popup.pl
===================================================================
RCS file: /cvsroot/koha/koha/thesaurus_popup.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** thesaurus_popup.pl 28 Nov 2003 14:00:20 -0000 1.13
--- thesaurus_popup.pl 12 Jan 2004 16:58:20 -0000 1.14
***************
*** 75,80 ****
if ($search_string) {
# my $sti=$dbh->prepare("select id,freelib from bibliothesaurus where
freelib like '".$search_string."%' and category ='$category'");
! my $sti=$dbh->prepare("select id,freelib,father from bibliothesaurus
where match (category,freelib) AGAINST (?) and category ='$category'");
! $sti->execute($search_string);
while (my $line=$sti->fetchrow_hashref) {
$stdlib{$line->{'id'}} = "$line->{'father'} $line->{'freelib'}";
--- 75,80 ----
if ($search_string) {
# my $sti=$dbh->prepare("select id,freelib from bibliothesaurus where
freelib like '".$search_string."%' and category ='$category'");
! my $sti=$dbh->prepare("select id,freelib,father from bibliothesaurus
where match (category,freelib) AGAINST (?) and category =?");
! $sti->execute($search_string,$category);
while (my $line=$sti->fetchrow_hashref) {
$stdlib{$line->{'id'}} = "$line->{'father'} $line->{'freelib'}";
Index: updateitem.pl
===================================================================
RCS file: /cvsroot/koha/koha/updateitem.pl,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** updateitem.pl 18 Mar 2003 11:15:37 -0000 1.8
--- updateitem.pl 12 Jan 2004 16:58:20 -0000 1.9
***************
*** 89,94 ****
if ($lost ==1){
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("Select * from issues where (itemnumber='$itemnum')
and (returndate is null)");
! $sth->execute;
my $data=$sth->fetchrow_hashref;
if ($data->{'borrowernumber'} ne '') {
--- 89,94 ----
if ($lost ==1){
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("Select * from issues where (itemnumber=?) and
(returndate is null)");
! $sth->execute($itemnum);
my $data=$sth->fetchrow_hashref;
if ($data->{'borrowernumber'} ne '') {
***************
*** 96,109 ****
my $accountno=getnextacctno($env,$data->{'borrowernumber'},$dbh);
my $item=getiteminformation($env, $itemnum);
! my $account="Insert into accountlines
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber)
values
!
('$data->{'borrowernumber'}','$accountno',now(),'$item->{'replacementprice'}',
! 'Lost Item $item->{'title'} $item->{'barcode'}','L',
! '$item->{'replacementprice'}','$itemnum')";
! my $sth2=$dbh->prepare($account);
! # print $input->header;
! # print $account;
! $sth2->execute;
$sth2->finish;
}
--- 96,106 ----
my $accountno=getnextacctno($env,$data->{'borrowernumber'},$dbh);
my $item=getiteminformation($env, $itemnum);
! my $sth2=$dbh->prepare("Insert into accountlines
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber)
values
! (?,?,now(),?,?,'L',?,?)");
!
$sth2->execute($data->{'borrowernumber'},$accountno,$item->{'replacementprice'},
! "Lost Item $item->{'title'} $item->{'barcode'}",
! $item->{'replacementprice'},$itemnum);
$sth2->finish;
}
***************
*** 124,129 ****
$flag=1;
}
! my $sth=$dbh->prepare("Select * from issues where (itemnumber='$itemnum')
and (returndate is null)");
! $sth->execute;
my $data=$sth->fetchrow_hashref;
if ($data->{'borrowernumber'} ne '') {
--- 121,126 ----
$flag=1;
}
! my $sth=$dbh->prepare("Select * from issues where (itemnumber=?) and
(returndate is null)");
! $sth->execute($itemnum);
my $data=$sth->fetchrow_hashref;
if ($data->{'borrowernumber'} ne '') {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha bookcount.pl,1.7,1.8 deletemem.pl,1.9,1.10 overdue.pl,1.8,1.9 pay.pl,1.8,1.9 stats2.pl,1.4,1.5 thesaurus_popup.pl,1.13,1.14 updateitem.pl,1.8,1.9,
Paul POULAIN <=