koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/admin branches.pl,1.22,1.22.2.1


From: MJ Ray
Subject: [Koha-cvs] CVS: koha/admin branches.pl,1.22,1.22.2.1
Date: Tue, 23 Dec 2003 06:14:18 -0800

Update of /cvsroot/koha/koha/admin
In directory sc8-pr-cvs1:/tmp/cvs-serv9912/admin

Modified Files:
      Tag: rel_2_0
        branches.pl 
Log Message:
DBI call fix for bug 662

Index: branches.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/branches.pl,v
retrieving revision 1.22
retrieving revision 1.22.2.1
diff -C2 -r1.22 -r1.22.2.1
*** branches.pl 13 Jun 2003 11:54:39 -0000      1.22
--- branches.pl 23 Dec 2003 14:14:15 -0000      1.22.2.1
***************
*** 354,371 ****
      my ($branchcode) = @_;
      my $dbh = C4::Context->dbh;
!     my ($query, @query_args);
      if ($branchcode) {
!       $query = "Select * from branches where branchcode = ?";
!       @query_args = ($branchcode);
      } else {
!       $query = "Select * from branches";
      }
-     $query.=" order by branchcode";
-     my $sth = $dbh->prepare($query);
-     $sth->execute(@query_args);
      my @results;
      while (my $data = $sth->fetchrow_hashref) {
!       $query = "select categorycode from branchrelations where branchcode = 
?";
!       my $nsth = $dbh->prepare($query);
        $nsth->execute($data->{'branchcode'});;
        my @cats = ();
--- 354,368 ----
      my ($branchcode) = @_;
      my $dbh = C4::Context->dbh;
!     my $sth;
      if ($branchcode) {
!               $sth = $dbh->prepare("Select * from branches where branchcode = 
? order by branchcode");
!               $sth->execute($branchcode);
      } else {
!               $sth = $dbh->prepare("Select * from branches order by 
branchcode");
!               $sth->execute();
      }
      my @results;
      while (my $data = $sth->fetchrow_hashref) {
!       my $nsth = $dbh->prepare("select categorycode from branchrelations 
where branchcode = ?");
        $nsth->execute($data->{'branchcode'});;
        my @cats = ();
***************
*** 386,400 ****
        my ($catcode) = @_;
        my $dbh = C4::Context->dbh;
!       my ($query, @query_args);
        #    print DEBUG "getcategoryinfo: entry: catcode=".cvs($catcode)."\n";
        if ($catcode) {
!               $query = "select * from branchcategories where categorycode = 
?";
!               @query_args = ($catcode);
        } else {
!               $query = "Select * from branchcategories";
        }
-       #    print DEBUG "getcategoryinfo: query=".cvs($query)."\n";
-       my $sth = $dbh->prepare($query);
-       $sth->execute(@query_args);
        my @results;
        while (my $data = $sth->fetchrow_hashref) {
--- 383,395 ----
        my ($catcode) = @_;
        my $dbh = C4::Context->dbh;
!       my $sth;
        #    print DEBUG "getcategoryinfo: entry: catcode=".cvs($catcode)."\n";
        if ($catcode) {
!               $sth = $dbh->prepare("select * from branchcategories where 
categorycode = ?");
!               $sth->execute($catcode);
        } else {
!               $sth = $dbh->prepare("Select * from branchcategories");
!               $sth->execute();
        }
        my @results;
        while (my $data = $sth->fetchrow_hashref) {
***************
*** 411,416 ****
        my ($data) = @_;
        my $dbh = C4::Context->dbh;
!       my $query = "replace branches 
(branchcode,branchname,branchaddress1,branchaddress2,branchaddress3,branchphone,branchfax,branchemail)
 values (?,?,?,?,?,?,?,?)";
!       my $sth=$dbh->prepare($query);
        $sth->execute(uc($data->{'branchcode'}), $data->{'branchname'},
                $data->{'branchaddress1'}, $data->{'branchaddress2'},
--- 406,410 ----
        my ($data) = @_;
        my $dbh = C4::Context->dbh;
!       my $sth=$dbh->prepare("replace branches 
(branchcode,branchname,branchaddress1,branchaddress2,branchaddress3,branchphone,branchfax,branchemail)
 values (?,?,?,?,?,?,?,?)");
        $sth->execute(uc($data->{'branchcode'}), $data->{'branchname'},
                $data->{'branchaddress1'}, $data->{'branchaddress2'},
***************
*** 444,458 ****
                }
        }
-       # FIXME - There's already a $dbh in this scope.
-       my $dbh = C4::Context->dbh;
        foreach my $cat (@addcats) {
!               my $query = "insert into branchrelations (branchcode, 
categorycode) values(?, ?)";
!               my $sth = $dbh->prepare($query);
                $sth->execute($branchcode, $cat);
                $sth->finish;
        }
        foreach my $cat (@removecats) {
!               my $query = "delete from branchrelations where branchcode=? and 
categorycode=?";
!               my $sth = $dbh->prepare($query);
                $sth->execute($branchcode, $cat);
                $sth->finish;
--- 438,448 ----
                }
        }
        foreach my $cat (@addcats) {
!               my $sth = $dbh->prepare("insert into branchrelations 
(branchcode, categorycode) values(?, ?)");
                $sth->execute($branchcode, $cat);
                $sth->finish;
        }
        foreach my $cat (@removecats) {
!               my $sth = $dbh->prepare("delete from branchrelations where 
branchcode=? and categorycode=?");
                $sth->execute($branchcode, $cat);
                $sth->finish;
***************
*** 463,469 ****
  # delete branch...
      my ($branchcode) = @_;
-     my $query = "delete from branches where branchcode = ?";
      my $dbh = C4::Context->dbh;
!     my $sth=$dbh->prepare($query);
      $sth->execute($branchcode);
      $sth->finish;
--- 453,458 ----
  # delete branch...
      my ($branchcode) = @_;
      my $dbh = C4::Context->dbh;
!     my $sth=$dbh->prepare("delete from branches where branchcode = ?");
      $sth->execute($branchcode);
      $sth->finish;
***************
*** 474,479 ****
        my ($data) = @_;
        my $dbh = C4::Context->dbh;
!       my $query = "replace branchcategories 
(categorycode,categoryname,codedescription) values (?,?,?)";
!       my $sth=$dbh->prepare($query);
        $sth->execute(uc($data->{'categorycode'}), 
$data->{'categoryname'},$data->{'codedescription'});
  
--- 463,467 ----
        my ($data) = @_;
        my $dbh = C4::Context->dbh;
!       my $sth=$dbh->prepare("replace branchcategories 
(categorycode,categoryname,codedescription) values (?,?,?)");
        $sth->execute(uc($data->{'categorycode'}), 
$data->{'categoryname'},$data->{'codedescription'});
  
***************
*** 483,489 ****
  # delete branch...
      my ($categorycode) = @_;
-     my $query = "delete from branchcategories where categorycode = ?";
      my $dbh = C4::Context->dbh;
!     my $sth=$dbh->prepare($query);
      $sth->execute($categorycode);
      $sth->finish;
--- 471,476 ----
  # delete branch...
      my ($categorycode) = @_;
      my $dbh = C4::Context->dbh;
!     my $sth=$dbh->prepare("delete from branchcategories where categorycode = 
?");
      $sth->execute($categorycode);
      $sth->finish;




reply via email to

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