X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=circ%2Fypattrodue-attr-search-authvalue.pl;h=7834b3bc24817f9ba69fe922251829d656671628;hb=0079ca7c72403059ca89f564cd6814c6dfb4312a;hp=f8d77c57349c076d838426fec96870a8dcecb837;hpb=481f620455d40f93a3cb37136ef2c3964497751e;p=koha.git diff --git a/circ/ypattrodue-attr-search-authvalue.pl b/circ/ypattrodue-attr-search-authvalue.pl index f8d77c5734..7834b3bc24 100755 --- a/circ/ypattrodue-attr-search-authvalue.pl +++ b/circ/ypattrodue-attr-search-authvalue.pl @@ -2,30 +2,31 @@ # This software is placed under the gnu General Public License, v2 (http://www.gnu.org/licenses/gpl.html) +# Parts copyright 2012 Athens County Public Libraries # This file is part of Koha. # -# Koha is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. # -# Koha is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . use strict; use warnings; -use CGI; +use CGI qw ( -utf8 ); use C4::Context; use C4::Auth qw/check_cookie_auth/; use C4::Debug; my $input = new CGI; -my $query = $input->param('query'); +my $query = $input->param('term'); my $attrcode = $input->path_info || ''; $attrcode =~ s|^/||; @@ -45,8 +46,14 @@ my $sql = qq(SELECT authorised_value, lib description AND v.lib like ?); my $sth = $dbh->prepare($sql); $sth->execute( $attrcode, "$query%" ); + +print "["; +my $i = 0; while ( my $rec = $sth->fetchrow_hashref ) { print STDERR ">> attrcode=$attrcode match '$query' ==> $rec->{description} ($rec->{authorised_value})\n" if $debug; - print "$rec->{description}\t$rec->{authorised_value}\n"; + print "{\"description\":\"" . $rec->{description} . "\",\"" . + "authorised_value\":\"" . $rec->{authorised_value} . "\"" . + "}"; + $i++; } - +print "]"; \ No newline at end of file