[Koha-patches] [PATCH] bug 3236: remove disused scripts and a function

Galen Charlton galen.charlton at liblime.com
Tue May 19 14:22:42 CEST 2009


Removed opac/opac-dictionary.pl and catalogue/dictionary.pl,
which were not in use and not linked to from any active
template files.  According to Henri, the functionality that
these scripts implemented hasn't been working since 2.2.

Also removed C4::Search::findseealso(), which was used
only by the two scripts.
---
 C4/Search.pm                                       |   27 --
 catalogue/dictionary.pl                            |  261 ------------------
 .../prog/en/modules/catalogue/dictionary.tmpl      |  151 ----------
 .../opac-tmpl/prog/en/modules/opac-dictionary.tmpl |  142 ----------
 opac/opac-dictionary.pl                            |  289 --------------------
 t/lib/KohaTest/Search.pm                           |    2 +-
 6 files changed, 1 insertions(+), 871 deletions(-)
 delete mode 100755 catalogue/dictionary.pl
 delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/dictionary.tmpl
 delete mode 100644 koha-tmpl/opac-tmpl/prog/en/modules/opac-dictionary.tmpl
 delete mode 100755 opac/opac-dictionary.pl

diff --git a/C4/Search.pm b/C4/Search.pm
index 9aaecf2..9229746 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -54,7 +54,6 @@ This module provides searching functions for Koha's bibliographic databases
 
 @ISA    = qw(Exporter);
 @EXPORT = qw(
-  &findseealso
   &FindDuplicate
   &SimpleSearch
   &searchResults
@@ -65,32 +64,6 @@ This module provides searching functions for Koha's bibliographic databases
 
 # make all your functions, whether exported or not;
 
-=head2 findseealso($dbh,$fields);
-
-C<$dbh> is a link to the DB handler.
-
-use C4::Context;
-my $dbh =C4::Context->dbh;
-
-C<$fields> is a reference to the fields array
-
-This function modifies the @$fields array and adds related fields to search on.
-
-FIXME: this function is probably deprecated in Koha 3
-
-=cut
-
-sub findseealso {
-    my ( $dbh, $fields ) = @_;
-    my $tagslib = GetMarcStructure(1);
-    for ( my $i = 0 ; $i <= $#{$fields} ; $i++ ) {
-        my ($tag)      = substr( @$fields[$i], 1, 3 );
-        my ($subfield) = substr( @$fields[$i], 4, 1 );
-        @$fields[$i] .= ',' . $tagslib->{$tag}->{$subfield}->{seealso}
-          if ( $tagslib->{$tag}->{$subfield}->{seealso} );
-    }
-}
-
 =head2 FindDuplicate
 
 ($biblionumber,$biblionumber,$title) = FindDuplicate($record);
diff --git a/catalogue/dictionary.pl b/catalogue/dictionary.pl
deleted file mode 100755
index 6a767f3..0000000
--- a/catalogue/dictionary.pl
+++ /dev/null
@@ -1,261 +0,0 @@
-#!/usr/bin/perl
-
-
-# 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 C4::Output;
-use C4::Auth;
-use CGI;
-use C4::Search;
-use C4::AuthoritiesMarc;
-use C4::Context;
-use C4::Biblio;
-
-
-=head1 NAME
-
-dictionnary.pl : script to search in biblio & authority an existing value
-
-=head1 SYNOPSIS
-
-useful when the user want to search a term before running a query. For example, to see if "computer" is used in the database
-
-The parameter "marclist" tells which field is searched (title, author, subject, but could be anything else)
-
-This script searches in both biblios & authority
-* in biblio, the script search in all marc fields related to what the user is looking for (for example, if the dictionnary is used on "author", the script searches in biblio.author, but also in additional authors & any MARC field related to author (through the "seealso" MARC constraint)
-* in authority, the script search everywhere. Thus, the accepted & rejected forms are found.
-
-The script shows all results & the user can choose what he want, that is copied into search form.
-
-=cut
-
-my $input = new CGI;
-my $field =$input->param('marclist');
-#warn "field :$field";
-my ($tablename, $kohafield)=split /./,$field;
-#my $tablename=$input->param('tablename');
-$tablename="biblio" unless ($tablename);
-#my $kohafield = $input->param('kohafield');
-my @search = $input->param('search');
-# warn " ".$search[0];
-my $index = $input->param('index');
-# warn " index: ".$index;
-my $op=$input->param('op');
-if (($search[0]) and not ($op eq 'do_search')){
-	$op='do_search';
-}
-my $script_name = 'catalogue/dictionary.pl';
-my $query;
-my $type=$input->param('type');
-#warn " ".$type;
-
-my $dbh = C4::Context->dbh;
-my ($template, $loggedinuser, $cookie);
-
-my $startfrom=$input->param('startfrom');
-$startfrom=0 if(!defined $startfrom);
-my $searchdesc;
-my $resultsperpage;
-
-#warn "Starting process";
-
-if ($op eq "do_search") {
-	#
-	# searching in biblio
-	#
-	my $sth=$dbh->prepare("Select distinct tagfield,tagsubfield from marc_subfield_structure where kohafield = ?");
-	$sth->execute("$field");
-	my (@tags, @and_or, @operator, @excluding, at value);
-	
- 	while ((my $tagfield,my $tagsubfield,my $liblibrarian) = $sth->fetchrow) {
- 		push @tags, $dbh->quote("$tagfield$tagsubfield");
- 	}
-
-	$resultsperpage= $input->param('resultsperpage');
-	$resultsperpage = 19 if(!defined $resultsperpage);
-	my $orderby = $input->param('orderby');
-
-	findseealso($dbh,\@tags);
-
-	my @results, my $total;
-	my $strsth="select distinct subfieldvalue, count(marc_subfield_table.bibid) from marc_subfield_table,marc_word where marc_word.word like ? and marc_subfield_table.bibid=marc_word.bibid and marc_subfield_table.tagorder=marc_word.tagorder and marc_word.tagsubfield in ";
-	my $listtags="(";
-	foreach my $tag (@tags){
-		$listtags .= $tag .",";
-	}
-	$listtags =~s/,$/)/;
-	$strsth .= $listtags." and marc_word.tagsubfield=concat(marc_subfield_table.tag,marc_subfield_table.subfieldcode) group by subfieldvalue ";
-# 	warn "search in biblio : ".$strsth;
-	my $value = uc($search[0]);
-	$value=~s/\*/%/g;
-	$value.= "%" if not($value=~m/%/);
-# 	warn " texte : ".$value;
-
-	$sth=$dbh->prepare($strsth);
-	$sth->execute($value);
-	$total=0;
-	my @catresults;
-	my $javalue;
-	while (my ($value,$ctresults)=$sth->fetchrow) {
-		# This $javalue is used for the javascript selectentry function (javalue for javascript value !)
-		$javalue = $value;
-		$javalue =~s/'/\\'/g;
-
-		push @catresults,{value=> $value, 
-						  javalue=> $javalue,
-						  even=>($total-$startfrom*$resultsperpage)%2,
-						  count=>$ctresults
-						  } if (($total>=$startfrom*$resultsperpage) and ($total<($startfrom+1)*$resultsperpage));
-		$total++;
-	}
-	
-
-	$strsth="Select distinct authtypecode from marc_subfield_structure where (";
-	foreach my $listtags (@tags){
-		my @taglist=split /,/,$listtags;
-		foreach my $curtag (@taglist){
-			$curtag =~s/\s+//;
-			$strsth.="(tagfield='".substr($curtag,1,3)."' AND tagsubfield='".substr($curtag,4,1)."') OR";
-		}
-	}
-	
-	$strsth=~s/ OR$/)/;
-	$strsth .= " and authtypecode is not NULL";
-# 	warn $strsth;
-	$sth=$dbh->prepare($strsth);
-	$sth->execute;
-	
-	#
-	# searching in authorities
-	#
-	my @authresults;
-	my $authnbresults;
-	while ((my $authtypecode) = $sth->fetchrow) {
-		my ($curauthresults,$nbresults) = SearchAuthorities([''],[''],[''],['contains'],
-														\@search,$startfrom*$resultsperpage, $resultsperpage,$authtypecode);
-		if (defined(@$curauthresults)) {
-			for (my $i = 0; $i < @$curauthresults ;$i++) {
-				@$curauthresults[$i]->{jamainentry} = @$curauthresults[$i]->{mainentry};
-				@$curauthresults[$i]->{jamainentry} =~ s/'/\\'/g;
-			}
-		}
-		push @authresults, @$curauthresults;
-		$authnbresults+=$nbresults;
-#		warn "auth : $authtypecode nbauthresults : $nbresults";
-	}
-	
-	# 
-	# OK, filling the template with authorities & biblio entries found.
-	#
-	($template, $loggedinuser, $cookie)
-		= get_template_and_user({template_name => "catalogue/dictionary.tmpl",
-				query => $input,
-				type => $type,
-				authnotrequired => 0,
-				flagsrequired => {catalogue => 1},
-				debug => 1,
-				});
-
-	# multi page display gestion
-	my $displaynext=0;
-	my $displayprev=$startfrom;
-	if(($total - (($startfrom+1)*($resultsperpage))) > 0 ) {
-		$displaynext = 1;
-	}
-
-	my @field_data = ();
-
-	for(my $i = 0 ; $i <= $#tags ; $i++) {
-		push @field_data, { term => "marclist", val=>$tags[$i] };
-		push @field_data, { term => "and_or", val=>$and_or[$i] };
-		push @field_data, { term => "excluding", val=>$excluding[$i] };
-		push @field_data, { term => "operator", val=>$operator[$i] };
-		push @field_data, { term => "value", val=>$value[$i] };
-	}
-
-	my @numbers = ();
-
-	if ($total>$resultsperpage) {
-		for (my $i=1; $i<$total/$resultsperpage+1; $i++) {
-			if ($i<16) {
-	    		my $highlight=0;
-	    		($startfrom==($i-1)) && ($highlight=1);
-	    		push @numbers, { number => $i,
-					highlight => $highlight ,
-					searchdata=> \@field_data,
-					startfrom => ($i-1)};
-			}
-    	}
-	}
-
-	my $from = $startfrom*$resultsperpage+1;
-	my $to;
-
- 	if($total < (($startfrom+1)*$resultsperpage))
-	{
-		$to = $total;
-	} else {
-		$to = (($startfrom+1)*$resultsperpage);
-	}
-	$template->param(anindex => $input->param('index'));
-	$template->param(result => \@results,
-					 catresult=> \@catresults,
-						search => $search[0],
-						marclist =>$field,
-						authresult => \@authresults,
-						nbresults => $authnbresults,
-						startfrom=> $startfrom,
-						displaynext=> $displaynext,
-						displayprev=> $displayprev,
-						resultsperpage => $resultsperpage,
-						startfromnext => $startfrom+1,
-						startfromprev => $startfrom-1,
-						searchdata=>\@field_data,
-						total=>$total,
-						from=>$from,
-						to=>$to,
-						numbers=>\@numbers,
-						MARC_ON => C4::Context->preference("marc"),
-						);
-
- } else {
- 	($template, $loggedinuser, $cookie)
- 		= get_template_and_user({template_name => "catalogue/dictionary.tmpl",
- 				query => $input,
- 				type => $type,
-				authnotrequired => 0,
- 				flagsrequired => {catalogue => 1},
- 				debug => 1,
- 				});
-#warn "type : $type";
- 
- }
-$template->param(search => $search[0],
-		marclist =>$field,
-		type=>$type,
-		anindex => $input->param('index'),
-		);
-
-# Print the page
-output_html_with_http_headers $input, $cookie, $template->output;
-
-# Local Variables:
-# tab-width: 4
-# End:
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/dictionary.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/dictionary.tmpl
deleted file mode 100644
index 5e1f66e..0000000
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/dictionary.tmpl
+++ /dev/null
@@ -1,151 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
-<title>Koha &rsaquo; Dictionary Search</title>
-<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-</head>
-<body>
-
-<!-- TMPL_INCLUDE NAME="header.inc" -->
-<div id="doc3" class="yui-t2">
-   
-   <div id="bd">
-	<div id="yui-main">
-	<div class="yui-b"><div class="yui-g">
-
-	<h1>Dictionary Search</h1>
-<form name="f" method="post" action="/cgi-bin/koha/catalogue/dictionary.pl">
-	<input type="hidden" name="op" value="do_search" />
-				<label for="keyword">Search for keyword(s): </label>
-				<input type="hidden" name="marclist" value="<!-- TMPL_VAR Name="marclist" -->" />
-				<input type="text" name="search" value="<!-- TMPL_VAR Name="search" -->" size="35" />
-				<input type="submit" value="Start search" class="submit" />
-				<input type="hidden" name="type" value="<!-- TMPL_VAR Name="type" -->" />
-				<input type="hidden" name="index" value="<!-- TMPL_VAR Name="anindex" ESCAPE="URL" -->" /></form>
-
-<!-- TMPL_IF Name="search" -->
-	<!-- TMPL_IF NAME="authresult" -->
-		
-			<!-- TMPL_IF NAME="displayprev" --> 
-					<a href="dictionary.pl?startfrom=<!-- TMPL_VAR NAME="startfromprev" -->&amp;marclist=<!-- TMPL_VAR NAME="marclist" ESCAPE="URL"-->&amp;search=<!-- TMPL_VAR NAME="search" ESCAPE="URL"-->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&amp;index=<!-- TMPL_VAR Name="anindex" -->">&lt;&lt; Previous</a>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_LOOP NAME="numbers" -->
-					<!-- TMPL_IF NAME="highlight" -->
-						<!-- TMPL_VAR NAME="number" -->
-					<!-- TMPL_ELSE --> 
-						<a href="dictionary.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" -->&amp;marclist=<!-- TMPL_VAR NAME="marclist" ESCAPE="URL" -->&amp;search=<!-- TMPL_VAR NAME="search" ESCAPE="URL" -->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&amp;index=<!-- TMPL_VAR Name="anindex" -->"><!-- TMPL_VAR NAME="number" --></a>
-					<!-- /TMPL_IF -->
-				<!-- /TMPL_LOOP --> 
-				<!-- TMPL_IF NAME="displaynext" -->
-					<a href="dictionary.pl?startfrom=<!-- TMPL_VAR NAME="startfromnext" -->&amp;marclist=<!-- TMPL_VAR NAME="marclist" -->&amp;search=<!-- TMPL_VAR NAME="search" -->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&amp;index=<!-- TMPL_VAR Name="anindex" -->">Next&gt;&gt;</a>
-				<!-- /TMPL_IF -->
-			
-			
-			<!-- TMPL_IF NAME="nbresults" -->
-					Results <!-- TMPL_VAR NAME="from" --> to <!-- TMPL_VAR NAME="to" --> of <!-- TMPL_VAR NAME="nbresults" --> in Authorities<!-- TMPL_ELSE -->No results found
-			<!-- /TMPL_IF -->
-			
-		
-		
-			<table>
-				<caption>Authority Results</caption>
-				<tr>
-					<th>Summary</th>
-					<th>Used in</th>
-					<th>Select</th>
-				</tr>
-				<!-- TMPL_LOOP NAME="authresult" -->
-					<!-- TMPL_IF NAME="even" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
-					<td>
-							<!-- TMPL_VAR NAME="summary" -->
-						</td>
-						<td>
-							<!-- TMPL_VAR NAME="used" --> records(s)
-						</td>
-							<td>
-							<a  href="javascript:SelectEntry('<!-- TMPL_VAR NAME="mainentry" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL"  -->,0)">Select</a> | 
-							<a  href="javascript:SelectEntry('<!-- TMPL_VAR NAME="mainentry" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL"  -->,1)">Sel. &amp; close</a>
-						</td>
-					</tr>
-				<!-- /TMPL_LOOP -->
-			</table>
-		
-		<!-- TMPL_ELSE -->
-			<h3>No results in Authorities</h3>
-	<!-- /TMPL_IF -->
-		
-		
-	<!-- TMPL_IF Name="catresult" -->
-	<h2>Catalog Results</h2>
-			
-			<!-- TMPL_IF NAME="total" -->
-					Results <!-- TMPL_VAR NAME="from" --> to <!-- TMPL_VAR NAME="to" --> of <!-- TMPL_VAR NAME="total" --> in the Catalog<!-- TMPL_ELSE -->No results found
-			<!-- /TMPL_IF -->
-		
-			<table>
-				<tr>
-					<th>Summary</th>
-					<th>Used in</th>
-					<th>Select</th>
-				</tr>
-				<!-- TMPL_LOOP NAME="catresult" -->
-				<!-- TMPL_IF NAME="even" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
-				<td>
-					<!-- TMPL_IF name="MARC_ON" -->
-									<!-- TMPL_VAR NAME="value" -->
-								<!-- TMPL_ELSE -->
-									<!-- TMPL_VAR NAME="value" -->
-								<!-- /TMPL_IF -->
-					</td>
-					<td>
-						<!-- TMPL_VAR NAME="count" --> records(s)
-					</td>
-					<td>
-							<a  href="javascript:SelectEntry('<!-- TMPL_VAR NAME="value" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL"  -->,0)">Select</a> | 
-							<a  href="javascript:SelectEntry('<!-- TMPL_VAR NAME="value" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL"  -->,1)">Sel. &amp; close</a>
-					</td>
-				</tr>
-				<!-- /TMPL_LOOP -->
-			</table>
-		
-			<!-- TMPL_IF NAME="displayprev" --> 
-					<a href="dictionary.pl?startfrom=<!-- TMPL_VAR NAME="startfromprev" -->&amp;marclist=<!-- TMPL_VAR NAME="marclist" ESCAPE="URL"-->&amp;search=<!-- TMPL_VAR NAME="search" ESCAPE="URL"-->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&amp;index=<!-- TMPL_VAR Name="anindex" -->">&lt;&lt; Previous</a>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_LOOP NAME="numbers" -->
-					<!-- TMPL_IF NAME="highlight" -->
-						<!-- TMPL_VAR NAME="number" -->
-					<!-- TMPL_ELSE --> 
-						<a href="dictionary.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" -->&amp;marclist=<!-- TMPL_VAR NAME="marclist" ESCAPE="URL" -->&amp;search=<!-- TMPL_VAR NAME="search" ESCAPE="URL" -->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&amp;index=<!-- TMPL_VAR Name="anindex" -->"><!-- TMPL_VAR NAME="number" --></a>
-					<!-- /TMPL_IF -->
-				<!-- /TMPL_LOOP --> 
-				<!-- TMPL_IF NAME="displaynext" -->
-					<a href="dictionary.pl?startfrom=<!-- TMPL_VAR NAME="startfromnext" -->&amp;marclist=<!-- TMPL_VAR NAME="marclist" -->&amp;search=<!-- TMPL_VAR NAME="search" -->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&amp;index=<!-- TMPL_VAR Name="anindex" -->">Next&gt;&gt;</a>
-				<!-- /TMPL_IF -->
-
-			
-			<!-- TMPL_IF NAME="total" -->
-					Results <!-- TMPL_VAR NAME="from" --> to <!-- TMPL_VAR NAME="to" --> of <!-- TMPL_VAR NAME="total" --> in the Catalog<!-- TMPL_ELSE -->No results found
-			<!-- /TMPL_IF -->
-			
-		
-	<!-- /TMPL_IF -->
-	<script language="JavaScript" type="text/javascript">
-	function SelectEntry(myentry, myindex, wclose){
-		if (opener.document.f.value[myindex].value!=""){ 
-			opener.document.f.value[myindex].value=opener.document.f.value[myindex].value+" "+myentry
-		} else {
-			opener.document.f.value[myindex].value=myentry
-		}
-		if (wclose == 1) {
-	// 	alert("closing")
-			self.close();
-		}
-	}
-	</script>
-	
-<!-- /TMPL_IF -->
-
-</div>
-</div>
-</div>
-
-<!-- TMPL_INCLUDE NAME="mainmenu.inc" -->
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-dictionary.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-dictionary.tmpl
deleted file mode 100644
index dbf01ae..0000000
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-dictionary.tmpl
+++ /dev/null
@@ -1,142 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><!-- TMPL_IF NAME="LibraryNameTitle" --><!-- TMPL_VAR NAME="LibraryNameTitle" --><!-- TMPL_ELSE -->Koha Online<!-- /TMPL_IF --> Catalog &rsaquo;  Dictionary Search<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-</head>
-<body><div id="window">
-	<div class="container"><h1>Dictionary Search</h1>
-	
-<form name="f" method="post" action="opac-dictionary.pl">
-				<input type="hidden" name="op" value="do_search" />
-				<label for="keyword">Keyword(s): </label>
-				<input type="hidden" name="marclist" value="<!-- TMPL_VAR Name="marclist" -->" />
-				<input type="text" name="search" value="<!-- TMPL_VAR Name="search" -->" size="20" />
-				<input type="submit" value="Start search" class="submit" />
-				<input type="hidden" name="type" value="<!-- TMPL_VAR Name="type" -->" />
-				<input type="hidden" name="index" value="<!-- TMPL_VAR Name="anindex" ESCAPE="URL" -->" />
-	</form></div>
-
-<!-- TMPL_IF Name=search -->
-	<!-- TMPL_IF NAME="authresult" -->
-		<div class="pages">
-			<!-- TMPL_IF NAME="displayprev" --> 
-					<a href="opac-dictionary.pl?startfrom=<!-- TMPL_VAR NAME="startfromprev" -->&amp;marclist=<!-- TMPL_VAR NAME="marclist" ESCAPE=URL-->&amp;search=<!-- TMPL_VAR NAME="search" ESCAPE=URL-->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&amp;index=<!-- TMPL_VAR Name="anindex" -->">&lt;&lt;Previous</a>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_LOOP NAME="numbers" -->
-					<!-- TMPL_IF NAME="highlight" -->
-						<span class="current"><!-- TMPL_VAR NAME="number" --></span>
-					<!-- TMPL_ELSE --> 
-						<a href="opac-dictionary.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" -->&amp;marclist=<!-- TMPL_VAR NAME="marclist" ESCAPE=URL -->&amp;search=<!-- TMPL_VAR NAME="search" ESCAPE=URL -->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&amp;index=<!-- TMPL_VAR Name="anindex" -->"><!-- TMPL_VAR NAME="number" --></a>
-					<!-- /TMPL_IF -->
-				<!-- /TMPL_LOOP --> 
-				<!-- TMPL_IF NAME="displaynext" -->
-					<a href="opac-dictionary.pl?startfrom=<!-- TMPL_VAR NAME="startfromnext" -->&amp;marclist=<!-- TMPL_VAR NAME="marclist" -->&amp;search=<!-- TMPL_VAR NAME="search" -->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&amp;index=<!-- TMPL_VAR Name="anindex" -->">Next&gt;&gt;</a>
-				<!-- /TMPL_IF -->
-</div>
-			<div id="results">
-			<!-- TMPL_IF NAME="nbresults" -->
-					Results <!-- TMPL_VAR NAME="from" --> to <!-- TMPL_VAR NAME="to" --> of <!-- TMPL_VAR NAME="nbresults" --> in Authorities.<!-- TMPL_ELSE -->No results found in Authorities.
-			<!-- /TMPL_IF -->
-		</div>
-
-			<table>
-				<tr>
-					<th colspan="3">Authorities</th>
-				</tr>
-				<tr>
-					<th>Summary</th>
-					<th>Used in</th>
-					<th>Select</th>
-				</tr>
-				<!-- TMPL_LOOP NAME="authresult" -->
-					<!-- TMPL_IF NAME="even" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
-							<td>
-							<!-- TMPL_VAR NAME="summary" -->
-						</td>
-						<td>
-							<!-- TMPL_VAR NAME="used" --> record(s)
-						</td>
-							<td>
-							<a  href="javascript:SelectEntry('<!-- TMPL_VAR NAME="summary" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL"  -->,0)" class="button catalogue">Select</a> | 
-							<a  href="javascript:SelectEntry('<!-- TMPL_VAR NAME="mainentry" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL"  -->,1)" class="button catalogue">Sel &amp; close</a>
-						</td>
-					</tr>
-				<!-- /TMPL_LOOP -->
-			</table>
-		<!-- TMPL_ELSE -->
-			<h4>No results in Authorities</h4>
-	<!-- /TMPL_IF -->
-		
-		
-	<!-- TMPL_IF Name=catresult -->	
-	<h3>Catalog Search Results</h3>
-		<div id="results">
-			<!-- TMPL_IF NAME="total" -->
-					Results <!-- TMPL_VAR NAME="from" --> to <!-- TMPL_VAR NAME="to" --> of <!-- TMPL_VAR NAME="total" --> in the catalog<!-- TMPL_ELSE -->No results found in the catalog.
-			<!-- /TMPL_IF -->
-		</div>
-
-			<table>
-				<tr>
-					<th>Summary</th>
-					<th>Used in</th>
-					<th>Select</th>
-				</tr>
-				<!-- TMPL_LOOP NAME="catresult" -->
-				<!-- TMPL_IF NAME="even" --><tr class="highlight"><!-- TMPL_ELSE --><!-- /TMPL_IF -->
-				<td>
-							<!-- TMPL_IF name="MARC_ON" -->
-									<!-- TMPL_VAR NAME="value" -->
-								<!-- TMPL_ELSE -->
-									<!-- TMPL_VAR NAME="value" -->
-								<!-- /TMPL_IF -->
-					</td>
-					<td>
-						<!-- TMPL_VAR NAME="count" --> record(s)
-					</td>
-					<td>
-							<a  href="javascript:SelectEntry('<!-- TMPL_VAR NAME="value" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL"  -->,0)" class="button catalogue">Select</a> | 
-							<a  href="javascript:SelectEntry('<!-- TMPL_VAR NAME="value" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL"  -->,1)" class="button catalogue">Sel &amp; close</a>
-					</td>
-				</tr>
-				<!-- /TMPL_LOOP -->
-			</table>
-
-		<div class="pages">
-			<!-- TMPL_IF NAME="displayprev" --> 
-					<a href="opac-dictionary.pl?startfrom=<!-- TMPL_VAR NAME="startfromprev" -->&amp;marclist=<!-- TMPL_VAR NAME="marclist" ESCAPE=URL-->&amp;search=<!-- TMPL_VAR NAME="search" ESCAPE=URL-->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&amp;index=<!-- TMPL_VAR Name="anindex" -->">&lt;&lt;Previous</a>
-				<!-- /TMPL_IF -->
-				<!-- TMPL_LOOP NAME="numbers" -->
-					<!-- TMPL_IF NAME="highlight" -->
-						<span class="current"><!-- TMPL_VAR NAME="number" --></span>
-					<!-- TMPL_ELSE --> 
-						<a href="opac-dictionary.pl?startfrom=<!-- TMPL_VAR NAME="startfrom" -->&amp;marclist=<!-- TMPL_VAR NAME="marclist" ESCAPE=URL -->&amp;search=<!-- TMPL_VAR NAME="search" ESCAPE=URL -->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&amp;index=<!-- TMPL_VAR Name="anindex" -->"><!-- TMPL_VAR NAME="number" --></a>
-					<!-- /TMPL_IF -->
-				<!-- /TMPL_LOOP --> 
-				<!-- TMPL_IF NAME="displaynext" -->
-					<a href="opac-dictionary.pl?startfrom=<!-- TMPL_VAR NAME="startfromnext" -->&amp;marclist=<!-- TMPL_VAR NAME="marclist" -->&amp;search=<!-- TMPL_VAR NAME="search" -->&amp;resultsperpage=<!-- TMPL_VAR NAME="resultsperpage" -->&amp;type=intranet&amp;op=do_search&amp;index=<!-- TMPL_VAR Name="anindex" -->">Next&gt;&gt;</a>
-				<!-- /TMPL_IF -->
-
-			<div id="results">
-			<!-- TMPL_IF NAME="total" -->
-					Results <!-- TMPL_VAR NAME="from" --> to <!-- TMPL_VAR NAME="to" --> of <!-- TMPL_VAR NAME="total" --> in the catalog.<!-- TMPL_ELSE -->No results found in the catalog.
-			<!-- /TMPL_IF -->
-		</div>
-		
-	<!-- /TMPL_IF -->
-	<script language="JavaScript" type="text/javascript">
-	function SelectEntry(myentry, myindex, wclose){
-		if (opener.document.f.value[myindex].value!=""){ 
-			opener.document.f.value[myindex].value=opener.document.f.value[myindex].value+" "+myentry
-		} else {
-			opener.document.f.value[myindex].value=myentry
-		}
-		if (wclose == 1) {
-	// 	alert("closing")
-			self.close();
-		}
-	}
-	</script>
-<!-- /TMPL_IF -->
-
-</div>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/opac/opac-dictionary.pl b/opac/opac-dictionary.pl
deleted file mode 100755
index 985986c..0000000
--- a/opac/opac-dictionary.pl
+++ /dev/null
@@ -1,289 +0,0 @@
-#!/usr/bin/perl
-
-# 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 C4::Output;
-use C4::Auth;
-use CGI;
-use C4::Search;
-use C4::AuthoritiesMarc;
-use C4::Context;
-use C4::Biblio;
-
-
-=head1 NAME
-
-dictionnary.pl : script to search in biblio & authority an existing value
-
-=head1 SYNOPSIS
-
-useful when the user want to search a term before running a query. For example, to see if "computer" is used in the database
-
-The parameter "marclist" tells which field is searched (title, author, subject, but could be anything else)
-
-This script searches in both biblios & authority
-* in biblio, the script search in all marc fields related to what the user is looking for (for example, if the dictionnary is used on "author", the script searches in biblio.author, but also in additional authors & any MARC field related to author (through the "seealso" MARC constraint)
-* in authority, the script search everywhere. Thus, the accepted & rejected forms are found.
-
-The script shows all results & the user can choose what he want, that is copied into search form.
-
-=cut
-
-my $input = new CGI;
-my $field = $input->param('marclist');
-
-#warn "field :$field";
-my ( $tablename, $kohafield ) = split /./, $field;
-
-#my $tablename=$input->param('tablename');
-$tablename = "biblio" unless ($tablename);
-
-#my $kohafield = $input->param('kohafield');
-my @search = $input->param('search');
-
-# warn " ".$search[0];
-my $index = $input->param('index');
-
-# warn " index: ".$index;
-my $op = $input->param('op');
-if ( ( $search[0] ) and not( $op eq 'do_search' ) ) {
-    $op = 'do_search';
-}
-my $script_name = 'opac-dictionary.pl';
-my $query;
-my $type = $input->param('type');
-
-#warn " ".$type;
-
-my $dbh = C4::Context->dbh;
-my ( $template, $loggedinuser, $cookie );
-
-my $startfrom = $input->param('startfrom');
-$startfrom = 0 if ( !defined $startfrom );
-my $searchdesc;
-my $resultsperpage;
-
-#warn "Starting process";
-
-if ( $op eq "do_search" ) {
-
-    #
-    # searching in biblio
-    #
-    my $sth =
-      $dbh->prepare(
-"Select distinct tagfield,tagsubfield from marc_subfield_structure where kohafield = ?"
-      );
-    $sth->execute("$field");
-    my ( @tags, @and_or, @operator, @excluding, @value );
-
-    while ( ( my $tagfield, my $tagsubfield, my $liblibrarian ) =
-        $sth->fetchrow )
-    {
-        push @tags, $dbh->quote("$tagfield$tagsubfield");
-    }
-
-    $resultsperpage = $input->param('resultsperpage');
-    $resultsperpage = 19 if ( !defined $resultsperpage );
-    my $orderby = $input->param('orderby');
-
-    findseealso( $dbh, \@tags );
-
-    my @results, my $total;
-    my $strsth =
-"select distinct subfieldvalue, count(marc_subfield_table.bibid) from marc_subfield_table,marc_word where marc_word.word like ? and marc_subfield_table.bibid=marc_word.bibid and marc_subfield_table.tagorder=marc_word.tagorder and marc_word.tagsubfield in ";
-    my $listtags = "(";
-    foreach my $tag (@tags) {
-        $listtags .= $tag . ",";
-    }
-    $listtags =~ s/,$/)/;
-    $strsth .= $listtags
-      . " and marc_word.tagsubfield=concat(marc_subfield_table.tag,marc_subfield_table.subfieldcode) group by subfieldvalue ";
-
-    #     warn "search in biblio : ".$strsth;
-    my $value = uc( $search[0] );
-    $value =~ s/\*/%/g;
-    $value .= "%" if not( $value =~ m/%/ );
-
-    #     warn " texte : ".$value;
-
-    $sth = $dbh->prepare($strsth);
-    $sth->execute($value);
-    my @catresults;
-    while ( my ( $value, $ctresults ) = $sth->fetchrow ) {
-
-        #         warn "countresults : ".$ctresults;
-        push @catresults,
-          {
-            value => $value,
-            even  => ( $total - $startfrom * $resultsperpage ) % 2,
-            count => $ctresults
-          }
-          if (  ( $total >= $startfrom * $resultsperpage )
-            and ( $total < ( $startfrom + 1 ) * $resultsperpage ) );
-        $total++;
-    }
-
-    $strsth =
-      "Select distinct authtypecode from marc_subfield_structure where (";
-    foreach my $listtags (@tags) {
-        my @taglist = split /,/, $listtags;
-        foreach my $curtag (@taglist) {
-            $strsth .=
-                "(tagfield='"
-              . substr( $curtag, 1, 3 )
-              . "' AND tagsubfield='"
-              . substr( $curtag, 4, 1 ) . "') OR";
-        }
-    }
-
-    $strsth =~ s/ OR$/)/;
-    $strsth = $strsth . " and authtypecode is not NULL";
-
-    #     warn $strsth;
-    $sth = $dbh->prepare($strsth);
-    $sth->execute;
-
-    #
-    # searching in authorities
-    #
-    my @authresults;
-    my $authnbresults;
-    while ( ( my $authtypecode ) = $sth->fetchrow ) {
-        my ( $curauthresults, $nbresults ) =
-          authoritysearch( $dbh, [''], [''], [''], ['contains'], \@search,
-            $startfrom * $resultsperpage,
-            $resultsperpage, $authtypecode );
-        push @authresults, @$curauthresults;
-        $authnbresults += $nbresults;
-
-        #        warn "auth : $authtypecode nbauthresults : $nbresults";
-    }
-
-    #
-    # OK, filling the template with authorities & biblio entries found.
-    #
-    ( $template, $loggedinuser, $cookie ) = get_template_and_user(
-        {
-            template_name   => "opac-dictionary.tmpl",
-            query           => $input,
-            type            => 'opac',
-            authnotrequired => 1,
-            debug           => 1,
-        }
-    );
-
-    # multi page display gestion
-    my $displaynext = 0;
-    my $displayprev = $startfrom;
-    if ( ( $total - ( ( $startfrom + 1 ) * ($resultsperpage) ) ) > 0 ) {
-        $displaynext = 1;
-    }
-
-    my @field_data = ();
-
-    for ( my $i = 0 ; $i <= $#tags ; $i++ ) {
-        push @field_data, { term => "marclist",  val => $tags[$i] };
-        push @field_data, { term => "and_or",    val => $and_or[$i] };
-        push @field_data, { term => "excluding", val => $excluding[$i] };
-        push @field_data, { term => "operator",  val => $operator[$i] };
-        push @field_data, { term => "value",     val => $value[$i] };
-    }
-
-    my @numbers = ();
-
-    if ( $total > $resultsperpage ) {
-        for ( my $i = 1 ; $i < $total / $resultsperpage + 1 ; $i++ ) {
-            if ( $i < 16 ) {
-                my $highlight = 0;
-                ( $startfrom == ( $i - 1 ) ) && ( $highlight = 1 );
-                push @numbers,
-                  {
-                    number     => $i,
-                    highlight  => $highlight,
-                    searchdata => \@field_data,
-                    startfrom  => ( $i - 1 )
-                  };
-            }
-        }
-    }
-
-    my $from = $startfrom * $resultsperpage + 1;
-    my $to;
-
-    if ( $total < ( ( $startfrom + 1 ) * $resultsperpage ) ) {
-        $to = $total;
-    }
-    else {
-        $to = ( ( $startfrom + 1 ) * $resultsperpage );
-    }
-    $template->param(
-        anindex              => $input->param('index'),
-        opaclayoutstylesheet => C4::Context->preference("opaclayoutstylesheet"),
-        opaccolorstylesheet  => C4::Context->preference("opaccolorstylesheet"),
-    );
-    $template->param(
-        result         => \@results,
-        catresult      => \@catresults,
-        search         => $search[0],
-        marclist       => $field,
-        authresult     => \@authresults,
-        nbresults      => $authnbresults,
-        startfrom      => $startfrom,
-        displaynext    => $displaynext,
-        displayprev    => $displayprev,
-        resultsperpage => $resultsperpage,
-        startfromnext  => $startfrom + 1,
-        startfromprev  => $startfrom - 1,
-        searchdata     => \@field_data,
-        total          => $total,
-        from           => $from,
-        to             => $to,
-        numbers        => \@numbers,
-        MARC_ON        => C4::Context->preference("marc"),
-    );
-
-}
-else {
-    ( $template, $loggedinuser, $cookie ) = get_template_and_user(
-        {
-            template_name   => "opac-dictionary.tmpl",
-            query           => $input,
-            type            => 'opac',
-            authnotrequired => 1,
-            debug           => 1,
-        }
-    );
-
-    #warn "type : $type";
-
-}
-$template->param(
-    search   => $search[0],
-    marclist => $field,
-    type     => $type,
-    anindex  => $input->param('index')
-);
-
-# Print the page
-output_html_with_http_headers $input, $cookie, $template->output;
-
-# Local Variables:
-# tab-width: 4
-# End:
diff --git a/t/lib/KohaTest/Search.pm b/t/lib/KohaTest/Search.pm
index ef27acd..4ad190b 100644
--- a/t/lib/KohaTest/Search.pm
+++ b/t/lib/KohaTest/Search.pm
@@ -12,7 +12,7 @@ sub testing_class { 'C4::Search' };
 
 sub methods : Test( 1 ) {
     my $self = shift;
-    my @methods = qw( findseealso
+    my @methods = qw(
                       FindDuplicate
                       SimpleSearch
                       getRecords
-- 
1.5.6.5




More information about the Koha-patches mailing list