koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha bookcount.pl,1.2,1.3


From: Andrew Arensburger
Subject: [Koha-cvs] CVS: koha bookcount.pl,1.2,1.3
Date: Sat, 05 Oct 2002 02:44:39 -0700

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

Modified Files:
        bookcount.pl 
Log Message:
Merged with arensb-context branch: use C4::Context->dbh instead of
&C4Connect, and generally prefer C4::Context over C4::Database.


Index: bookcount.pl
===================================================================
RCS file: /cvsroot/koha/koha/bookcount.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** bookcount.pl        14 Aug 2002 18:12:50 -0000      1.2
--- bookcount.pl        5 Oct 2002 09:44:37 -0000       1.3
***************
*** 24,27 ****
--- 24,28 ----
  use strict;
  use CGI;
+ use C4::Context;
  use C4::Search;
  use C4::Circulation::Circ2;
***************
*** 112,120 ****
  # database includes
  use DBI;
- use C4::Database;
  
  sub itemdatanum {
      my ($itemnumber)address@hidden;
!     my $dbh=C4Connect;
      my $itm = $dbh->quote("$itemnumber");
      my $query = "select * from items where itemnumber=$itm";
--- 113,120 ----
  # database includes
  use DBI;
  
  sub itemdatanum {
      my ($itemnumber)address@hidden;
!     my $dbh = C4::Context->dbh;
      my $itm = $dbh->quote("$itemnumber");
      my $query = "select * from items where itemnumber=$itm";
***************
*** 123,127 ****
      my $data=$sth->fetchrow_hashref;
      $sth->finish;
-     $dbh->disconnect;
      return($data);
  }
--- 123,126 ----
***************
*** 129,133 ****
  sub lastmove {
        my ($itemnumber)address@hidden;
!       my $dbh=C4Connect;
        my $var1 = $dbh->quote($itemnumber);
        my $sth =$dbh->prepare("select max(branchtransfers.datearrived) from 
branchtransfers where branchtransfers.itemnumber=$var1");
--- 128,132 ----
  sub lastmove {
        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");
***************
*** 141,145 ****
        return(0, "Item has no branch transfers record") if not $data;
        $sth->finish;
-       $dbh->disconnect;
        return($data,"");
   }
--- 140,143 ----
***************
*** 147,151 ****
  sub issuessince {
        my ($itemnumber, $date)address@hidden;
!       my $dbh=C4Connect;
        my $itm = $dbh->quote($itemnumber);
        my $dat = $dbh->quote($date);
--- 145,149 ----
  sub issuessince {
        my ($itemnumber, $date)address@hidden;
!       my $dbh = C4::Context->dbh;
        my $itm = $dbh->quote($itemnumber);
        my $dat = $dbh->quote($date);
***************
*** 154,158 ****
        my $count=$sth->fetchrow_hashref;
        $sth->finish;
-       $dbh->disconnect;
        return($count->{'count(*)'});
  }
--- 152,155 ----
***************
*** 160,164 ****
  sub issuesat {
        my ($itemnumber, $brcd)address@hidden;
!       my $dbh=C4Connect;
        my $itm = $dbh->quote($itemnumber);
        my $brc = $dbh->quote($brcd);
--- 157,161 ----
  sub issuesat {
        my ($itemnumber, $brcd)address@hidden;
!       my $dbh = C4::Context->dbh;
        my $itm = $dbh->quote($itemnumber);
        my $brc = $dbh->quote($brcd);
***************
*** 168,172 ****
        my ($count)=$sth->fetchrow_array;
        $sth->finish;
-       $dbh->disconnect;
        return($count);
  }
--- 165,168 ----
***************
*** 174,178 ****
  sub lastseenat {
        my ($itemnumber, $brcd)address@hidden;
!       my $dbh=C4Connect;
        my $itm = $dbh->quote($itemnumber);
        my $brc = $dbh->quote($brcd);
--- 170,174 ----
  sub lastseenat {
        my ($itemnumber, $brcd)address@hidden;
!       my $dbh = C4::Context->dbh;
        my $itm = $dbh->quote($itemnumber);
        my $brc = $dbh->quote($brcd);
***************
*** 183,191 ****
        $sth->finish;
        $query = "Select max(datearrived) from branchtransfers where 
itemnumber=$itm and tobranch = $brc";
        my $sth=$dbh->prepare($query);
        $sth->execute;
        my ($date2)=$sth->fetchrow_array;
        $sth->finish;
-       $dbh->disconnect;
        $date2 =~ s/-//g;
        $date2 =~ s/://g;
--- 179,187 ----
        $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;




reply via email to

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