From aff9d00b71ed298db7b4d06390f5d3cb23765732 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 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): musee [add an accent aigu on first e] on LOC -- Add diacritic!!! Search in Acquisition Somewhere, does not matter, but use a diacritic. A note: My git version still has a hard time with utf8. Need to upgrade to version 1.7.10 to resolve this.. Signed-off-by: Bernardo Gonzalez Kriegel Comment: Work as described. No errors Without patch z39.50 search for example Std ID OR musee gives no results, with patch there are. No problems in acq search. Signed-off-by: Katrin Fischer Good catch, passes all tests and QA script. Signed-off-by: Jared Camins-Esakov --- 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 4d26be603b..01aca2105d 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 5247d67ce1..0ae843ff2f 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 05f5f2b899..425a6c17f1 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; -- 2.39.5