From 281c4e3a5b7a4d093d29c53191bc83fa21f3962c Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 3 Apr 2013 16:36:25 +0200 Subject: [PATCH] Bug 9986: Two fixes for Z3950 search MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="UTF-8" Searching for stdid: Standard ID, srchany: RAW (any) somehow did not work anymore. Probably my fault :) Note that these two fields are in Cataloging Z3950 search and not in Acquisition. Fixing encoding problems: When adding -utf flag for CGI in acqui/z3950 and cataloging/z3950, the decoding statements in C4/Breeding, Z3950Search should be removed. Test plan: Search in Cataloging with: Standard ID: 9782358670043 on LOC RAW (any): musée on LOC -- Note the diacritic Search in Acquisition Somewhere, does not matter, but use a diacritic. --- C4/Breeding.pm | 13 ++++++++++--- acqui/z3950_search.pl | 2 +- cataloguing/z3950_search.pl | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 4d26be6..01aca21 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -243,6 +243,8 @@ sub Z3950Search { my $lccn= $pars->{lccn}; my $lccall= $pars->{lccall}; my $controlnumber= $pars->{controlnumber}; + my $srchany= $pars->{srchany}; + my $stdid= $pars->{stdid}; my $show_next = 0; my $total_pages = 0; @@ -280,12 +282,10 @@ sub Z3950Search { $nterms++; } if ($title) { - utf8::decode($title); $query .= " \@attr 1=4 \"$title\" "; $nterms++; } if ($author) { - utf8::decode($author); $query .= " \@attr 1=1003 \"$author\" "; $nterms++; } @@ -294,7 +294,6 @@ sub Z3950Search { $nterms++; } if ($subject) { - utf8::decode($subject); $query .= " \@attr 1=21 \"$subject\" "; $nterms++; } @@ -310,6 +309,14 @@ sub Z3950Search { $query .= " \@attr 1=12 \"$controlnumber\" "; $nterms++; } + if($srchany) { + $query .= " \@attr 1=1016 \"$srchany\" "; + $nterms++; + } + if($stdid) { + $query .= " \@attr 1=1007 \"$stdid\" "; + $nterms++; + } for my $i (1..$nterms-1) { $query = "\@and " . $query; } diff --git a/acqui/z3950_search.pl b/acqui/z3950_search.pl index 5247d67..0ae843f 100755 --- a/acqui/z3950_search.pl +++ b/acqui/z3950_search.pl @@ -21,7 +21,7 @@ use warnings; use strict; -use CGI; +use CGI qw/-utf8/; use C4::Auth; use C4::Output; diff --git a/cataloguing/z3950_search.pl b/cataloguing/z3950_search.pl index 05f5f2b..425a6c1 100755 --- a/cataloguing/z3950_search.pl +++ b/cataloguing/z3950_search.pl @@ -106,8 +106,8 @@ my $pars= { subject => $subject, lccall => $lccall, controlnumber => $controlnumber, - stdid => 0, - srchany => 0, + stdid => $stdid, + srchany => $srchany, }; Z3950Search($pars, $template); output_html_with_http_headers $input, $cookie, $template->output; -- 1.7.7.6