[Koha-cvs] CVS: koha/C4/Circulation Borrower.pm,1.5,1.6

MJ Ray slef at users.sourceforge.net
Wed Dec 3 13:09:47 CET 2003


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

Modified Files:
	Borrower.pm 
Log Message:
DBI fixes for bug 662

Index: Borrower.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation/Borrower.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** Borrower.pm	13 Oct 2002 08:31:06 -0000	1.5
--- Borrower.pm	3 Dec 2003 12:09:44 -0000	1.6
***************
*** 80,88 ****
          $env->{'IssuesAllowed'} = 1;
        } elsif ($book ne "") {
!         my $query = "select * from issues,items where (barcode = '$book')
            and (items.itemnumber = issues.itemnumber)
!           and (issues.returndate is null)";
!         my $iss_sth=$dbh->prepare($query);
!         $iss_sth->execute;
          if (my $issdata  = $iss_sth->fetchrow_hashref) {
             $bornum=$issdata->{'borrowernumber'};
--- 80,87 ----
          $env->{'IssuesAllowed'} = 1;
        } elsif ($book ne "") {
!         my $iss_sth=$dbh->prepare("select * from issues,items where (barcode = ?)
            and (items.itemnumber = issues.itemnumber)
!           and (issues.returndate is null)");
!         $iss_sth->execute($book);
          if (my $issdata  = $iss_sth->fetchrow_hashref) {
             $bornum=$issdata->{'borrowernumber'};
***************
*** 120,125 ****
    my $ucborcode = uc $borcode;
    my $lcborcode = lc $borcode;
!   my $sth=$dbh->prepare("Select * from borrowers where cardnumber=\"$ucborcode\"");
!   $sth->execute;
    if ($borrower=$sth->fetchrow_hashref) {
      $bornum=$borrower->{'borrowernumber'};
--- 119,124 ----
    my $ucborcode = uc $borcode;
    my $lcborcode = lc $borcode;
!   my $sth=$dbh->prepare("Select * from borrowers where cardnumber=?");
!   $sth->execute($ucborcode);
    if ($borrower=$sth->fetchrow_hashref) {
      $bornum=$borrower->{'borrowernumber'};
***************
*** 130,137 ****
      # where surname ~* '$borcode' order by surname";
  
!     my $borquery = "Select * from borrowers
!       where lower(surname) like \"$lcborcode%\" order by surname,firstname";
!     my $sthb =$dbh->prepare($borquery);
!     $sthb->execute;
      my $cntbor = 0;
      my @borrows;
--- 129,134 ----
      # where surname ~* '$borcode' order by surname";
  
!     my $sthb =$dbh->prepare("Select * from borrowers where lower(surname) like ? order by surname,firstname");
!     $sthb->execute("$lcborcode%");
      my $cntbor = 0;
      my @borrows;
***************
*** 153,159 ****
      } elsif ($cntbor > 0) {
        my ($cardnum) = C4::InterfaceCDK::selborrower($env,$dbh,\@borrows,\@bornums);
!       my $query = "select * from borrowers where cardnumber = '$cardnum'";
!       $sth = $dbh->prepare($query);
!       $sth->execute;
        $borrower =$sth->fetchrow_hashref;
        $sth->finish;
--- 150,155 ----
      } elsif ($cntbor > 0) {
        my ($cardnum) = C4::InterfaceCDK::selborrower($env,$dbh,\@borrows,\@bornums);
!       $sth = $dbh->prepare("select * from borrowers where cardnumber = ?");
!       $sth->execute($cardnum);
        $borrower =$sth->fetchrow_hashref;
        $sth->finish;
***************
*** 252,260 ****
        my $notes = trapsnotes($env,$bornum,$borrower,$amount);
        if ($notes ne $borrower->{'borrowernotes'}) {
!         my $query = "update borrowers set borrowernotes = '$notes'
! 	   where borrowernumber = $bornum";
!         my $sth = $dbh->prepare($query);
! 	$sth->execute();
! 	$sth->finish();
          $borrower->{'borrowernotes'} = $notes;
        }
--- 248,254 ----
        my $notes = trapsnotes($env,$bornum,$borrower,$amount);
        if ($notes ne $borrower->{'borrowernotes'}) {
!         my $sth = $dbh->prepare("update borrowers set borrowernotes = ? where borrowernumber = ?");
! 		$sth->execute($notes,$bornum);
! 		$sth->finish();
          $borrower->{'borrowernotes'} = $notes;
        }
***************
*** 327,335 ****
    my @items;
    my $x=0;
!   my $query="Select * from reserves where
!   borrowernumber='$borrower->{'borrowernumber'}' and found='W' and
!   cancellationdate is null order by timestamp";
!   my $sth=$dbh->prepare($query);
!   $sth->execute;
    while (my $data=$sth->fetchrow_hashref){
      my $itemdata = itemnodata($env,$dbh,$data->{'itemnumber'});
--- 321,328 ----
    my @items;
    my $x=0;
!   my $sth=$dbh->prepare("Select * from reserves where
!   borrowernumber=? and found='W' and
!   cancellationdate is null order by timestamp");
!   $sth->execute($borrower->{'borrowernumber'});
    while (my $data=$sth->fetchrow_hashref){
      my $itemdata = itemnodata($env,$dbh,$data->{'itemnumber'});
***************
*** 376,383 ****
    my ($bornum)=@_;
    my $dbh = C4::Context->dbh;
!   my $query="select cardnumber,borrowernumber from borrowers where
!   guarantor='$bornum'";
!   my $sth=$dbh->prepare($query);
!   $sth->execute;
    my @dat;
    my $i=0;
--- 369,375 ----
    my ($bornum)=@_;
    my $dbh = C4::Context->dbh;
!   my $sth=$dbh->prepare("select cardnumber,borrowernumber from borrowers where
!   guarantor=?");
!   $sth->execute($bornum);
    my @dat;
    my $i=0;





More information about the Koha-cvs mailing list