Bugzilla – Attachment 143806 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: Fix patron autocomplete on patron list
Bug-31782-Fix-patron-autocomplete-on-patron-list.patch (text/plain), 2.90 KB, created by
Katrin Fischer
on 2022-11-13 13:23:21 UTC
(
hide
)
Description:
Bug 31782: Fix patron autocomplete on patron list
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-11-13 13:23:21 UTC
Size:
2.90 KB
patch
obsolete
>From 8cece7bb2f136e545e2074ec4c63307a380efd6a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 11 Nov 2022 12:10:28 +0100 >Subject: [PATCH] Bug 31782: Fix patron autocomplete on patron list > >Test plan: >Add new patrons to a patron list > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/modules/patron_lists/list.tt | 31 ++++++++++++++++--- > 1 file changed, 26 insertions(+), 5 deletions(-) > >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 ac4497cb27..c812adf7c9 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 >@@ -237,7 +237,6 @@ > [% Asset.js("js/tools-menu.js") | $raw %] > [% INCLUDE 'datatables.inc' %] > >- [% Asset.js("js/autocomplete/patrons.js") | $raw %] > <script> > var MSG_REMOVE_PATRON = _("Remove"); > $(document).ready(function() { >@@ -248,10 +247,32 @@ > "sPaginationType": "full" > }, table_settings); > >- patron_autocomplete({ >- patron_container: $("#patrons_to_add"), >- input_autocomplete: $("#find_patron"), >- patron_input_name: 'patrons_to_add' >+ 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("fieldset").hide( 800 ); >+ } >+ } >+ patron_autocomplete($("#find_patron"), { >+ 'on-select-callback': function( event, ui ) { >+ var field = ui.item.cardnumber; >+ AddPatron( ui.item.firstname + " " + ( ui.item.middle_name || "" ) + " " + ui.item.surname, field, $("#patrons_to_add"), 'patrons_to_add' ); >+ $("#find_patron").val('').focus(); >+ return false; >+ } >+ }); >+ $("body").on("click",".removePatron",function(e){ >+ e.preventDefault(); >+ var divid = $(this).parent().attr("id"); >+ var cardnumber = divid.replace("borrower_",""); >+ RemovePatron(cardnumber, $("#patrons_to_add")); > }); > > $("body").on("click", "#CheckAll", function(e){ >-- >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