X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=authorities%2Fysearch.pl;h=65841232f9b7069ea199a38a2cc96c132ade0ce7;hb=570372b24ef081aca5bbb8aea8a1462fced14e68;hp=56ef8e2e34923879d8ffa6847a3e6e76b84d19ee;hpb=a598b100613a37dc2710090cb381dce56eae2f26;p=koha_fer diff --git a/authorities/ysearch.pl b/authorities/ysearch.pl index 56ef8e2e34..65841232f9 100755 --- a/authorities/ysearch.pl +++ b/authorities/ysearch.pl @@ -3,6 +3,7 @@ # This software is placed under the gnu General Public License, v2 (http://www.gnu.org/licenses/gpl.html) # Copyright 2011 BibLibre +# Parts copyright 2012 Athens County Public Libraries # # This file is part of Koha. # @@ -43,7 +44,7 @@ if ( $auth_status ne "ok" ) { exit 0; } - my $searchstr = $query->param('query'); + my $searchstr = $query->param('term'); my $searchtype = $query->param('querytype'); my @value; given ($searchtype) { @@ -62,10 +63,18 @@ if ( $auth_status ne "ok" ) { my $startfrom = 0; my ( $results, $total ) = SearchAuthorities( \@marclist, \@and_or, \@excluding, \@operator, \@value, $startfrom * $resultsperpage, $resultsperpage, $authtypecode, $orderby ); - foreach (@$results) { - my ($value) = $_->{'summary'}; - # Removes new lines - $value =~ s/
/ /g; - $value =~ s/\n//g; - print nsb_clean($value) . "\n"; + +print "["; +my $i = 0; + foreach my $result (@$results) { + if($i > 0){ print ","; } + my $value = ''; + my $authorized = $result->{'summary'}->{'authorized'}; + foreach my $heading (@$authorized) { + $value .= $heading->{'heading'} . ' '; + } + $value = "{\"summary\":\"" . $value . "\"" . "}"; + print nsb_clean($value) . "\n"; + $i++; } +print "]";