Bug 23697

Summary: Add auto complete for patron search in patron module
Product: Koha Reporter: delaye <stephane.delaye>
Component: PatronsAssignee: Matthias Meusburger <matthias.meusburger>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: david, gmcharlt, katrin.fischer, kyle.m.hall, martin.renvoize, matthias.meusburger, oleonard, sandboxes
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancement adds an optional auto-complete function to the patron search field when in the patrons module. The `CircAutocompl` system preference is renamed to `PatronAutoComplete` and use for both the circulation and patrons module auto-complete.
Version(s) released in:
19.11.00
Bug Depends on:    
Bug Blocks: 26125    
Attachments: Bug 23697: Add autocompletion search in patron module
Bug 23697: Add autocompletion search in patron module
Bug 23697, Follow-up: Add autocompletion search in patron module
Bug 23697: Add autocompletion search in patron module
Bug 23697, Follow-up: Add autocompletion search in patron module
Bug 23697: Add autocompletion search in patron module
Bug 23697: (follow-up) Add autocompletion search in patron module
Bug 23697: (QA follow-up) Rename PatronAutocompletion to PatronAutoComplete
Bug 23697: Add autocompletion search in patron module
Bug 23697: (follow-up) Add autocompletion search in patron module
Bug 23697: (QA follow-up) Rename PatronAutocompletion to PatronAutoComplete
Bug 23697: (QA follow-up) Fix quotes in database update statement

Description delaye 2019-09-30 10:24:11 UTC
How add autocompletion search in patron module.

with jquery it's possible like this

$(document).ready(function(){
  $( '#searchmember' ).autocomplete({
    source: function(request, response) {
      $.ajax({
        url: "/cgi-bin/koha/circ/ysearch.pl",
        dataType: "json",
        data: {
          term: request.term
        
        },
        success: function(data) {
          response( $.map( data, function( item ) {
            return {
              label: item.surname + " , " + item.firstname + " .-Date of birth naissance: " + item.dateofbirth + " .-Address: " + item.address + " .-City:" + item.city,
              value: item.surname + " " + item.firstname
            }
          }));
        }
      });
    },
    minLength: 1,
  });
});
Comment 1 Matthias Meusburger 2019-10-02 12:24:01 UTC
Created attachment 93443 [details] [review]
Bug 23697: Add autocompletion search in patron module

 Test plan:

  - Apply the patch
  - Go to "Patrons" (members/members-home.pl)
  - Check that autocomplete is enabled for patron search
Comment 2 Lucas Gass 2019-10-02 13:35:27 UTC
Created attachment 93476 [details] [review]
Bug 23697: Add autocompletion search in patron module

Test plan:

  - Apply the patch
  - Go to "Patrons" (members/members-home.pl)
  - Check that autocomplete is enabled for patron search

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 Katrin Fischer 2019-10-02 16:03:14 UTC
This works fine!

Just have a little 'but': For the patron auto-complete we got a system preference to turn the feature off: CircAutocompl

So my question would be: Should we also use this pref here? Does it need a pref?

I am setting 'Failed QA' - let's discuss this quickly tomorrow. Also adding Owen in CC as he might know about the reasoning behind the pref in circulation.
Comment 4 Katrin Fischer 2019-10-02 16:17:54 UTC
After discussing with Owen, I think it would be best if we use the pref for this as well and update the wording of the pref a little bit to cover both.

Matts, could you provide a follow-up please?
Comment 5 Matthias Meusburger 2019-10-03 07:46:03 UTC
Any hint on what the syspref should be renamed to? 

PatronAutoCompl? 

And why not PatronAutoCompletion, since truncated words are ugly and may me meaningless to some people?
Comment 6 Katrin Fischer 2019-10-03 08:01:47 UTC
(In reply to Matthias Meusburger from comment #5)
> Any hint on what the syspref should be renamed to? 
> 
> PatronAutoCompl? 
> 
> And why not PatronAutoCompletion, since truncated words are ugly and may me
> meaningless to some people?

I actually meant only correcting the description (although you have a point about it being a bit ugly :) )

Now: 

[Don't try|Try] to guess the patron being entered while typing a patron search on the circulation screen. Only returns the first 10 results at a time. 

Maybe change to:

[Don't try|Try] to guess the patron being entered while typing a patron search for circulation or patron search. Only returns the first 10 results at a time.
Comment 7 David Nind 2019-10-03 08:43:35 UTC
How about:

[Don't try|Try] to guess the patron when typing a name in the circulation check out and patron search screens. Only shows the first 10 results.

Like the idea of making the preference name PatronAutoCompletion.
Comment 8 Matthias Meusburger 2019-10-04 09:17:48 UTC
Created attachment 93721 [details] [review]
Bug 23697, Follow-up: Add autocompletion search in patron module

 - Rename CircAutocompl system preference to PatronAutocompletion
 - Take this system preference into consideration for patron search
Comment 9 Biblibre Sandboxes 2019-10-04 10:12:11 UTC
Patch tested with a sandbox, by Séverine QUEUNE <severine.queune@bulac.fr>
Comment 10 Biblibre Sandboxes 2019-10-04 10:12:41 UTC
Created attachment 93738 [details] [review]
Bug 23697: Add autocompletion search in patron module

 Test plan:

  - Apply the patch
  - Go to "Patrons" (members/members-home.pl)
  - Check that autocomplete is enabled for patron search

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 11 Biblibre Sandboxes 2019-10-04 10:12:44 UTC
Created attachment 93739 [details] [review]
Bug 23697, Follow-up: Add autocompletion search in patron module

 - Rename CircAutocompl system preference to PatronAutocompletion
 - Take this system preference into consideration for patron search

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 12 Katrin Fischer 2019-10-07 19:02:16 UTC
Created attachment 93832 [details] [review]
Bug 23697: Add autocompletion search in patron module

Test plan:

  - Apply the patch
  - Go to "Patrons" (members/members-home.pl)
  - Check that autocomplete is enabled for patron search

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Katrin Fischer 2019-10-07 19:02:24 UTC
Created attachment 93833 [details] [review]
Bug 23697: (follow-up) Add autocompletion search in patron module

- Rename CircAutocompl system preference to PatronAutocompletion
 - Take this system preference into consideration for patron search

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Katrin Fischer 2019-10-07 19:02:29 UTC
Created attachment 93834 [details] [review]
Bug 23697: (QA follow-up) Rename PatronAutocompletion to PatronAutoComplete

Just a find and replace on the changed system preference name.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 15 Katrin Fischer 2019-10-07 19:04:00 UTC
Created attachment 93835 [details] [review]
Bug 23697: Add autocompletion search in patron module

Test plan:

  - Apply the patch
  - Go to "Patrons" (members/members-home.pl)
  - Check that autocomplete is enabled for patron search

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 16 Katrin Fischer 2019-10-07 19:04:05 UTC
Created attachment 93836 [details] [review]
Bug 23697: (follow-up) Add autocompletion search in patron module

 - Rename CircAutocompl system preference to PatronAutocompletion
 - Take this system preference into consideration for patron search

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 17 Katrin Fischer 2019-10-07 19:04:10 UTC
Created attachment 93837 [details] [review]
Bug 23697: (QA follow-up) Rename PatronAutocompletion to PatronAutoComplete

Just a find and replace on the changed system preference name.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 18 Katrin Fischer 2019-10-07 19:04:14 UTC
Created attachment 93838 [details] [review]
Bug 23697: (QA follow-up) Fix quotes in database update statement
Comment 19 Martin Renvoize 2019-10-08 13:53:32 UTC
Nice work!

Pushed to master for 19.11.00