[Koha-cvs] CVS: koha/C4 Catalogue.pm,1.17,1.18 test.pl,1.2,1.3

Paul POULAIN tipaul at users.sourceforge.net
Mon Jun 10 22:49:56 CEST 2002


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

Modified Files:
	Catalogue.pm test.pl 
Log Message:
MARC stuff : beginning to use MARC::Record package.


Index: Catalogue.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Catalogue.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** Catalogue.pm	6 Jun 2002 16:23:37 -0000	1.17
--- Catalogue.pm	10 Jun 2002 20:49:54 -0000	1.18
***************
*** 13,16 ****
--- 13,17 ----
  require Exporter;
  use C4::Database;
+ use MARC::Record;
  
  use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
***************
*** 21,27 ****
  @ISA = qw(Exporter);
  @EXPORT = qw(&newBiblio &newBiblioItem &newItem &updateBiblio &updateBiblioItem
! 	     &updateItem &changeSubfield &addSubfield &findSubfield 
! 	     &addMarcBiblio &nextsubfieldid
! 
  	     &getorders &bookseller &breakdown &basket &newbasket &bookfunds
  	     &ordersearch &newbiblio &newbiblioitem &newsubject &newsubtitle &neworder
--- 22,26 ----
  @ISA = qw(Exporter);
  @EXPORT = qw(&newBiblio &newBiblioItem &newItem &updateBiblio &updateBiblioItem
! 	     &updateItem 
  	     &getorders &bookseller &breakdown &basket &newbasket &bookfunds
  	     &ordersearch &newbiblio &newbiblioitem &newsubject &newsubtitle &neworder
***************
*** 34,38 ****
  	     &getbiblioitembybiblionumber
  	     &getbiblioitem &getitemsbybiblioitem &isbnsearch
! 	     &websitesearch &addwebsite &updatewebsite &deletewebsite);
  %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
  
--- 33,41 ----
  	     &getbiblioitembybiblionumber
  	     &getbiblioitem &getitemsbybiblioitem &isbnsearch
! 	     &websitesearch &addwebsite &updatewebsite &deletewebsite
! 
! 	     &MARCchangeSubfield &MARCaddSubfield &MARCfindSubfield 
! 	     &MARCaddMarcBiblio &MARCnextsubfieldid &MARCkoha2marc
! );
  %EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
  
