[Koha-cvs] CVS: koha/C4 Biblio.pm,1.70,1.71

Paul POULAIN tipaul at users.sourceforge.net
Mon Nov 24 17:28:52 CET 2003


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

Modified Files:
	Biblio.pm 
Log Message:
biblio & item deletion now works fine in MARC editor.
Stores deleted biblio/item in the marc field of the deletedbiblio/deleteditem table.

Index: Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.70
retrieving revision 1.71
diff -C2 -r1.70 -r1.71
*** Biblio.pm	24 Nov 2003 13:29:55 -0000	1.70
--- Biblio.pm	24 Nov 2003 16:28:49 -0000	1.71
***************
*** 55,59 ****
  		&NEWnewbiblio &NEWnewitem
  		&NEWmodbiblio &NEWmoditem
! 		&NEWdelbiblio
  
  	     &MARCaddbiblio &MARCadditem
--- 55,59 ----
  		&NEWnewbiblio &NEWnewitem
  		&NEWmodbiblio &NEWmoditem
! 		&NEWdelbiblio &NEWdelitem
  
  	     &MARCaddbiblio &MARCadditem
***************
*** 539,542 ****
--- 539,559 ----
  	}
  }
+ 
+ sub MARCdelitem {
+ # delete the item passed in parameter in MARC tables.
+ 	my ($dbh,$bibid,$itemnumber)=@_;
+ 	#    my $record = MARC::Record->new();
+ 	# search MARC tagorder
+ 	my $record = MARCgetitem($dbh,$bibid,$itemnumber);
+ 	my $copy2deleted=$dbh->prepare("update deleteditems set marc=? where itemnumber=?");
+ 	$copy2deleted->execute($record->as_usmarc(),$itemnumber);
+ 
+ 	my $sth2 = $dbh->prepare("select tagorder from marc_subfield_table,marc_subfield_structure where marc_subfield_table.tag=marc_subfield_structure.tagfield and marc_subfield_table.subfieldcode=marc_subfield_structure.tagsubfield and bibid=? and kohafield='items.itemnumber' and subfieldvalue=?");
+ 	$sth2->execute($bibid,$itemnumber);
+ 	my ($tagorder) = $sth2->fetchrow_array();
+ 	my $sth=$dbh->prepare("delete from marc_subfield_table where bibid=? and tagorder=?");
+ 	$sth->execute($bibid,$tagorder);
+ }
+ 
  sub MARCmoditem {
  	my ($dbh,$record,$bibid,$itemnumber,$delete)=@_;
***************
*** 1091,1094 ****
--- 1108,1118 ----
  }
  
+ sub NEWdelitem {
+ 	my ($dbh,$bibid,$itemnumber)=@_;
+ 	my $biblio = &MARCfind_oldbiblionumber_from_MARCbibid($dbh,$bibid);
+ 	&OLDdelitem($dbh,$itemnumber);
+ 	&MARCdelitem($dbh,$bibid,$itemnumber);
+ }
+ 
  #
  #
***************
*** 1485,1495 ****
    my $sth=$dbh->prepare($query);
    $sth->execute;
!   my @data=$sth->fetchrow_array;
    $sth->finish;
!   $query="Insert into deleteditems values (";
!   foreach my $temp (@data){
!     $query .= "'$temp',";
    }
!   $query=~ s/\,$/\)/;
  #  print $query;
    $sth=$dbh->prepare($query);
--- 1509,1519 ----
    my $sth=$dbh->prepare($query);
    $sth->execute;
!   my $data=$sth->fetchrow_hashref;
    $sth->finish;
!   $query="Insert into deleteditems set ";
!   foreach my $temp (keys %$data){
!     $query .= "$temp = ".$dbh->quote($data->{$temp}).",";
    }
!   $query=~ s/\,$//;
  #  print $query;
    $sth=$dbh->prepare($query);
***************
*** 2186,2189 ****
--- 2210,2217 ----
  # $Id$
  # $Log$
+ # Revision 1.71  2003/11/24 16:28:49  tipaul
+ # biblio & item deletion now works fine in MARC editor.
+ # Stores deleted biblio/item in the marc field of the deletedbiblio/deleteditem table.
+ #
  # Revision 1.70  2003/11/24 13:29:55  tipaul
  # moving $id from beginning to end of file (70 commits... huge comments...)





More information about the Koha-cvs mailing list