Koha/thesaurus_popup.pl
tipaul e11872aeb1 road to 1.3.2 :
* many bugfixes
* adding value_builder : you can map a subfield in the marc_subfield_structure to a sub stored in "value_builder" directory. In this directory you can create screen used to build values with any method. In this commit is a 1st draft of the builder for 100$a unimarc french subfield, which is composed of 35 digits, with 12 differents values (only the 4th first are provided for instance)
2002-11-12 15:58:43 +00:00

87 lines
2.4 KiB
Perl
Executable file

#!/usr/bin/perl
# written 10/5/2002 by Paul
# build result field using bibliothesaurus table
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use CGI;
use C4::Context;
use HTML::Template;
use C4::Search;
#use C4::Circulation::Circ2;
use C4::Output;
#use C4::Biblio;
# get all the data ....
my %env;
my $input = new CGI;
my $result = $input->param('result');
my $search_string= $input->param('search_string');
my $op = $input->param('op');
my $id = $input->param('id');
my $category = $input->param('category');
my $index= $input->param('index');
my $dbh = C4::Context->dbh;
# make the page ...
#print $input->header;
if ($op eq "select") {
my $sti = $dbh->prepare("select stdlib from bibliothesaurus where id=?");
$sti->execute($id);
my ($freelib_text) = $sti->fetchrow_array;
if (length($result)>0) {
$result .= "|$freelib_text";
} else {
$result = $freelib_text;
}
}
my $template = gettemplate("thesaurus_popup.tmpl",0);
# /search thesaurus terms starting by search_string
my @freelib;
my %stdlib;
my $select_list;
if ($search_string) {
my $sti=$dbh->prepare("select id,freelib from bibliothesaurus where freelib like '".$search_string."%' and category ='$category'");
$sti->execute;
while (my $line=$sti->fetchrow_hashref) {
$stdlib{$line->{'id'}} = "$line->{'freelib'}";
push(@freelib,$line->{'id'});
}
$select_list= CGI::scrolling_list( -name=>'id',
-values=> \@freelib,
-default=> "",
-size=>1,
-multiple=>0,
-labels=> \%stdlib
);
}
$template->param(select_list => $select_list,
search_string => $search_string,
result => $result,
category => $category,
index => $index
);
print "Content-Type: text/html\n\n", $template->output;