***************
*** 119,127 ****
  
  
! sub changeSubfield {
  # Subroutine changes a subfield value given a subfieldid.
      my ( $subfieldid, $subfieldvalue )=@_;
  
!     my $dbh=&C4Connect;
      $dbh->do("lock tables marc_blob_subfield WRITE,marc_subfield_table WRITE");
      my $sth1=$dbh->prepare("select valuebloblink from marc_subfield_table where subfieldid=?");
--- 122,130 ----
  
  
! sub MARCchangeSubfield {
  # Subroutine changes a subfield value given a subfieldid.
      my ( $subfieldid, $subfieldvalue )=@_;
  
! #    my $dbh=&C4Connect;
      $dbh->do("lock tables marc_blob_subfield WRITE,marc_subfield_table WRITE");
      my $sth1=$dbh->prepare("select valuebloblink from marc_subfield_table where subfieldid=?");
***************
*** 156,165 ****
  }
  
! sub findSubfield {
      my ($bibid,$tag,$subfieldcode,$subfieldvalue,$subfieldorder) = @_;
      my $resultcounter=0;
      my $subfieldid;
      my $lastsubfieldid;
!     my $dbh=&C4Connect;
      my $query="select subfieldid from marc_subfield_table where bibid=? and tag=? and subfieldcode=?";
      if ($subfieldvalue) {
--- 159,169 ----
  }
  
! sub MARCfindSubfield {
! # returns a subfields number given a bibid/tad/subfield values
      my ($bibid,$tag,$subfieldcode,$subfieldvalue,$subfieldorder) = @_;
      my $resultcounter=0;
      my $subfieldid;
      my $lastsubfieldid;
! #    my $dbh=&C4Connect;
      my $query="select subfieldid from marc_subfield_table where bibid=? and tag=? and subfieldcode=?";
      if ($subfieldvalue) {
***************
*** 186,193 ****
  }
  
! sub addSubfield {
! # Add a new subfield to a tag.
      my $bibid=shift;
      my $tagid=shift;
      my $tagorder=shift;
      my $subfieldcode=shift;
--- 190,198 ----
  }
  
! sub MARCaddSubfield {
! # Add a new subfield to a tag into the DB.
      my $bibid=shift;
      my $tagid=shift;
+     my $indicator=shift;
      my $tagorder=shift;
      my $subfieldcode=shift;
***************
*** 195,201 ****
      my $subfieldvalue=shift;
  
!     my $dbh=&C4Connect;
      unless ($subfieldorder) {
! 	my $sth=$dbh->prepare("select max(subfieldorder) from marc_subfield_table where tagid=$tagid");
  	$sth->execute;
  	if ($sth->rows) {
--- 200,206 ----
      my $subfieldvalue=shift;
  
! #    my $dbh=&C4Connect;
      unless ($subfieldorder) {
! 	my $sth=$dbh->prepare("select max(subfieldorder) from marc_subfield_table where tag=$tagid");
  	$sth->execute;
  	if ($sth->rows) {
***************
*** 213,217 ****
  	$sth->execute;
  	my ($res)=$sth->fetchrow;
! 	my $sth=$dbh->prepare("insert into marc_subfield_table (bibid,tagid,tagorder,subfieldcode,subfieldorder,valuebloblink) values (?,?,?,?,?,?)");
  	$sth->execute($bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$res);
  	$dbh->do("unlock tables");
--- 218,222 ----
  	$sth->execute;
  	my ($res)=$sth->fetchrow;
! 	my $sth=$dbh->prepare("insert into marc_subfield_table (bibid,tag,tagorder,subfieldcode,subfieldorder,valuebloblink) values (?,?,?,?,?,?)");
  	$sth->execute($bibid,$tagid,$tagorder,$subfieldcode,$subfieldorder,$res);
  	$dbh->do("unlock tables");
***************
*** 222,264 ****
  }
  
! sub addMarcBiblio {
! # pass the marcperlstructure to this function, and it will create the records in the marc tables
!     my ($marcstructure) = @_;
!     my $dbh=C4Connect;
!     my $tag;
!     my $tagorder;
!     my $subfield;
!     my $subfieldorder;
      # adding main table, and retrieving bibid
      $dbh->do("lock tables marc_biblio WRITE");
!     my $sth=$dbh->prepare("insert into marc_biblio (datecreated,origincode) values (now(),?)");
!     $sth->execute($marcstructure->{origincode});
      $sth=$dbh->prepare("select max(bibid) from marc_biblio");
      $sth->execute;
!     ($marcstructure->{bibid})=$sth->fetchrow;
!     print "BIBID :::".$marcstructure->{bibid}."\n";
      $sth->finish;
      $dbh->do("unlock tables");
      # now, add subfields...
!     foreach $tag (keys %{$marcstructure->{tags}}) {
! 	foreach $tagorder (keys %{$marcstructure->{tags}->{$tag}}) { 
! 	    foreach $subfield (keys %{$marcstructure->{tags}->{$tag}->{$tagorder}->{subfields}}) {
! 		foreach $subfieldorder (keys %{$marcstructure->{tags}->{$tag}->{$tagorder}->{subfields}->{$subfield}}) {
! 		    &addSubfield($marcstructure->{bibid},
! 				 $tag,
! 				 $tagorder,
! 				 $subfield,
! 				 $subfieldorder,
! 				 $marcstructure->{tags}->{$tag}->{$tagorder}->{subfields}->{$subfield}->{$subfieldorder}
  				 );
- #		    print "$tag / $tagorder / $subfield / $subfieldorder / ".$marcstructure->{tags}->{$tag}->{$tagorder}->{subfields}->{$subfield}->{$subfieldorder}."\n";
- 		}
- 	    }
  	}
      }
  }
  
! sub buildPerlmarcstructure {
! # this function builds perlmarcstructure from the old koha-DB fields
      my ($biblionumber,$author,$title,$unititle,$notes,$abstract,
  	$serial,$seriestitle,$copyrightdate,$biblioitemnumber,$volume,$number,
--- 227,267 ----
  }
  
! sub MARCaddMarcBiblio {
! # pass the MARC::Record to this function, and it will create the records in the marc tables
!     my ($record) = @_;
!     my @fields=$record->fields();
! #    my $dbh=C4Connect;
!     my $bibid;
      # adding main table, and retrieving bibid
      $dbh->do("lock tables marc_biblio WRITE");
!     my $sth=$dbh->prepare("insert into marc_biblio (datecreated) values (now())");
!     $sth->execute;
      $sth=$dbh->prepare("select max(bibid) from marc_biblio");
      $sth->execute;
!     ($bibid)=$sth->fetchrow;
! #    print "BIBID :::".$marcstructure->{bibid}."\n";
      $sth->finish;
      $dbh->do("unlock tables");
+     my $fieldcount=0;
      # now, add subfields...
!     foreach my $field (@fields) {
! 	my @subfields=$field->subfields();
! 	$fieldcount++;
! 	foreach my $subfieldcount (0..$#subfields) {
! 	    print $field->tag().":".$field->indicator(1).$field->indicator(2).":".$subfields[$subfieldcount][0].":".$subfields[$subfieldcount][1]."\n";
! 		    &MARCaddSubfield($bibid,
! 				 $field->tag(),
! 				 $field->indicator(1).$field->indicator(2),
! 				 $fieldcount,
! 				 $subfields[$subfieldcount][0],
! 				 $subfieldcount,
! 				 $subfields[$subfieldcount][1]
  				 );
  	}
      }
  }
  
! sub MARCkoha2marc {
! # this function builds MARC::Record from the old koha-DB fields
      my ($biblionumber,$author,$title,$unititle,$notes,$abstract,
  	$serial,$seriestitle,$copyrightdate,$biblioitemnumber,$volume,$number,
***************
*** 268,297 ****
  	$size,$place,$lccn) = @_;
  
!     my $tagfield;
!     my $tagsubfield;
!     my $perlmarcstructure={};
!     my $i=0;
!     my $dbh=&C4Connect;
      my $sth=$dbh->prepare("select tagfield,tagsubfield from marc_subfield_structure where kohafield=?");
!     $sth->execute("biblionumber");
!     if (($tagfield,$tagsubfield)=$sth->fetchrow) {
! 	$i=nextsubfieldid($perlmarcstructure->{tags}->{$tagfield}->{1}->{subfields}->{$tagsubfield});
! 	$perlmarcstructure->{tags}->{$i}->{tag}=$tagfield;
! 	$perlmarcstructure->{tags}->{$i}->{tagorder}=1;
! 	$perlmarcstructure->{tags}->{$i}->{indicator}='##';
!     }
  }
  
! sub nextsubfieldid {
!     my $subfieldhash=shift;
!     my $maxsubfieldnumber=0;
!     my $subfield;
!     my $number;
!     foreach $subfield (keys %$subfieldhash) {
! 	foreach $number (keys %{$subfieldhash->{$subfield}}) {
! 	    ($number>$maxsubfieldnumber) && ($maxsubfieldnumber=$number);
  	}
      }
!     return $maxsubfieldnumber+1;
  }
  
--- 271,326 ----
  	$size,$place,$lccn) = @_;
  
!     my $record = MARC::Record->new();
! #    my $dbh=&C4Connect;
      my $sth=$dbh->prepare("select tagfield,tagsubfield from marc_subfield_structure where kohafield=?");
!     &MARCkoha2marcOnefield($sth,$record,"biblio.author",$author);
!     &MARCkoha2marcOnefield($sth,$record,"biblio.title",$title);
!     &MARCkoha2marcOnefield($sth,$record,"biblio.unititle",$unititle);
!     &MARCkoha2marcOnefield($sth,$record,"biblio.notes",$notes);
!     &MARCkoha2marcOnefield($sth,$record,"biblio.abstract",$abstract);
!     &MARCkoha2marcOnefield($sth,$record,"biblio.serial",$serial);
!     &MARCkoha2marcOnefield($sth,$record,"biblio.seriestitle",$seriestitle);
!     &MARCkoha2marcOnefield($sth,$record,"biblio.copyrightdate",$copyrightdate);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.biblionumber",$biblionumber);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.biblioitemnumber",$biblioitemnumber);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.volume",$volume);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.number",$number);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.classification",$classification);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.itemtype",$itemtype);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.isbn",$isbn);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.issn",$issn);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.dewey",$dewey);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.subclass",$subclass);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.publicationyear",$publicationyear);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.publishercode",$publishercode);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.volumedate",$volumedate);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.illus",$illus);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.pages",$pages);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.notes",$notes);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.size",$size);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.place",$place);
!     &MARCkoha2marcOnefield($sth,$record,"biblioitems.lccn",$lccn);
!     print "RECORD : ".$record->as_formatted()."\n";
!     return $record;
  }
  
