From 8452baf22d9e17fc90a85c8ae889589e2ae34601 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 28 Feb 2005 14:03:12 +0000 Subject: [PATCH] * adding search on "main entry" (ie $a subfield) on a given authority (the "search everywhere" field is still here). * adding a select box to requet "contain" or "begin with" search. * fixing some bug in authority search (related to "main entry" search) --- C4/AuthoritiesMarc.pm | 22 +++++++++++++++++++ authorities/auth_finder.pl | 16 ++++++-------- authorities/authorities-home.pl | 2 +- .../default/en/authorities/auth_finder.tmpl | 22 +++++++++++++++---- .../en/authorities/authorities-home.tmpl | 22 ++++++++++++++----- .../en/authorities/searchresultlist-auth.tmpl | 22 +++++++++++++++---- 6 files changed, 83 insertions(+), 23 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index f950643d03..7ed3381539 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -61,7 +61,24 @@ sub authoritysearch { # where m1.authid=m2.authid and # (m1.subfieldvalue like "Des%" and m2.subfieldvalue like "27%") + # the marclist may contain "mainentry". In this case, search the tag_to_report, that depends on + # the authtypecode. Then, search on $a of this tag_to_report + for (my $i=0;$i<$#{$tags};$i++) { + if (@$tags[$i] eq "mainentry") { + my $sth = $dbh->prepare("select auth_tag_to_report from auth_types where authtypecode=?"); + $sth->execute($authtypecode); + my ($tag_to_report) = $sth->fetchrow; + @$tags[$i] = $tag_to_report."a"; + } + } + # "Normal" statements + # quote marc fields/subfields + for (my $i=0;$i<$#{$tags};$i++) { + if (@$tags[$i]) { + @$tags[$i] = $dbh->quote(@$tags[$i]); + } + } my @normal_tags = (); my @normal_and_or = (); my @normal_operator = (); @@ -841,6 +858,11 @@ Paul POULAIN paul.poulain@free.fr # $Id$ # $Log$ +# Revision 1.9.2.2 2005/02/28 14:03:13 tipaul +# * adding search on "main entry" (ie $a subfield) on a given authority (the "search everywhere" field is still here). +# * adding a select box to requet "contain" or "begin with" search. +# * fixing some bug in authority search (related to "main entry" search) +# # Revision 1.9.2.1 2005/02/24 13:12:13 tipaul # saving authority modif in a text file. This will be used soon with another script (in crontab). The script in crontab will retrieve every authorityid in the directory localfile/authorities and modify every biblio using this authority. Those modifs may be long. So they can't be done through http, because we may encounter a webserver timeout, and kill the process before end of the job. # So, it will be done through a cron job. diff --git a/authorities/auth_finder.pl b/authorities/auth_finder.pl index 106c6cdc2e..ba8e5d0d84 100755 --- a/authorities/auth_finder.pl +++ b/authorities/auth_finder.pl @@ -37,7 +37,7 @@ my $query=new CGI; my $op = $query->param('op'); my $authtypecode = $query->param('authtypecode'); my $index = $query->param('index'); -my $category = $query->param('category'); +# my $category = $query->param('category'); my $resultstring = $query->param('result'); my $dbh = C4::Context->dbh; @@ -68,10 +68,7 @@ if ($op eq "do_search") { $resultsperpage= $query->param('resultsperpage'); $resultsperpage = 19 if(!defined $resultsperpage); - # builds tag and subfield arrays - my @tags; - - my ($results,$total) = authoritysearch($dbh, \@tags,\@and_or, + my ($results,$total) = authoritysearch($dbh, \@marclist,\@and_or, \@excluding, \@operator, \@value, $startfrom*$resultsperpage, $resultsperpage,$authtypecode);# $orderby); @@ -127,7 +124,7 @@ if ($op eq "do_search") { $to = (($startfrom+1)*$resultsperpage); } $template->param(result => $results) if $results; - $template->param(index => $query->param('index')); + $template->param(index => $query->param('index').""); $template->param(startfrom=> $startfrom, displaynext=> $displaynext, displayprev=> $displayprev, @@ -154,12 +151,13 @@ if ($op eq "do_search") { }); $template->param(index => $index, - resultstring => $resultstring + resultstring => $resultstring, ); } -$template->param(authtypesloop => \@authtypesloop); -$template->param(category => $category); +$template->param(authtypesloop => \@authtypesloop, + authtypecode => $authtypecode); +warn "CAT : $authtypecode"; # Print the page output_html_with_http_headers $query, $cookie, $template->output; diff --git a/authorities/authorities-home.pl b/authorities/authorities-home.pl index 3440c93ff2..17a424a1e6 100755 --- a/authorities/authorities-home.pl +++ b/authorities/authorities-home.pl @@ -65,7 +65,7 @@ if ($op eq "do_search") { $resultsperpage= $query->param('resultsperpage'); $resultsperpage = 19 if(!defined $resultsperpage); my @tags; - my ($results,$total) = authoritysearch($dbh, \@tags,\@and_or, + my ($results,$total) = authoritysearch($dbh, \@marclist,\@and_or, \@excluding, \@operator, \@value, $startfrom*$resultsperpage, $resultsperpage,$authtypecode); ($template, $loggedinuser, $cookie) diff --git a/koha-tmpl/intranet-tmpl/default/en/authorities/auth_finder.tmpl b/koha-tmpl/intranet-tmpl/default/en/authorities/auth_finder.tmpl index ed58185dd1..63fa0b9e2d 100644 --- a/koha-tmpl/intranet-tmpl/default/en/authorities/auth_finder.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/authorities/auth_finder.tmpl @@ -11,15 +11,29 @@

Search on

- + + ">

- "> - "> + "> + + + + + "> +

+

+ - + ">

diff --git a/koha-tmpl/intranet-tmpl/default/en/authorities/authorities-home.tmpl b/koha-tmpl/intranet-tmpl/default/en/authorities/authorities-home.tmpl index e6176e7f9c..4380a27cea 100644 --- a/koha-tmpl/intranet-tmpl/default/en/authorities/authorities-home.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/authorities/authorities-home.tmpl @@ -8,9 +8,7 @@ ">

-

Search on

-

- +

Search on +

+

+ + "> + + + +

- + "> - +

diff --git a/koha-tmpl/intranet-tmpl/default/en/authorities/searchresultlist-auth.tmpl b/koha-tmpl/intranet-tmpl/default/en/authorities/searchresultlist-auth.tmpl index b3b79c9c3c..719775ea56 100644 --- a/koha-tmpl/intranet-tmpl/default/en/authorities/searchresultlist-auth.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/authorities/searchresultlist-auth.tmpl @@ -10,15 +10,29 @@

Search on

- + + ">

- "> - "> + "> + + + + + "> +

+

+ - + ">

-- 2.39.5