From 07dfffb7995fce5bbf2459b30a13fa53ad1b1c51 Mon Sep 17 00:00:00 2001 From: doxulting Date: Fri, 26 Aug 2005 12:18:59 +0000 Subject: [PATCH] Correct a bug that prevents selectionning an entry with a quote --- .../default/en/search.marc/dictionary.tmpl | 8 +++---- search.marc/dictionary.pl | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/default/en/search.marc/dictionary.tmpl b/koha-tmpl/intranet-tmpl/default/en/search.marc/dictionary.tmpl index 298523be0e..6ad4850225 100644 --- a/koha-tmpl/intranet-tmpl/default/en/search.marc/dictionary.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/search.marc/dictionary.tmpl @@ -107,8 +107,8 @@ a.catalogue:hover { - ',,0)" class="button catalogue">select - ',,1)" class="button catalogue">sel&close + ',,0)" class="button catalogue">select + ',,1)" class="button catalogue">sel&close @@ -151,8 +151,8 @@ a.catalogue:hover { biblio(s) class="hilighted"> - ',,0)" class="button catalogue">Select - ',,1)" class="button catalogue">Sel&close + ',,0)" class="button catalogue">Select + ',,1)" class="button catalogue">Sel&close diff --git a/search.marc/dictionary.pl b/search.marc/dictionary.pl index 1a10ee2b94..9d21ff463d 100755 --- a/search.marc/dictionary.pl +++ b/search.marc/dictionary.pl @@ -116,9 +116,17 @@ if ($op eq "do_search") { $sth->execute($value); my $total; my @catresults; + my $javalue; + while (my ($value,$ctresults)=$sth->fetchrow) { # warn "countresults : ".$ctresults; + + # 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)); @@ -130,6 +138,9 @@ if ($op eq "do_search") { foreach my $listtags (@tags){ my @taglist=split /,/,$listtags; foreach my $curtag (@taglist){ + # regexp used to prevent errors if user puts spaces in "search also" of the framework description. + + $curtag =~s/\s+//; $strsth.="(tagfield='".substr($curtag,1,3)."' AND tagsubfield='".substr($curtag,4,1)."') OR"; } } @@ -148,6 +159,16 @@ if ($op eq "do_search") { while ((my $authtypecode) = $sth->fetchrow) { my ($curauthresults,$nbresults) = authoritysearch($dbh,[''],[''],[''],['contains'], \@search,$startfrom*$resultsperpage, $resultsperpage,$authtypecode); + + + if (defined(@$curauthresults)) { + my $taille = @$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"; -- 2.39.5