! sub MARCkoha2marcOnefield {
!     my ($sth,$record,$kohafieldname,$value)=@_;
!     my $tagfield;
!     my $tagsubfield;
!     $sth->execute($kohafieldname);
!     if (($tagfield,$tagsubfield)=$sth->fetchrow) {
! 	if ($record->field($tagfield)) {
! 	    my $tag =$record->field($tagfield);
! 	    if ($tag) {
! 		$tag->add_subfields($tagsubfield,$value);
! 		$record->delete_field($tag);
! 		$record->add_fields($tag);
! 	    }
! 	} else {
! 	    $record->add_fields($tagfield," "," ",$tagsubfield => $value);
  	}
      }
!     return $record;
  }
  
***************
*** 514,566 ****
  	print STDERR "MARC: $type $Record_ID $tag $mark $subfield_ID $original $new\n";
      }
- }
- 
- sub addTag {
- # Subroutine to add a tag to an existing MARC Record.  If a new linkage id is
- # desired, set $env->{'linkage'} to 1.  If an existing linkage id should be
- # set, set $env->{'linkid'} to the link number.
-     my ($env, $Record_ID, $tag, $Indicator1, $Indicator2, $subfields) = @_;
-     my $dbh=&C4Connect;  
-     ($Indicator1) || ($Indicator1=' ');
-     ($Indicator2) || ($Indicator2=' ');
-     my $firstdigit=substr($tag,0,1);
-     my $Subfield_ID;
-     foreach (sort keys %$subfields) {
- 	my $Subfield_Mark=$subfields->{$_}->{'Subfield_Mark'};
- 	my $Subfield_Value=$subfields->{$_}->{'Subfield_Value'};
- 	my $q_Subfield_Value=$dbh->quote($Subfield_Value);
- 	if ($Subfield_ID) {
- 	    my $sth=$dbh->prepare("insert into $firstdigit\XX_Subfield_Table (Subfield_ID, Subfield_Mark, Subfield_Value) values ($Subfield_ID, '$Subfield_Mark', $q_Subfield_Value)");
- 	    $sth->execute;
- 	} else {
- 	    my $sth=$dbh->prepare("insert into $firstdigit\XX_Subfield_Table (Subfield_Mark, Subfield_Value) values ('$Subfield_Mark', $q_Subfield_Value)");
- 	    $sth->execute;
- 	    my $Subfield_Key=$dbh->{'mysql_insertid'};
- 	    $Subfield_ID=$Subfield_Key;
- 	    $sth=$dbh->prepare("update $firstdigit\XX_Subfield_Table set Subfield_ID=$Subfield_ID where Subfield_Key=$Subfield_Key");
- 	    $sth->execute;
- 	}
-     }
-     if (my $linkid=$env->{'linkid'}) {
- 	$env->{'linkage'}=0;
- 	my $sth=$dbh->prepare("insert into $firstdigit\XX_Subfield_Table (Subfield_ID, Subfield_Mark, Subfield_Value) values ($Subfield_ID, '8', '$linkid')");
- 	$sth->execute;
-     }
-     my $sth=$dbh->prepare("insert into $firstdigit\XX_Tag_Table (Indicator1, Indicator2, Tag, Subfield_ID) values ('$Indicator1', '$Indicator2', '$tag', $Subfield_ID)");
-     $sth->execute;
-     my $Tag_Key=$dbh->{'mysql_insertid'};
-     my $Tag_ID=$Tag_Key;
-     $sth=$dbh->prepare("update $firstdigit\XX_Tag_Table set Tag_ID=$Tag_ID where Tag_Key=$Tag_Key");
-     $sth->execute;
-     $sth=$dbh->prepare("insert into Bib_Table (Record_ID, Tag_$firstdigit\XX_ID) values ($Record_ID, $Tag_ID)");
-     $sth->execute;
-     if ($env->{'linkage'}) {
- 	my $sth=$dbh->prepare("insert into $firstdigit\XX_Subfield_Table (Subfield_ID, Subfield_Mark, Subfield_Value) values ($Subfield_ID, '8', '$Tag_ID')");
- 	$sth->execute;
- 	
-     }
-     $sth->finish;
-     $dbh->disconnect;
-     return ($env, $Tag_ID);
  }
  
