3 # Copyright 2000-2002 Katipo Communications
5 # This file is part of Koha.
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
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.
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
33 my $dbh=C4::Context->dbh;
35 my $biblionumber=$query->param('biblionumber');
36 my $bibid = &MARCfind_MARCbibid_from_oldbiblionumber($dbh,$biblionumber);
38 my $tagslib = &MARCgettagslib($dbh,1);
40 my $record =MARCgetbiblio($dbh,$bibid);
42 my $template = gettemplate("catalogue/MARCdetail.tmpl",0);
46 for ($tag=0 ; $tag<=9 ; $tag++) {
47 # marc array (tags and subfields)
48 # loop each field having tag = $tag."XX"
49 my @fields = $record->field($tag."XX");
51 foreach my $field (@fields) {
52 my @subf=$field->subfields;
53 my $previous_tag = '';
55 # loop through each subfield
56 for my $i (0..$#subf) {
57 # if we not exactly the same tag (XX can varry !), loop for "tag tittle".
58 if ($previous_tag ne $field->tag()) {
60 $tag_data{tag}=$field->tag().' '. $tagslib->{$field->tag()}->{lib};
61 $tag_data{subfield} = \@subfields_data;
62 push (@loop_data, \%tag_data);
63 $previous_tag = $field->tag();
65 $previous_tag = $field->tag();
67 $subfield_data{marc_lib}=$tagslib->{$field->tag()}->{$subf[$i][0]}->{lib};
68 $subfield_data{marc_value}=$subf[$i][1];
69 $subfield_data{marc_tag}=$field->tag().$subf[$i][0];
70 push(@subfields_data, \%subfield_data);
73 $template->param($tag."XX" =>\@loop_data);
76 # fill template with arrays
77 $template->param(biblionumber => $biblionumber);
78 #$template->param(marc =>\@loop_data);
79 $template->param(bibid => $bibid);
80 print "Content-Type: text/html\n\n", $template->output;