Bug 11944: Fix problems introduced by bug 11515

The game continue...
Patch for bug 11515 introduced regression on this patch set.
To reproduce: search with utf8 characters at the opac
Test plan:
Verify that the issue described on bug 11515 is still fixed and that no
regression is found at the OPAC.

Note that I am pretty sure this patch is not enough.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Jonathan Druart 2014-12-04 13:13:30 +01:00 committed by Tomas Cohen Arazi
parent 2840c2fa75
commit f01e616a72
2 changed files with 9 additions and 9 deletions

View file

@ -168,13 +168,13 @@ if ($session->param('busc')) {
if ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|total|offset|offsetSearch|next|previous|count|expand|scan)/) {
if (defined($arrParamsBusc->{$_})) {
$pasarParams .= '&amp;' if ($j);
$pasarParams .= $_ . '=' . uri_escape( $arrParamsBusc->{$_} );
$pasarParams .= $_ . '=' . Encode::decode('UTF-8', uri_escape_utf8( $arrParamsBusc->{$_} ));
$j++;
}
} else {
for my $value (@{$arrParamsBusc->{$_}}) {
$pasarParams .= '&amp;' if ($j);
$pasarParams .= $_ . '=' . uri_escape($value);
$pasarParams .= $_ . '=' . Encode::decode('UTF-8', uri_escape_utf8($value));
$j++;
}
}

View file

@ -356,7 +356,7 @@ for (keys %$params) {
my @pasarParam = $cgi->param($_);
for my $paramValue(@pasarParam) {
$pasarParams .= '&amp;' if ($j > 0);
$pasarParams .= $_ . '=' . uri_escape($paramValue);
$pasarParams .= $_ . '=' . uri_escape_utf8($paramValue);
$j++;
}
}
@ -544,10 +544,10 @@ if ($tag) {
($error, $results_hashref, $facets) = C4::Search::pazGetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
};
} else {
$pasarParams .= '&amp;query=' . uri_escape($query);
$pasarParams .= '&amp;count=' . uri_escape($results_per_page);
$pasarParams .= '&amp;simple_query=' . uri_escape($simple_query);
$pasarParams .= '&amp;query_type=' . uri_escape($query_type) if ($query_type);
$pasarParams .= '&amp;query=' . uri_escape_utf8($query);
$pasarParams .= '&amp;count=' . uri_escape_utf8($results_per_page);
$pasarParams .= '&amp;simple_query=' . uri_escape_utf8($simple_query);
$pasarParams .= '&amp;query_type=' . uri_escape_utf8($query_type) if ($query_type);
eval {
($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$itemtypes,$query_type,$scan,1);
};
@ -699,12 +699,12 @@ for (my $i=0;$i<@servers;$i++) {
my $j = 0;
foreach (@newresults) {
my $bibnum = ($_->{biblionumber})?$_->{biblionumber}:0;
$pasarParams .= uri_escape($bibnum) . ',';
$pasarParams .= uri_escape_utf8($bibnum) . ',';
$j++;
last if ($j == $results_per_page);
}
chop $pasarParams if ($pasarParams =~ /,$/);
$pasarParams .= '&amp;total=' . uri_escape( int($total) ) if ($pasarParams !~ /total=(?:[0-9]+)?/);
$pasarParams .= '&amp;total=' . uri_escape_utf8( int($total) ) if ($pasarParams !~ /total=(?:[0-9]+)?/);
if ($pasarParams) {
my $session = get_session($cgi->cookie("CGISESSID"));
$session->param('busc' => $pasarParams);