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
22 require Exporter; # FIXME - Is this really necessary?
24 use C4::Output; # contains gettemplate
33 my $biblionumber=$query->param('bib');
34 my $tag=$query->param('tag');
35 if (! defined $tag) { $tag='2XX';}
36 #print STDERR "BIB : $biblionumber // TAG : $tag\n";
37 if (! defined $biblionumber) {
38 my $template = gettemplate("MARCdetailbiblioselect.tmpl");
39 print "Content-Type: text/html\n\n", $template->output;
42 &showmarcrecord($biblionumber,$tag);
46 my ($biblionumber,$tag) = @_;
47 my $dbh = C4::Context->dbh;
48 my $sth=$dbh->prepare("select liblibrarian from marc_subfield_structure where tagfield=? and tagsubfield=?");
49 my $record =MARCgetbiblio($dbh,$biblionumber);
51 my $template = gettemplate("MARCdetail.tmpl");
54 my @fields = $record->field($tag);
55 foreach my $field (@fields) {
56 my @subf=$field->subfields;
57 for my $i (0..$#subf) {
58 $sth->execute($field->tag(), $subf[$i][0]);
59 my $row=$sth->fetchrow_hashref;
61 $row_data{marc_lib}=$row->{'liblibrarian'};
62 $row_data{marc_value}=$subf[$i][1];
63 $row_data{marc_tag}=$field->tag().$subf[$i][0];
64 push(@loop_data, \%row_data);
65 # print $field->tag(), " ", $field->indicator(1),$field->indicator(2), "subf: ", $subf[$i][0]," =",$subf[$i][1]," <-- \n";
69 # fill template with arrays
70 $template->param(biblionumber => $biblionumber);
71 $template->param(marc =>\@loop_data);
72 print "Content-Type: text/html\n\n", $template->output;