Bug 25498: (follow-up) Change for autocomplete change of 30578
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 19 Jul 2022 12:18:21 +0000 (12:18 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 19 Jul 2022 14:25:26 +0000 (11:25 -0300)
Test plan:
Check if the patron search still works on the intranet shelves form
when transferring ownership.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt

index b08607e..356f801 100644 (file)
 
         [% IF op == 'transfer' %]
             $(document).ready(function() {
-                $('#find_patron').autocomplete({
-                    source: "/cgi-bin/koha/circ/ysearch.pl",
-                    minLength: 3,
-                    select: function( event, ui ) {
-                        $('#new_owner_name').html( ui.item.firstname + " " + ui.item.surname );
-                        $('#new_owner').val( ui.item.borrowernumber );
-                        $('#find_patron').val('').focus();
-                        return false;
-                    },
-                }).data('ui-autocomplete')._renderItem = function( ul, item ) {
-                    return $('<li></li>')
-                        .data( 'ui-autocomplete-item', item )
-                        .append( '<a>' + item.surname + ', ' + item.firstname + '</a>' )
-                        .appendTo(ul);
-                };
+                patron_autocomplete( $("#find_patron"), { 'on-select-callback': function( event, ui ) {
+                    $('#new_owner_name').html( ui.item.firstname + " " + ui.item.surname );
+                    $('#new_owner').val( ui.item.patron_id );
+                    $('#find_patron').val('').focus();
+                    return false;
+                }});
 
                 $('#transferform').submit(function() {
                     if( $('#new_owner').val() == '' ) {