Bug 10464: Patron search on placing a hold now supports autocomplete

The patron search box for placing a hold request on a bib in the
staff interface now supports autocomplete if the CircAutocompl
system preference is enabled.

This patch grabs the autocomplete handling javascript stuff from patron-search-box.inc
and puts an adjusted version on reserve/request.tt.  It sets form and input
IDs to match those configured in the autocomplete call, adjusted where needed to
avoid name collisions with the patron-search-box.inc that is present everywhere.

This patch also doubles the width of the patron search input field.

To test:
- On a biblio record, go to the Holds tab, mine looks like
  /cgi-bin/koha/reserve/request.pl?biblionumber=2
- A search box is shown for patron searching.
- Search for a patron: it works as usual.
- Make sure CircAutocompl is "Don't try"
- Apply the patch
- Click the Holds tab again, and do the same search: functionality should remain intact.
- Change CircAutocompl to "Try"
- Click the Holds tab again
- Autocomplete should show you the possible options, and once you choose one result,
  it should work as usual.

Sponsored-by: Universidad Nacional de Córdoba
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Adding a nice new autocomplete feature.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit dc94a9bef7)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
(cherry picked from commit ab3163564e)
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
(cherry picked from commit ab3163564e)
Signed-off-by: Chris Hall <followingthepath@gmail.com>
(cherry picked from commit dd574b1b70)
This commit is contained in:
Tomas Cohen Arazi 2013-06-13 14:20:43 -03:00 committed by Chris Hall
parent 0318f1ea9c
commit be2db1c1e3
1 changed files with 31 additions and 7 deletions

View File

@ -130,6 +130,30 @@ function checkMultiHold() {
});
$('#hold-request-form').preventDoubleFormSubmit();
[% UNLESS ( borrowernumber || borrower_list ) %]
[% IF ( CircAutocompl ) %]
$( "#patron" ).autocomplete({
source: "/cgi-bin/koha/circ/ysearch.pl",
minLength: 3,
select: function( event, ui ) {
$( "#patron" ).val( ui.item.cardnumber );
$( "#holds_patronsearch" ).submit();
return false;
}
})
.data( "autocomplete" )._renderItem = function( ul, item ) {
return $( "<li></li>" )
.data( "item.autocomplete", item )
.append( "<a>" + item.surname + ", " + item.firstname +
" (" + item.cardnumber + ") <small>" + item.address +
" " + item.city + " " + item.zipcode + " " +
item.country + "</small></a>" )
.appendTo( ul );
};
[% END %]
[% END %]
});
// ]]>
@ -176,15 +200,15 @@ function checkMultiHold() {
[% IF ( messageborrower ) %]
<div class="dialog alert"><h3>Patron Not Found</h3><p>No patron with this name, please, try another</p> </div>
[% END %]
<form action="request.pl?biblionumber=[% biblionumber %]" method="post">
<form id="holds_patronsearch" action="request.pl?biblionumber=[% biblionumber %]" method="post">
[% UNLESS borrower_list %]
<fieldset class="brief">
<label for="patron">Patron: </label>
<div class="hint">Enter patron card number or partial name:</div>
<input type="text" size="20" id="patron" class="focus" name="findborrower" />
<input type="hidden" name="biblionumber" value="[% biblionumber %]" />
<fieldset class="brief">
<label for="patron">Patron: </label>
<div class="hint">Enter patron card number or partial name:</div>
<input type="text" size="40" id="patron" class="focus" name="findborrower" />
<input type="submit" value="Search" />
</fieldset>
<input type="hidden" name="biblionumber" value="[% biblionumber %]" />
</fieldset>
[% ELSE %]
<fieldset>
<select size="7" name="borrowernumber">