koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/C4/Circulation Renewals2.pm,1.10,1.11


From: MJ Ray
Subject: [Koha-cvs] CVS: koha/C4/Circulation Renewals2.pm,1.10,1.11
Date: Mon, 08 Dec 2003 06:28:18 -0800

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

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

Index: Renewals2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation/Renewals2.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** Renewals2.pm        5 May 2003 09:41:03 -0000       1.10
--- Renewals2.pm        8 Dec 2003 14:28:16 -0000       1.11
***************
*** 99,108 ****
    # FIXME - I think this function could be redone to use only one SQL
    # call.
!   my $q1 = "select * from issues
!     where (borrowernumber = '$bornum')
!     and (itemnumber = '$itemno')
!     and returndate is null";
!   my $sth1 = $dbh->prepare($q1);
!   $sth1->execute;
    if (my $data1 = $sth1->fetchrow_hashref) {
      # Found a matching item
--- 99,107 ----
    # FIXME - I think this function could be redone to use only one SQL
    # call.
!   my $sth1 = $dbh->prepare("select * from issues
!     where (borrowernumber = ?)
!     and (itemnumber = ?')
!     and returndate is null");
!   $sth1->execute($bornum,$itemno);
    if (my $data1 = $sth1->fetchrow_hashref) {
      # Found a matching item
***************
*** 112,121 ****
      # the biblioitem, which gives us the itemtype, which tells us
      # whether it may be renewed.
!     my $q2 = "select renewalsallowed from items,biblioitems,itemtypes
!        where (items.itemnumber = '$itemno')
         and (items.biblioitemnumber = biblioitems.biblioitemnumber)
!        and (biblioitems.itemtype = itemtypes.itemtype)";
!     my $sth2 = $dbh->prepare($q2);
!     $sth2->execute;
      if (my $data2=$sth2->fetchrow_hashref) {
        $renews = $data2->{'renewalsallowed'};
--- 111,119 ----
      # the biblioitem, which gives us the itemtype, which tells us
      # whether it may be renewed.
!     my $sth2 = $dbh->prepare("select renewalsallowed from 
items,biblioitems,itemtypes
!        where (items.itemnumber = ?)
         and (items.biblioitemnumber = biblioitems.biblioitemnumber)
!        and (biblioitems.itemtype = itemtypes.itemtype)");
!     $sth2->execute($itemno);
      if (my $data2=$sth2->fetchrow_hashref) {
        $renews = $data2->{'renewalsallowed'};
***************
*** 175,184 ****
                                # be an error
      # Find this item's item type, via its biblioitem.
!     my $query= "Select * from biblioitems,items,itemtypes
!        where (items.itemnumber = '$itemno')
         and (biblioitems.biblioitemnumber = items.biblioitemnumber)
!        and (biblioitems.itemtype = itemtypes.itemtype)";
!     my $sth=$dbh->prepare($query);
!     $sth->execute;
      if (my $data=$sth->fetchrow_hashref) {
        $loanlength = $data->{'loanlength'}
--- 173,181 ----
                                # be an error
      # Find this item's item type, via its biblioitem.
!     my $sth=$dbh->prepare("Select * from biblioitems,items,itemtypes
!        where (items.itemnumber = ?)
         and (biblioitems.biblioitemnumber = items.biblioitemnumber)
!        and (biblioitems.itemtype = itemtypes.itemtype)");
!     $sth->execute($itemno);
      if (my $data=$sth->fetchrow_hashref) {
        $loanlength = $data->{'loanlength'}
***************
*** 194,201 ****
  
    # Find the issues record for this book
!   my $issquery = "select * from issues where borrowernumber='$bornum' and
!     itemnumber='$itemno' and returndate is null";
!   my $sth=$dbh->prepare($issquery);
!   $sth->execute;
    my $issuedata=$sth->fetchrow_hashref;
        # FIXME - Error-checking
--- 191,197 ----
  
    # Find the issues record for this book
!   my $sth=$dbh->prepare("select * from issues where borrowernumber=? and
!     itemnumber=? and returndate is null");
!   $sth->execute($bornum,$itemno);
    my $issuedata=$sth->fetchrow_hashref;
        # FIXME - Error-checking
***************
*** 205,215 ****
    # of how many times it has been renewed.
    my $renews = $issuedata->{'renewals'} +1;
!   my $updquery = "update issues
!     set date_due = '$datedue', renewals = '$renews'
!     where borrowernumber='$bornum' and
!     itemnumber='$itemno' and returndate is null";
!               # FIXME - Use $dbh->do()
!   $sth=$dbh->prepare($updquery);
!   $sth->execute;
    $sth->finish;
  
--- 201,209 ----
    # of how many times it has been renewed.
    my $renews = $issuedata->{'renewals'} +1;
!   $sth=$dbh->prepare("update issues
!     set date_due = ?, renewals = ?
!     where borrowernumber=? and
!     itemnumber=? and returndate is null");
!   $sth->execute($datedue,$renews,$bornum,$itemno);
    $sth->finish;
  
***************
*** 274,284 ****
  
      # Figure out the applicable rental discount
!     my $q2 = "select rentaldiscount from
      borrowers,categoryitem
!     where (borrowers.borrowernumber = '$bornum')
      and (borrowers.categorycode = categoryitem.categorycode)
!     and (categoryitem.itemtype = '$item_type')";
!     my $sth2=$dbh->prepare($q2);
!     $sth2->execute;
      if (my$data2=$sth2->fetchrow_hashref) {
        my $discount = $data2->{'rentaldiscount'};
--- 268,277 ----
  
      # Figure out the applicable rental discount
!     my $sth2=$dbh->prepare("select rentaldiscount from
      borrowers,categoryitem
!     where (borrowers.borrowernumber = ?)
      and (borrowers.categorycode = categoryitem.categorycode)
!     and (categoryitem.itemtype = ?)");
!     $sth2->execute($bornum,$item_type);
      if (my$data2=$sth2->fetchrow_hashref) {
        my $discount = $data2->{'rentaldiscount'};




reply via email to

[Prev in Thread] Current Thread [Next in Thread]