Bugzilla – Attachment 143809 Details for
Bug 31782
Patron autocomplete broken when using js/autocomplete/patrons.js
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31782: Remove js/autocomplete/patrons.js
Bug-31782-Remove-jsautocompletepatronsjs.patch (text/plain), 3.58 KB, created by
Katrin Fischer
on 2022-11-13 13:23:36 UTC
(
hide
)
Description:
Bug 31782: Remove js/autocomplete/patrons.js
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-11-13 13:23:36 UTC
Size:
3.58 KB
patch
obsolete
>From 5032adf884225e4a5be7fcffde0ce2f6abb5a9a4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 11 Nov 2022 12:17:28 +0100 >Subject: [PATCH] Bug 31782: Remove js/autocomplete/patrons.js > >On 30578 we replace circ/ysearch.pl with a call to the /api/v1/patrons >route. A new patron_autocomplete JS function has been written >(js/patron-autocomplete.js) for that purpose. > >However 3 occurrences were using an existing patron_autocomplete >function, and 30578 didn't take care of adjusting correctly the call to >the REST API route. > >On this patchset I am suggesting to copy/paste the JS functions defined >in js/autocomplete/patrons.js, because we are very close of the 22.11 >release. But ideally we should improve js/patron-autocomplete.js to add >a new 'on-select-add-to' option that will take care of add/remove/hide >behaviour. IMO that must be done on a separate bug, and after 22.11 is >released (to not need to retest the other occurrences of the patron >autocomplete) > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../intranet-tmpl/js/autocomplete/patrons.js | 48 ------------------- > 1 file changed, 48 deletions(-) > delete mode 100644 koha-tmpl/intranet-tmpl/js/autocomplete/patrons.js > >diff --git a/koha-tmpl/intranet-tmpl/js/autocomplete/patrons.js b/koha-tmpl/intranet-tmpl/js/autocomplete/patrons.js >deleted file mode 100644 >index 87c65eadc1..0000000000 >--- a/koha-tmpl/intranet-tmpl/js/autocomplete/patrons.js >+++ /dev/null >@@ -1,48 +0,0 @@ >-function patron_autocomplete(params) { >- var patron_container = params.patron_container; >- var input_autocomplete = params.input_autocomplete; >- var patron_input_name = params.patron_input_name || 'cardnumber'; >- var field_to_retrieve = params.field_to_retrieve || 'cardnumber'; >- >- $( input_autocomplete ).autocomplete({ >- source: "/api/v1/patrons", >- minLength: 3, >- select: function( event, ui ) { >- var field = ui.item.cardnumber; >- if ( field_to_retrieve == 'borrowernumber' ) { >- field = ui.item.borrowernumber; >- } >- AddPatron( ui.item.firstname + " " + ui.item.middle_name + " " + ui.item.surname, field, patron_container, patron_input_name ); >- input_autocomplete.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 + " " + item.middle_name + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >- .appendTo( ul ); >- }; >- >- $("body").on("click",".removePatron",function(e){ >- e.preventDefault(); >- var divid = $(this).parent().attr("id"); >- var cardnumber = divid.replace("borrower_",""); >- RemovePatron(cardnumber, patron_container); >- }); >-} >- >-function AddPatron( patron_name, value, container, input_name ) { >- div = "<div id='borrower_" + value + "'>" + patron_name + " ( <a href='#' class='removePatron'><i class='fa fa-trash' aria-hidden='true'></i> " + MSG_REMOVE_PATRON + " </a> ) <input type='hidden' name='" + input_name + "' value='" + value + "' /></div>"; >- $(container).append( div ); >- >- $(container).parent().show( 800 ); >-} >- >-function RemovePatron( cardnumber, container ) { >- $( '#borrower_' + cardnumber ).remove(); >- >- if ( ! $(container).html() ) { >- $(container).parent().hide( 800 ); >- } >-} >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31782
:
143778
|
143779
|
143780
|
143781
|
143782
|
143783
|
143784
|
143785
|
143806
|
143807
|
143808
| 143809