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