--- 543,546 ----

Index: test.pl
===================================================================
RCS file: /cvsroot/koha/koha/C4/test.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** test.pl	6 Jun 2002 16:23:36 -0000	1.2
--- test.pl	10 Jun 2002 20:49:54 -0000	1.3
***************
*** 1,3 ****
! #!/usr/bin/perl
  use strict;
  require Exporter;
--- 1,3 ----
! package C4::test;
  use strict;
  require Exporter;
***************
*** 5,39 ****
  use C4::Catalogue;
  
! my $dbh=&C4Connect;
  $dbh->do("delete from marc_subfield_table");
  $dbh->do("delete from marc_blob_subfield");
! &addSubfield(1,'001','a',1,'1 - This is a value');
! &addSubfield(1,'001','b',1,'2 - This is another value');
! &addSubfield(1,'001','c',1,"3 - This is a value very very long. I try to make it longer than 255 char. I need to add something else. will it be long enough now... I'm not sure. That's why i continue to add a few word to this very important sentence. Now I hope it will be enough... Oh, not it need some more characters. So i add stupid strings : xxxxxxxxxxxxxxx dddddddddddddddddddd eeeeeeeeeeeeeeeeeeeeeee rrrrrrrrrrrrrrrrrrr ffffffffffffffffff");
! &addSubfield(1,'001','d',1,"4 - This is another value very very long. I try to make it longer than 255 char. I need to add something else. will it be long enough now... I'm not sure. That's why i continue to add a few word to this very important sentence. Now I hope it will be enough... Oh, not it need some more characters. So i add stupid strings : xxxxxxxxxxxxxxx dddddddddddddddddddd eeeeeeeeeeeeeeeeeeeeeee rrrrrrrrrrrrrrrrrrr ffffffffffffffffff");
  print "change 1\n";
