From 07a34eec2586a6c0a6299bc503615855a56d589e Mon Sep 17 00:00:00 2001 From: tipaul Date: Fri, 30 Dec 2005 11:12:28 +0000 Subject: [PATCH] some minor bugfixes (from doXulting) --- search.marc/dictionary.pl | 14 +++++++++++++- search.marc/search.pl | 10 +++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/search.marc/dictionary.pl b/search.marc/dictionary.pl index 1a10ee2b94..d358e5d10f 100755 --- a/search.marc/dictionary.pl +++ b/search.marc/dictionary.pl @@ -116,9 +116,14 @@ 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 +135,7 @@ if ($op eq "do_search") { foreach my $listtags (@tags){ my @taglist=split /,/,$listtags; foreach my $curtag (@taglist){ + $curtag =~s/\s+//; $strsth.="(tagfield='".substr($curtag,1,3)."' AND tagsubfield='".substr($curtag,4,1)."') OR"; } } @@ -148,6 +154,12 @@ if ($op eq "do_search") { while ((my $authtypecode) = $sth->fetchrow) { my ($curauthresults,$nbresults) = authoritysearch($dbh,[''],[''],[''],['contains'], \@search,$startfrom*$resultsperpage, $resultsperpage,$authtypecode); + if (defined(@$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"; diff --git a/search.marc/search.pl b/search.marc/search.pl index 1b971096de..2aa8cc9d2a 100755 --- a/search.marc/search.pl +++ b/search.marc/search.pl @@ -121,7 +121,15 @@ if ($op eq "do_search") { if ($tag) { push @tags,$dbh->quote("$tag$subfield"); } else { - push @tags, $dbh->quote(substr($marc,0,4)); + if ($marc =~ /^(\d){3}(. -)(.)*/) + { + # The user is using the search catalogue part, more fields + push @tags, $dbh->quote(substr($marc,0,4)); + } + else + { + push @tags, $marc; + } } } else { push @tags, ""; -- 2.39.5