Bugzilla – Attachment 143779 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 order search
Bug-31782-Fix-patron-autocomplete-on-order-search.patch (text/plain), 2.86 KB, created by
Jonathan Druart
on 2022-11-11 11:26:31 UTC
(
hide
)
Description:
Bug 31782: Fix patron autocomplete on order search
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-11-11 11:26:31 UTC
Size:
2.86 KB
patch
obsolete
>From c5cd51f87b8abcaeb5d17291954d0f0407709c9b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 11 Nov 2022 12:13:21 +0100 >Subject: [PATCH] Bug 31782: Fix patron autocomplete on order search > >Test plan: >Search for order using the "Basket created by" field >--- > .../prog/en/modules/acqui/histsearch.tt | 33 +++++++++++++++---- > 1 file changed, 27 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt >index d1b644d7365..d70e55df4bc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt >@@ -159,7 +159,6 @@ > [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] >- [% Asset.js("js/autocomplete/patrons.js") | $raw %] > <script> > var MSG_REMOVE_PATRON = _("Remove"); > $(document).ready(function() { >@@ -168,12 +167,34 @@ > "sPaginationType": "full" > }, table_settings ); > >- patron_autocomplete({ >- patron_container: $("#basket_creators"), >- input_autocomplete: $("#find_patron"), >- patron_input_name: 'created_by', >- field_to_retrieve: 'borrowernumber' >+ 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.borrowernumber; >+ AddPatron( ui.item.firstname + " " + ( ui.item.middle_name || "" ) + " " + ui.item.surname, field, $("#basket_creators"), 'created_by' ); >+ $("#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, $("#basket_creators")); >+ }); >+ > }); > </script> > [% END %] >-- >2.25.1
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