! &changeSubfield(1,"1new - this is a changed value");
  print "change 2\n";
! &changeSubfield(2,"2new - go from short to long subfield... uuuuuuuuuuuuuuuuuuuuuuuu yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy tttttttttttttttttttttttttttttttt rrrrrrrrrrrrrrrrrrrrrr eeeeeeeeeeeeeeeeeeeeeeeee zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq ssssssssssssssssssssssssss ddddddddddddddddddddddddddddddd fffffffffffffffffffffffff ggggggggggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhh jjjjjjjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkk");
  print "change 3\n";
! &changeSubfield(3,"3new - go from long to short subfield...");
  print "change 4\n";
! &changeSubfield(4,"4new - stay with blob subfield...uuuuuuuuuuuuuuuuuuuuuuuu yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy tttttttttttttttttttttttttttttttt rrrrrrrrrrrrrrrrrrrrrr eeeeeeeeeeeeeeeeeeeeeeeee zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq ssssssssssssssssssssssssss ddddddddddddddddddddddddddddddd fffffffffffffffffffffffff ggggggggggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhh jjjjjjjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkk");
! my $x= &findSubfield(1,'001','a','',1);
! print "subfieldid : $x\n";
! my $record={};
! #$marcstru->{bibid}=58973; # calculated auto_increment in addMarcBiblio
! $record->{bibid}=58973;
! $record->{tags}->{110}->{1}->{indicator}='##';
! $record->{tags}->{110}->{1}->{subfields}->{a}->{1}='first text';
! $record->{tags}->{110}->{1}->{subfields}->{a}->{2}='second text';
! $record->{tags}->{110}->{1}->{subfields}->{b}->{3}='third text';
  
