Bugzilla – Attachment 111664 Details for
Bug 26572
Add autocomplete to librarian field in log viewer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26572: Add autocomplete to librarian field in log viewer
Bug-26572-Add-autocomplete-to-librarian-field-in-l.patch (text/plain), 5.89 KB, created by
Katrin Fischer
on 2020-10-15 00:11:02 UTC
(
hide
)
Description:
Bug 26572: Add autocomplete to librarian field in log viewer
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-10-15 00:11:02 UTC
Size:
5.89 KB
patch
obsolete
>From 1d69a5203ae39b963ef51a7c4b9ef42ef8800acd Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 29 Sep 2020 11:12:31 +0000 >Subject: [PATCH] Bug 26572: Add autocomplete to librarian field in log viewer > >This patch adds patron autocomplete to the librarian field in the log >viewer search form. > >Also changed: Some HTML markup errors in the template have been >corrected: Labels with invalid corresponding ids or with no valid id. > >To test, apply the patch and go to Tools -> Log Viewer. > >Type a name or cardnumber into the "Librarian" form field. This should >trigger an autocomplete dropdown. > >Select a patron and confirm that the field is populated with the correct >borrowernumber. > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../intranet-tmpl/prog/en/modules/tools/viewlog.tt | 10 +++++----- > koha-tmpl/intranet-tmpl/prog/js/viewlog.js | 22 ++++++++++++++++++++++ > 2 files changed, 27 insertions(+), 5 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >index 1a1f8fb18c..11cb6c0d92 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >@@ -147,7 +147,7 @@ > </li> > [% UNLESS src == "circ" %] > <li> >- <label for="modules">Modules:</label> >+ <label>Modules:</label> > <div class="log_modules"> > [% IF modules.size == 0 %] > <label for="moduleALL" class="viewlog"><input type="checkbox" id="moduleALL" name="modules" value="" checked="checked"> All</label> >@@ -168,7 +168,7 @@ > <input type="hidden" name="modules" value="CIRCULATION" /> > [% END %] > <li> >- <label for="actions">Actions:</label> >+ <label>Actions:</label> > <div class="log_modules"> > [% IF actions.length == 0 %] > <label for="actionALL" class="viewlog"><input type="checkbox" id="actionALL" name="actions" value="" checked="checked"> All</label> >@@ -178,9 +178,9 @@ > > [% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'DELCIRCMESSAGE' 'STATUS_CHANGE' 'CHANGE PASS' 'Run' ] %] > [% IF actions.grep(actx).size %] >- <label for="action[% actx | html %]" class="viewlog"><input type="checkbox" id="action[% actx | html %]" name="actions" value="[% actx | html %]" checked="checked"> [% PROCESS translate_log_action action=actx %]</label> >+ <label for="action[% actx| replace('\s+', '_') | html %]" class="viewlog"><input type="checkbox" id="action[% actx | replace('\s+', '_') | html %]" name="actions" value="[% actx | html %]" checked="checked"> [% PROCESS translate_log_action action=actx %]</label> > [% ELSE %] >- <label for="action[% actx | html %]" class="viewlog"><input type="checkbox" id="action[% actx | html %]" name="actions" value="[% actx | html %]"> [% PROCESS translate_log_action action=actx %]</label> >+ <label for="action[% actx| replace('\s+', '_') | html %]" class="viewlog"><input type="checkbox" id="action[% actx | replace('\s+', '_') | html %]" name="actions" value="[% actx | html %]"> [% PROCESS translate_log_action action=actx %]</label> > [% END %] > [% END %] > </div> >@@ -199,7 +199,7 @@ > <input type="text" id="info" name="info" value="[% info | html %]" /> > </li> > <li> >- <label for="interfaces">Interface:</label> >+ <label>Interface:</label> > [% IF interfaces.size == 0 %] > <label for="interfaceALL" class="viewlog"><input type="checkbox" id="interfaceALL" name="interfaces" value="" checked="checked"> All</label> > [% ELSE %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/viewlog.js b/koha-tmpl/intranet-tmpl/prog/js/viewlog.js >index 58c126de59..ff835f5787 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/viewlog.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/viewlog.js >@@ -144,4 +144,26 @@ $(document).ready(function(){ > e.preventDefault(); > $(".compare:checked").prop("checked", false).change(); > }); >+ var obj = $("#user").autocomplete({ >+ source: "/cgi-bin/koha/circ/ysearch.pl", >+ minLength: 3, >+ select: function ( event, ui ) { >+ $("#user").val( ui.item.borrowernumber ); >+ return false; >+ } >+ }).data("ui-autocomplete"); >+ if (obj) { >+ obj._renderItem = function (ul, item) { >+ var cardnumber = ""; >+ if (item.cardnumber != "") { >+ // Display card number in parentheses if it exists >+ cardnumber = " (" + item.cardnumber + ") "; >+ } >+ return $("<li></li>") >+ .data("ui-autocomplete-item", item) >+ .append("<a href=\"#\">" + item.surname + ", " + item.firstname + cardnumber + " <small>" + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>") >+ .appendTo(ul); >+ }; >+ } >+ > }); >-- >2.11.0
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 26572
:
110938
|
110977
|
111637
| 111664 |
111736
|
112984