From 0bb9c7d1051ab8c7bf57bf7b837c54c623d3a533 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 29 Aug 2013 10:57:00 -0400 Subject: [PATCH] Bug 10565 - Add a "Patron List" feature for storing and manipulating collections of patrons - Followup 3 * Borrower search works for names with < 3 characters * Borrowers without cardnumbers can now be added --- circ/ysearch.pl | 5 +++-- .../prog/en/modules/patron_lists/list.tt | 10 +++++----- patron_lists/list.pl | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/circ/ysearch.pl b/circ/ysearch.pl index 8a48c51..ae0649b 100755 --- a/circ/ysearch.pl +++ b/circ/ysearch.pl @@ -44,7 +44,7 @@ if ($auth_status ne "ok") { } my $dbh = C4::Context->dbh; -my $sql = qq(SELECT surname, firstname, cardnumber, address, city, zipcode, country +my $sql = qq(SELECT surname, firstname, cardnumber, address, city, zipcode, country, borrowernumber FROM borrowers WHERE surname LIKE ? OR firstname LIKE ? @@ -64,8 +64,9 @@ while ( my $rec = $sth->fetchrow_hashref ) { "address\":\"".$rec->{address} . "\",\"" . "city\":\"".$rec->{city} . "\",\"" . "zipcode\":\"".$rec->{zipcode} . "\",\"" . + "borrowernumber\":\"".$rec->{borrowernumber} . "\",\"" . "country\":\"".$rec->{country} . "\"" . "}"; $i++; } -print "]"; \ No newline at end of file +print "]"; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt index f008cc1..86b6c21 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt @@ -23,9 +23,9 @@ $(document).ready(function() { })); $( "#find_patron" ).autocomplete({ source: "/cgi-bin/koha/circ/ysearch.pl", - minLength: 3, + minLength: 1, select: function( event, ui ) { - AddPatron( ui.item.surname + ", " + ui.item.firstname, ui.item.cardnumber ); + AddPatron( ui.item.surname + ", " + ui.item.firstname, ui.item.borrowernumber ); return false; } }) @@ -54,13 +54,13 @@ $(document).ready(function() { }); }); -function AddPatron( name, cardnumber ) { - div = "

" + name + " ( " + _("Remove") + " )

"; +function AddPatron( name, borrowernumber ) { + div = "

" + name + " ( " + _("Remove") + " )

"; $('#patrons_to_add').append( div ); $('#find_patron').val('').focus(); - $('#patrons_to_add_fieldset').show( ); + $('#patrons_to_add_fieldset').show(); } //]]> diff --git a/patron_lists/list.pl b/patron_lists/list.pl index bae9e46..ecbd8ed 100755 --- a/patron_lists/list.pl +++ b/patron_lists/list.pl @@ -42,7 +42,7 @@ my ($list) = my @patrons_to_add = $cgi->param('patrons_to_add'); if (@patrons_to_add) { - AddPatronsToList( { list => $list, cardnumbers => \@patrons_to_add } ); + AddPatronsToList( { list => $list, borrowernumbers => \@patrons_to_add } ); } my @patrons_to_remove = $cgi->param('patrons_to_remove'); -- 1.7.2.5