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
29 use C4::Interface::CGI::Output;
32 use C4::Koha; # XXX subfield_is_koha_internal_p
35 my $type=$query->param('type');
36 my $op = $query->param('op');
37 #$type="opac" unless $type;
39 my $dbh = C4::Context->dbh;
41 my ($loggedinuser, $cookie, $sessionID) = checkauth($query, ($type eq 'opac') ? (1) : (0));
43 my $startfrom=$query->param('startfrom');
44 ($startfrom) || ($startfrom=0);
45 my ($template, $loggedinuser, $cookie);
47 if ($op eq "do_search") {
48 my @marclist = $query->param('marclist');
49 my @and_or = $query->param('and_or');
50 my @excluding = $query->param('excluding');
51 my @operator = $query->param('operator');
52 my @value = $query->param('value');
53 # builds tag and subfield arrays
56 foreach my $marc (@marclist) {
57 push @tags, substr($marc,0,3);
58 push @subfields, substr($marc,3,1);
60 my @results = catalogsearch($dbh, \@tags, \@subfields, \@and_or,
61 \@excluding, \@operator, \@value,
63 ($template, $loggedinuser, $cookie)
64 = get_template_and_user({template_name => "search.marc/result.tmpl",
68 flagsrequired => {catalogue => 1},
71 $template->param(loggedinuser => $loggedinuser,
75 ($template, $loggedinuser, $cookie)
76 = get_template_and_user({template_name => "search.marc/search.tmpl",
80 flagsrequired => {catalogue => 1},
83 $template->param(loggedinuser => $loggedinuser);
85 if ($type eq "opac") {
86 $tagslib = &MARCgettagslib($dbh,1);
88 $tagslib = &MARCgettagslib($dbh,1);
92 for (my $tabloop = 0; $tabloop<=9;$tabloop++) {
93 push @marcarray,"--------------------------------------- $tabloop ---------------------------------------";
94 foreach my $tag (sort(keys (%{$tagslib}))) {
95 foreach my $subfield (sort(keys %{$tagslib->{$tag}})) {
96 next if subfield_is_koha_internal_p($subfield);
97 next unless ($tagslib->{$tag}->{$subfield}->{tab} eq $tabloop);
98 push @marcarray, "$tag$subfield - $tagslib->{$tag}->{$subfield}->{lib}";
102 my $marclist = CGI::scrolling_list(-name=>"marclist",
103 -values=> \@marcarray,
106 -onChange => "sql_update()",
108 $template->param("marclist" => $marclist);
111 output_html_with_http_headers $query, $cookie, $template->output;