Bugzilla – Attachment 110977 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.94 KB, created by
David Nind
on 2020-09-30 09:45:20 UTC
(
hide
)
Description:
Bug 26572: Add autocomplete to librarian field in log viewer
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-09-30 09:45:20 UTC
Size:
5.94 KB
patch
obsolete
>From 0341e9d55bed86d184601cc0b94b89adb142d7c3 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> >--- > .../intranet-tmpl/prog/en/modules/tools/viewlog.tt | 10 +++++----- > koha-tmpl/intranet-tmpl/prog/js/viewlog.js | 23 ++++++++++++++++++++++ > 2 files changed, 28 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 85090b3ccb..549080d241 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >@@ -120,7 +120,7 @@ fieldset.rows label.viewlog { > </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> >@@ -141,7 +141,7 @@ fieldset.rows label.viewlog { > <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> >@@ -151,9 +151,9 @@ fieldset.rows label.viewlog { > > [% 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> >@@ -172,7 +172,7 @@ fieldset.rows label.viewlog { > <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 1354c95e0a..2ec72ab13a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/viewlog.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/viewlog.js >@@ -67,4 +67,27 @@ $(document).ready(function(){ > "order": [[0, "desc"]], > "pagingType" : "full" > }, columns_settings); >+ >+ 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