[Koha-cvs] CVS: koha/C4 Biblio.pm,1.76,1.77

Paul POULAIN tipaul at users.sourceforge.net
Wed Dec 3 18:47:18 CET 2003


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

Modified Files:
	Biblio.pm 
Log Message:
bugfixes for biblio deletion

Index: Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.76
retrieving revision 1.77
diff -C2 -r1.76 -r1.77
*** Biblio.pm	3 Dec 2003 01:43:41 -0000	1.76
--- Biblio.pm	3 Dec 2003 17:47:14 -0000	1.77
***************
*** 1499,1521 ****
  
  sub OLDdelitem{
!   my ($dbh,$itemnum)=@_;
! #  my $dbh=C4Connect;
!   my $sth=$dbh->prepare("select * from items where itemnumber=?");
!   $sth->execute($itemnum);
!   my $data=$sth->fetchrow_hashref;
!   $sth->finish;
!   my $query="Insert into deleteditems set ";
!   my @bind = ();
!   foreach my $temp (keys %$data){
!     $query .= "$temp = ?,"
!     push(@bind,$data->{$temp});
!   }
  #  print $query;
!   $sth=$dbh->prepare($query);
!   $sth->execute(@bind);
!   $sth->finish;
!   $sth=$dbh->prepare("Delete from items where itemnumber=?");
!   $sth->execute($itemnum);
!   $sth->finish;
  #  $dbh->disconnect;
  }
--- 1499,1522 ----
  
  sub OLDdelitem{
! 	my ($dbh,$itemnum)=@_;
! 	#  my $dbh=C4Connect;
! 	my $sth=$dbh->prepare("select * from items where itemnumber=?");
! 	$sth->execute($itemnum);
! 	my $data=$sth->fetchrow_hashref;
! 	$sth->finish;
! 	my $query="Insert into deleteditems set ";
! 	my @bind = ();
! 	foreach my $temp (keys %$data){
! 		$query .= "$temp = ?,";
! 		push(@bind,$data->{$temp});
! 	}
! 	$query =~ s/\,$//;
  #  print $query;
! 	$sth=$dbh->prepare($query);
! 	$sth->execute(@bind);
! 	$sth->finish;
! 	$sth=$dbh->prepare("Delete from items where itemnumber=?");
! 	$sth->execute($itemnum);
! 	$sth->finish;
  #  $dbh->disconnect;
  }
***************
*** 1545,1590 ****
      $sth->finish;
  # Now delete all the items attached to the biblioitem
!     $sth   = $dbh->prepare("Select * from items where biblioitemnumber = ?");
!     $sth->execute($biblioitemnumber);
!     my @results;
!     while (@results = $sth->fetchrow_array) {
! 	my $query = "Insert into deleteditems values (";
! 	foreach my $value (@results) {
! 	    $query .= "?,";
! 	} # foreach
! 	$query =~ s/\,$/\)/;
! 	my $sth2= $dbh->prepare($query);
! 	$sth2->execute(@results);
! 	$sth2->finish()
!     } # while
!     $sth->finish;
!     $sth = $dbh->prepare("Delete from items where biblioitemnumber = ?");
!     $sth->execute($biblioitemnumber);
!     $sth->finish();
  #    $dbh->disconnect;
  } # sub deletebiblioitem
  
  sub OLDdelbiblio{
!   my ($dbh,$biblio)=@_;
!   my $sth=$dbh->prepare("select * from biblio where biblionumber=?");
!   $sth->execute($biblio);
!   if (my @data=$sth->fetchrow_array){
!     $sth->finish;
! # FIXME => replace insert values by insert (field) values ($value)
!     $query="Insert into deletedbiblio values (";
!     foreach my $temp (@data){
!       $temp=~ s/\'/\\\'/g;
!       $query .= "?,";
!     }
!     #replacing the last , by ",?)"
!     $query=~ s/\,$/\,\?\)/;
!     $sth=$dbh->prepare($query);
!     $sth->execute(@data);
!     $sth->finish;
!     $sth=$dbh->prepare("Delete from biblio where biblionumber=?");
!     $sth->execute($biblio);
!     $sth->finish;
!   }
!   $sth->finish;
  }
  
--- 1546,1594 ----
      $sth->finish;
  # Now delete all the items attached to the biblioitem
! 	$sth   = $dbh->prepare("Select * from items where biblioitemnumber = ?");
! 	$sth->execute($biblioitemnumber);
! 	my @results;
! 	while (my $data = $sth->fetchrow_hashref) {
! 		my $query="Insert into deleteditems set ";
! 		my @bind = ();
! 		foreach my $temp (keys %$data){
! 			$query .= "$temp = ?,";
! 			push(@bind,$data->{$temp});
! 		}
! 		$query =~ s/\,$//;
! 		warn "Q 1560 : $query";
! 		my $sth2=$dbh->prepare($query);
! 		$sth2->execute(@bind);
! 	} # while
! 	$sth->finish;
! 	$sth = $dbh->prepare("Delete from items where biblioitemnumber = ?");
! 	$sth->execute($biblioitemnumber);
! 	$sth->finish();
  #    $dbh->disconnect;
  } # sub deletebiblioitem
  
  sub OLDdelbiblio{
! 	my ($dbh,$biblio)=@_;
! 	my $sth=$dbh->prepare("select * from biblio where biblionumber=?");
! 	$sth->execute($biblio);
! 	if (my $data=$sth->fetchrow_hashref){
! 		$sth->finish;
! 		my $query="Insert into deletedbiblio set ";
! 		my @bind =();
! 		foreach my $temp (keys %$data){
! 			$query .= "$temp = ?,";
! 			push(@bind,$data->{$temp});
! 		}
! 		#replacing the last , by ",?)"
! 		$query=~ s/\,$//;
! 		warn "Q olddelbiblio : $query";
! 		$sth=$dbh->prepare($query);
! 		$sth->execute(@bind);
! 		$sth->finish;
! 		$sth=$dbh->prepare("Delete from biblio where biblionumber=?");
! 		$sth->execute($biblio);
! 		$sth->finish;
! 	}
! 	$sth->finish;
  }
  
***************
*** 2189,2192 ****
--- 2193,2199 ----
  # $Id$
  # $Log$
+ # Revision 1.77  2003/12/03 17:47:14  tipaul
+ # bugfixes for biblio deletion
+ #
  # Revision 1.76  2003/12/03 01:43:41  slef
  # conflict markers?
***************
*** 2522,2526 ****
  # Note we have decided with steve that a old-biblio <=> a MARC-Biblio.
  #
- <<<<<<< Biblio.pm
  
  sub itemcount{
--- 2529,2532 ----





More information about the Koha-cvs mailing list