! $record->{tags}->{120}->{1}->{indicator}='##';
! $record->{tags}->{120}->{1}->{subfields}->{a}->{1}='last text ??';
! 
! $record->{tags}->{120}->{2}->{indicator}='01';
! $record->{tags}->{120}->{2}->{subfields}->{n}->{1}='no, another text';
! print "NEXT IS : ".nextsubfieldid($record->{tags}->{110}->{1}->{subfields})."\n";
! 
! &addMarcBiblio($record);
--- 5,43 ----
  use C4::Catalogue;
  
! our $dbh=&C4Connect;
  $dbh->do("delete from marc_subfield_table");
  $dbh->do("delete from marc_blob_subfield");
! &MARCaddSubfield(1,'001',1,'##','a',1,'1 - This is a value');
! &MARCaddSubfield(1,'001',1,'##','b',1,'2 - This is another value');
! &MARCaddSubfield(1,'001',1,'##','c',1,"3 - This is a value very very long. I try to make it longer than 255 char. I need to add something else. will it be long enough now... I'm not sure. That's why i continue to add a few word to this very important sentence. Now I hope it will be enough... Oh, not it need some more characters. So i add stupid strings : xxxxxxxxxxxxxxx dddddddddddddddddddd eeeeeeeeeeeeeeeeeeeeeee rrrrrrrrrrrrrrrrrrr ffffffffffffffffff");
! &MARCaddSubfield(1,'001',1,'##','d',1,"4 - This is another value very very long. I try to make it longer than 255 char. I need to add something else. will it be long enough now... I'm not sure. That's why i continue to add a few word to this very important sentence. Now I hope it will be enough... Oh, not it need some more characters. So i add stupid strings : xxxxxxxxxxxxxxx dddddddddddddddddddd eeeeeeeeeeeeeeeeeeeeeee rrrrrrrrrrrrrrrrrrr ffffffffffffffffff");
  print "change 1\n";
! &MARCchangeSubfield(1,"1new - this is a changed value");
  print "change 2\n";
! &MARCchangeSubfield(2,"2new - go from short to long subfield... uuuuuuuuuuuuuuuuuuuuuuuu yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy tttttttttttttttttttttttttttttttt rrrrrrrrrrrrrrrrrrrrrr eeeeeeeeeeeeeeeeeeeeeeeee zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq ssssssssssssssssssssssssss ddddddddddddddddddddddddddddddd fffffffffffffffffffffffff ggggggggggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhh jjjjjjjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkk");
  print "change 3\n";
! &MARCchangeSubfield(3,"3new - go from long to short subfield...");
  print "change 4\n";
! &MARCchangeSubfield(4,"4new - stay with blob subfield...uuuuuuuuuuuuuuuuuuuuuuuu yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy tttttttttttttttttttttttttttttttt rrrrrrrrrrrrrrrrrrrrrr eeeeeeeeeeeeeeeeeeeeeeeee zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq ssssssssssssssssssssssssss ddddddddddddddddddddddddddddddd fffffffffffffffffffffffff ggggggggggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhh jjjjjjjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkk");
! my $x= &MARCfindSubfield(1,'001','a','',1);
! my $record= MARC::Record->new();
! $record->leader("58973");
! $record->add_fields('100',1,'',a => 'Logan, Robert K.', d => '1000-');
! $record->add_fields('110',1,'',d => '1939-');
  
! my $record2=MARCkoha2marc("123456","author","title","unititle","notes","abstract",
! 	"serial","seriestitle","copyrightdate","biblioitemnumber","volume","number",
! 	"classification","itemtype","isbn","issn",
! 	"dewey","subclass","publicationyear","publishercode",
! 	"volumedate","illus","pages","notes",
! 	"size","place","lccn");
! &MARCaddMarcBiblio($record2);
! # parse all subfields 
! my @fields = $record->fields();
! foreach my $field (@fields) {
!     my @subf=$field->subfields;
!     for my $i (0..$#subf) {
! #    print $field->tag(), " ", $field->indicator(1),$field->indicator(2), "subf: ", $subf[$i][0]," =",$subf[$i][1]," <-- \n";
! }
! }
! #print $record->as_formatted();





More information about the Koha-cvs mailing list