koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/C4 Reserves2.pm,1.20,1.20.2.1


From: Andrew Arensburger
Subject: [Koha-cvs] CVS: koha/C4 Reserves2.pm,1.20,1.20.2.1
Date: Thu, 03 Oct 2002 19:25:53 -0700

Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv18801

Modified Files:
      Tag: arensb-context
        Reserves2.pm 
Log Message:
Use C4::Connect instead of C4::Database, C4::Connect->dbh instead
C4Connect.


Index: Reserves2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Reserves2.pm,v
retrieving revision 1.20
retrieving revision 1.20.2.1
diff -C2 -r1.20 -r1.20.2.1
*** Reserves2.pm        27 Sep 2002 05:21:44 -0000      1.20
--- Reserves2.pm        4 Oct 2002 02:25:50 -0000       1.20.2.1
***************
*** 22,26 ****
  require Exporter;
  use DBI;
! use C4::Database;
  use C4::Search;
  #use C4::Accounts;
--- 22,26 ----
  require Exporter;
  use DBI;
! use C4::Context;
  use C4::Search;
  #use C4::Accounts;
***************
*** 38,42 ****
  sub FindReserves {
    my ($bib,$bor)address@hidden;
!   my $dbh=C4Connect;
    my $query="SELECT *,reserves.branchcode,biblio.title AS btitle
                        FROM reserves,borrowers,biblio ";
--- 38,42 ----
  sub FindReserves {
    my ($bib,$bor)address@hidden;
!   my $dbh = C4::Context->dbh;
    my $query="SELECT *,reserves.branchcode,biblio.title AS btitle
                        FROM reserves,borrowers,biblio ";
***************
*** 93,97 ****
  #  print $query;
    $sth->finish;
-   $dbh->disconnect;
    return($i,address@hidden);
  }
--- 93,96 ----
***************
*** 100,104 ****
      my ($item, $barcode) = @_;
  #    warn "In CheckReserves: itemnumber = $item";
!     my $dbh=C4Connect;
      my $sth;
      if ($item) {
--- 99,103 ----
      my ($item, $barcode) = @_;
  #    warn "In CheckReserves: itemnumber = $item";
!     my $dbh = C4::Context->dbh;
      my $sth;
      if ($item) {
***************
*** 122,126 ****
      my ($biblio, $bibitem, $notforloan) = $sth->fetchrow_array;
      $sth->finish;
-     $dbh->disconnect;
  # if item is not for loan it cannot be reserved either.....
      return (0, 0) if ($notforloan);
--- 121,124 ----
***************
*** 151,155 ****
  sub CancelReserve {
      my ($biblio, $item, $borr) = @_;
!     my $dbh=C4Connect;
      #warn "In CancelReserve";
      if (($item and $borr) and (not $biblio)) {
--- 149,153 ----
  sub CancelReserve {
      my ($biblio, $item, $borr) = @_;
!     my $dbh = C4::Context->dbh;
      #warn "In CancelReserve";
      if (($item and $borr) and (not $biblio)) {
***************
*** 189,193 ****
--- 187,193 ----
                                       and cancellationdate is NULL 
                                       and (found <> 'F' or found is NULL)";
+               # FIXME - There's already a $query in this scope.
        my $sth = $dbh->prepare($query);
+               # FIXME - There's already a $sth in this scope.
        $sth->execute;
        $sth->finish;
***************
*** 195,199 ****
        fixpriority($priority, $biblio);
      }
-     $dbh->disconnect;
  }
  
--- 195,198 ----
***************
*** 201,205 ****
  sub FillReserve {
      my ($res) = @_;
!     my $dbh=C4Connect;
  # fillinf a reserve record....
      my $biblio = $res->{'biblionumber'}; my $qbiblio = $dbh->quote($biblio);
--- 200,204 ----
  sub FillReserve {
      my ($res) = @_;
!     my $dbh = C4::Context->dbh;
  # fillinf a reserve record....
      my $biblio = $res->{'biblionumber'}; my $qbiblio = $dbh->quote($biblio);
***************
*** 221,225 ****
--- 220,226 ----
                                   AND reservedate      = $resdate
                                   AND borrowernumber   = $borr";
+               # FIXME - There's already a $query in this scope.
      my $sth = $dbh->prepare($query);
+               # FIXME - There's already a $sth in this scope.
      $sth->execute;
      $sth->finish;
***************
*** 228,237 ****
        fixpriority($priority, $biblio);
      }
-     $dbh->disconnect;
  }
  
  sub fixpriority {
      my ($priority, $biblio) =  @_;
!     my $dbh = C4Connect;
      my ($count, $reserves) = FindReserves($biblio);
      foreach my $rec (@$reserves) {
--- 229,237 ----
        fixpriority($priority, $biblio);
      }
  }
  
  sub fixpriority {
      my ($priority, $biblio) =  @_;
!     my $dbh = C4::Context->dbh;
      my ($count, $reserves) = FindReserves($biblio);
      foreach my $rec (@$reserves) {
***************
*** 251,255 ****
        } 
      }
-     $dbh->disconnect;
  }
  
--- 251,254 ----
***************
*** 258,262 ****
  sub ReserveWaiting {
      my ($item, $borr) = @_;
!     my $dbh = C4Connect;
      $item = $dbh->quote($item);
      $borr = $dbh->quote($borr);
--- 257,261 ----
  sub ReserveWaiting {
      my ($item, $borr) = @_;
!     my $dbh = C4::Context->dbh;
      $item = $dbh->quote($item);
      $borr = $dbh->quote($borr);
***************
*** 290,294 ****
      $sth->execute;
      $sth->finish;
-     $dbh->disconnect;
  # now fix up the remaining priorities....
      fixpriority($data->{'priority'}, $biblio);
--- 289,292 ----
***************
*** 299,303 ****
  sub CheckWaiting {
      my ($borr)address@hidden;
!     my $dbh = C4Connect;
      $borr = $dbh->quote($borr);
      my @itemswaiting;
--- 297,301 ----
  sub CheckWaiting {
      my ($borr)address@hidden;
!     my $dbh = C4::Context->dbh;
      $borr = $dbh->quote($borr);
      my @itemswaiting;
***************
*** 308,314 ****
      my $sth = $dbh->prepare($query);
      $sth->execute();
      my $cnt=0;
      if (my $data=$sth->fetchrow_hashref) {
!       @itemswaiting[$cnt] =$data;
        $cnt ++;
      }
--- 306,313 ----
      my $sth = $dbh->prepare($query);
      $sth->execute();
+     # FIXME - Use 'push'
      my $cnt=0;
      if (my $data=$sth->fetchrow_hashref) {
!       $itemswaiting[$cnt] =$data;
        $cnt ++;
      }
***************
*** 319,323 ****
  sub Findgroupreserve {
    my ($bibitem,$biblio)address@hidden;
!   my $dbh=C4Connect;
    $bibitem=$dbh->quote($bibitem);
    my $query = "SELECT reserves.biblionumber               AS biblionumber, 
--- 318,322 ----
  sub Findgroupreserve {
    my ($bibitem,$biblio)address@hidden;
!   my $dbh = C4::Context->dbh;
    $bibitem=$dbh->quote($bibitem);
    my $query = "SELECT reserves.biblionumber               AS biblionumber, 
***************
*** 350,354 ****
    }
    $sth->finish;
-   $dbh->disconnect;
    return($i,@results);
  }
--- 349,352 ----
***************
*** 358,362 ****
  
($env,$branch,$borrnum,$biblionumber,$constraint,$bibitems,$priority,$notes,$title)=
 @_;   
    my $fee=CalcReserveFee($env,$borrnum,$biblionumber,$constraint,$bibitems);
!   my $dbh = &C4Connect;       
    my $const = lc substr($constraint,0,1);       
    my @datearr = localtime(time);                                
--- 356,360 ----
  
($env,$branch,$borrnum,$biblionumber,$constraint,$bibitems,$priority,$notes,$title)=
 @_;   
    my $fee=CalcReserveFee($env,$borrnum,$biblionumber,$constraint,$bibitems);
!   my $dbh = C4::Context->dbh;
    my $const = lc substr($constraint,0,1);       
    my @datearr = localtime(time);                                
***************
*** 401,405 ****
    } 
  #  print $query;
-   $dbh->disconnect();         
    return();   
  }             
--- 399,402 ----
***************
*** 408,412 ****
    my ($env,$borrnum,$biblionumber,$constraint,$bibitems) = @_;        
    #check for issues;    
!   my $dbh = &C4Connect;           
    my $const = lc substr($constraint,0,1); 
    my $query = "SELECT * FROM borrowers,categories 
--- 405,409 ----
    my ($env,$borrnum,$biblionumber,$constraint,$bibitems) = @_;        
    #check for issues;    
!   my $dbh = C4::Context->dbh;           
    my $const = lc substr($constraint,0,1); 
    my $query = "SELECT * FROM borrowers,categories 
***************
*** 487,491 ****
    }                   
  #  print "fee $fee";
-   $dbh->disconnect();   
    return $fee;                                      
  }                   
--- 484,487 ----
***************
*** 509,513 ****
    #subroutine to update a reserve 
    my ($rank,$biblio,$borrower,$del,$branch)address@hidden;
!   my $dbh=C4Connect;
    my $query="Update reserves ";
    if ($del == 0){
--- 505,509 ----
    #subroutine to update a reserve 
    my ($rank,$biblio,$borrower,$del,$branch)address@hidden;
!   my $dbh = C4::Context->dbh;
    my $query="Update reserves ";
    if ($del == 0){
***************
*** 541,546 ****
    my $sth=$dbh->prepare($query);
    $sth->execute;
!   $sth->finish;  
!   $dbh->disconnect;
  }
  sub UpdateReserve {
--- 537,541 ----
    my $sth=$dbh->prepare($query);
    $sth->execute;
!   $sth->finish;
  }
  sub UpdateReserve {
***************
*** 548,552 ****
      my ($rank,$biblio,$borrower,$branch)address@hidden;
      return if $rank eq "W";
!     my $dbh=C4Connect;
      if ($rank eq "del") {
        my $query = "UPDATE reserves SET cancellationdate=now() 
--- 543,547 ----
      my ($rank,$biblio,$borrower,$branch)address@hidden;
      return if $rank eq "W";
!     my $dbh = C4::Context->dbh;
      if ($rank eq "del") {
        my $query = "UPDATE reserves SET cancellationdate=now() 
***************
*** 568,577 ****
        $sth->finish;  
      }
-     $dbh->disconnect;
  }
  
  sub getreservetitle {
   my ($biblio,$bor,$date,$timestamp)address@hidden;
!  my $dbh=C4Connect;
   my $query="Select * from reserveconstraints,biblioitems where
   reserveconstraints.biblioitemnumber=biblioitems.biblioitemnumber
--- 563,571 ----
        $sth->finish;  
      }
  }
  
  sub getreservetitle {
   my ($biblio,$bor,$date,$timestamp)address@hidden;
!  my $dbh = C4::Context->dbh;
   my $query="Select * from reserveconstraints,biblioitems where
   reserveconstraints.biblioitemnumber=biblioitems.biblioitemnumber
***************
*** 583,587 ****
   my $data=$sth->fetchrow_hashref;
   $sth->finish;
-  $dbh->disconnect;
  # print $query;
   return($data);
--- 577,580 ----




reply via email to

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