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
24 use C4::Output; # contains picktemplate
34 my $language='french';
38 open (KC, "/etc/koha.conf");
43 if (/(.*)\s*=\s*(.*)/) {
46 # Clean up white space at beginning and end
51 $configfile{$variable}=$value;
56 my $biblionumber=$query->param('bib');
57 my $tag=$query->param('tag');
58 if (! defined $tag) { $tag='2XX';}
59 #print STDERR "BIB : $biblionumber // TAG : $tag\n";
60 if (! defined $biblionumber) {
61 my $includes=$configfile{'includes'};
62 ($includes) || ($includes="/usr/local/www/hdl/htdocs/includes");
63 my $templatebase="MARCdetailbiblioselect.tmpl";
64 my $theme=picktemplate($includes, $templatebase);
65 my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]);
66 print "Content-Type: text/html\n\n", $template->output;
69 &showmarcrecord($biblionumber,$tag);
73 my ($biblionumber,$tag) = @_;
75 my $sth=$dbh->prepare("select liblibrarian from marc_subfield_structure where tagfield=? and tagsubfield=?");
76 my $record =MARCgetbiblio($dbh,$biblionumber);
78 my $templatebase="catalogue/MARCdetail.tmpl";
79 my $includes=$configfile{'includes'};
80 ($includes) || ($includes="/usr/local/www/hdl/htdocs/includes");
81 my $theme=picktemplate($includes, $templatebase);
82 my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]);
85 my @fields = $record->field($tag);
86 foreach my $field (@fields) {
87 my @subf=$field->subfields;
88 for my $i (0..$#subf) {
89 $sth->execute($field->tag(), $subf[$i][0]);
90 my $row=$sth->fetchrow_hashref;
92 $row_data{marc_lib}=$row->{'liblibrarian'};
93 $row_data{marc_value}=$subf[$i][1];
94 $row_data{marc_tag}=$field->tag().$subf[$i][0];
95 push(@loop_data, \%row_data);
96 # print $field->tag(), " ", $field->indicator(1),$field->indicator(2), "subf: ", $subf[$i][0]," =",$subf[$i][1]," <-- \n";
100 # fill template with arrays
101 $template->param(biblionumber => $biblionumber);
102 $template->param(marc =>\@loop_data);
103 print "Content-Type: text/html\n\n", $template->output;