4 # Copyright 2000-2002 Katipo Communications
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA 02111-1307 USA
27 use MARC::File::USMARC;
29 our $dbh = C4::Context->dbh;
30 $dbh->do("delete from marc_subfield_table");
31 $dbh->do("delete from marc_blob_subfield");
32 &MARCaddSubfield(1,'001',1,'##','a',1,'1 - This is a value');
33 &MARCaddSubfield(1,'001',1,'##','b',1,'2 - This is another value');
34 # FIXME - Just use "a"x1024 to generate very long strings.
35 &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");
36 &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");
38 &MARCchangeSubfield(1,"1new - this is a changed value");
40 &MARCchangeSubfield(2,"2new - go from short to long subfield... uuuuuuuuuuuuuuuuuuuuuuuu yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy tttttttttttttttttttttttttttttttt rrrrrrrrrrrrrrrrrrrrrr eeeeeeeeeeeeeeeeeeeeeeeee zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq ssssssssssssssssssssssssss ddddddddddddddddddddddddddddddd fffffffffffffffffffffffff ggggggggggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhh jjjjjjjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkk");
42 &MARCchangeSubfield(3,"3new - go from long to short subfield...");
44 &MARCchangeSubfield(4,"4new - stay with blob subfield...uuuuuuuuuuuuuuuuuuuuuuuu yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy tttttttttttttttttttttttttttttttt rrrrrrrrrrrrrrrrrrrrrr eeeeeeeeeeeeeeeeeeeeeeeee zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq ssssssssssssssssssssssssss ddddddddddddddddddddddddddddddd fffffffffffffffffffffffff ggggggggggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhh jjjjjjjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkk");
45 my $x= &MARCfindSubfield(1,'001','a','',1);
46 my $record= MARC::Record->new();
47 $record->leader("58973");
48 $record->add_fields('100',1,'',a => 'Logan, Robert K.', d => '1000-');
49 $record->add_fields('110',1,'',d => '1939-');
51 my $record2=MARCkoha2marc("123456","author","title","unititle","notes","abstract",
52 "serial","seriestitle","copyrightdate","biblioitemnumber","volume","number",
53 "classification","itemtype","isbn","issn",
54 "dewey","subclass","publicationyear","publishercode",
55 "volumedate","illus","pages","notes",
56 "size","place","lccn");
57 &MARCaddMarcBiblio($record2);
59 #my @fields = $record->fields();
60 #foreach my $field (@fields) {
61 # my @subf=$field->subfields;
62 # for my $i (0..$#subf) {
63 # print $field->tag(), " ", $field->indicator(1),$field->indicator(2), "subf: ", $subf[$i][0]," =",$subf[$i][1]," <-- \n";
66 #print $record->as_formatted();
67 #my $file = MARC::File::USMARC->in("/home/paul/courriers/koha/exemples_unimarc/env179.1.txt");
68 ## get a marc record from the MARC::File object
69 ## $record will be a MARC::Record object
70 #while (my $record = $file->next()) {
71 ## print the title contained in the record
72 # print $record->as_formatted(),"\n";
74 ## we're done so close the file