Bugzilla – Attachment 119023 Details for
Bug 10902
Highlight patrons from logged-in library in patron searches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10902: Highlight patrons from logged-in library in patron searches
Bug-10902-Highlight-patrons-from-logged-in-library.patch (text/plain), 9.18 KB, created by
Owen Leonard
on 2021-03-30 16:36:46 UTC
(
hide
)
Description:
Bug 10902: Highlight patrons from logged-in library in patron searches
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2021-03-30 16:36:46 UTC
Size:
9.18 KB
patch
obsolete
>From 7b209f3583f3d44e41d7df9b8e21e499805d98ff Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 30 Mar 2021 16:21:06 +0000 >Subject: [PATCH] Bug 10902: Highlight patrons from logged-in library in patron > searches > >This patch alters a few different patron search interfaces so that >patrons from the currently-logged-in library are highlighted in a way >that differentiates them from other patrons. > >To test, apply the patch and rebuild the staff interface CSS >(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). > >- In Administration -> System preferences, make sure the > PatronAutoComplete preference is enabled. >- In the "Check out" tab in the header, type a partial patron name which > will return multiple results and wait for the autocomplete menu to > appear.. > - Patrons in the autocomplete results should show the branchcode, and > patrons from the currently-logged-in library should be highlighted > in green. >- Submit your partial name in the "check out" tab. > - In the search results the branch name of patrons from the > currently-logged-in library should be similarly highlighted. >- Go to patrons browse for patrons. These results should be highlighted > as in the previous steps. >--- > circ/ysearch.pl | 1 + > .../intranet-tmpl/prog/css/src/staff-global.scss | 23 ++++++++++++++++++++ > .../en/includes/circ-patron-search-results.inc | 8 ++++++- > .../intranet-tmpl/prog/en/includes/js_includes.inc | 25 +++++++++++++++++++++- > .../prog/en/modules/members/member.tt | 10 ++++++++- > 5 files changed, 64 insertions(+), 3 deletions(-) > >diff --git a/circ/ysearch.pl b/circ/ysearch.pl >index a52568640e..63389fd936 100755 >--- a/circ/ysearch.pl >+++ b/circ/ysearch.pl >@@ -90,6 +90,7 @@ while ( my $b = $borrowers_rs->next ) { > city => $b->city // '', > zipcode => $b->zipcode // '', > country => $b->country // '', >+ branchcode => $b->branchcode // '', > }; > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >index ed2a495237..5179147aca 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >+++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >@@ -4383,6 +4383,29 @@ div .suggestion_note { > } > } > >+.ac-library { >+ background-color: #EEE; >+ border-radius: 4px; >+ color: #000; >+ display: inline-block; >+ font-size: 80%; >+ padding: 1px 4px; >+} >+ >+.ac-currentlibrary { >+ .ac-library { >+ background-color: #E6FCB7; >+ font-weight: bold; >+ >+ } >+} >+ >+.currentlibrary { >+ background-color: #E6FCB7; >+ display: inline-block; >+ padding: 2px 4px; >+} >+ > @media (min-width: 200px) { > > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-patron-search-results.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-patron-search-results.inc >index 0c31cbf291..3523abccb5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-patron-search-results.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-patron-search-results.inc >@@ -28,7 +28,13 @@ > <td>[% borrower.cardnumber | html %]</td> > <td>[% INCLUDE 'patron-age.inc' patron = borrower %]</td> > <td>[% Categories.GetName( borrower.categorycode ) | html %]</td> >- <td>[% Branches.GetName( borrower.branchcode ) | html %]</td> >+ <td> >+ [% IF ( Branches.GetLoggedInBranchcode == borrower.branchcode ) %] >+ <span class="currentlibrary">[% Branches.GetName( borrower.branchcode ) | html %]</span> >+ [% ELSE %] >+ [% Branches.GetName( borrower.branchcode ) | html %] >+ [% END %] >+ </td> > <td>[% borrower.address | html %]</td> > <td>[% borrower.phone | html %]</td> > </tr> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >index b832eec518..c96ba49118 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >@@ -1,6 +1,7 @@ > [% USE raw %] > [% USE Asset %] > [% USE AudioAlerts %] >+[% USE Branches %] > [% USE To %] > [% USE Koha %] > [%# Prevent XFS attacks -%] >@@ -69,6 +70,8 @@ > [% IF ( PatronAutoComplete ) %] > <script> > // PatronAutoComplete && CAN_user_circulate_circulate_remaining_permissions >+ var loggedInLibrary = '[% Branches.GetLoggedInBranchcode | html %]'; >+ var loggedInClass = ""; > $(document).ready(function(){ > var obj = $( "#findborrower" ).autocomplete({ > source: "/cgi-bin/koha/circ/ysearch.pl", >@@ -86,6 +89,13 @@ > cardnumber = " (" + item.cardnumber + ") "; > } > var itemString = "<a href=\"" + item.link + "\">" + ( item.surname ? item.surname.escapeHtml() : "" ) + ", " + ( item.firstname ? item.firstname.escapeHtml() : "" ) + cardnumber.escapeHtml() + " <small>"; >+ >+ if( item.branchcode == loggedInLibrary ){ >+ loggedInClass = "ac-currentlibrary"; >+ } else { >+ loggedInClass = ""; >+ } >+ > if( item.dateofbirth ) { > itemString += ( item.dateofbirth ? item.dateofbirth.escapeHtml() : "" ) > + "<span class=\"age_years\"> (" + ( item.age ? item.age.escapeHtml() : "" ) + " " + _("years") + ")</span>, "; >@@ -95,7 +105,9 @@ > + ( item.zipcode ? item.zipcode.escapeHtml() : "" ) + " " > + ( item.country ? item.country.escapeHtml() : "" ) > + "</small></a>"; >+ itemString += " <span class=\"ac-library\">" + item.branchcode + "</span> " + "</a>"; > return $( "<li></li>" ) >+ .addClass( loggedInClass ) > .data( "ui-autocomplete-item", item ) > .append( itemString ) > .appendTo( ul ); >@@ -108,6 +120,8 @@ > [% IF ( PatronAutoComplete ) %] > <script> > // PatronAutoComplete >+ var loggedInLibrary = '[% Branches.GetLoggedInBranchcode | html %]'; >+ var loggedInClass = ""; > $(document).ready(function(){ > var obj = $( "#searchmember" ).autocomplete({ > source: "/cgi-bin/koha/circ/ysearch.pl", >@@ -124,7 +138,13 @@ > // Display card number in parentheses if it exists > cardnumber = " (" + item.cardnumber + ") "; > } >+ if( item.branchcode == loggedInLibrary ){ >+ loggedInClass = "ac-currentlibrary"; >+ } else { >+ loggedInClass = ""; >+ } > return $( "<li></li>" ) >+ .addClass( loggedInClass ) > .data( "ui-autocomplete-item", item ) > .append( > "<a href=\"" + item.link + "\">" + ( item.surname ? item.surname.escapeHtml() : "" ) + ", " >@@ -135,7 +155,10 @@ > + ( item.address ? item.address.escapeHtml() : "" ) + " " > + ( item.city ? item.city.escapeHtml() : "" ) + " " > + ( item.zipcode ? item.zipcode.escapeHtml() : "" ) + " " >- + ( item.country ? item.country.escapeHtml() : "" ) >+ + ( item.country ? item.country.escapeHtml() : "" ) + " " >+ + "<span class=\"ac-library\">" >+ + ( item.branchcode ? item.branchcode.escapeHtml() : "" ) >+ + "</span>" > + "</small>" > + "</a>" ) > .appendTo( ul ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >index f039dd2375..a4c5b5ebc3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >@@ -440,7 +440,15 @@ > { 'mDataProp': 'dt_name' }, > { 'mDataProp': 'dt_dateofbirth' }, > { 'mDataProp': 'dt_category' }, >- { 'mDataProp': 'dt_branch' }, >+ { >+ 'mDataProp': function ( oObj ) { >+ if( oObj.dt_branch == "[% Branches.GetLoggedInBranchname | html %]" ){ >+ return "<span class=\"currentlibrary\">" + oObj.dt_branch + "</span>"; >+ } else { >+ return oObj.dt_branch; >+ } >+ } >+ }, > { 'mDataProp': 'dt_dateexpiry' }, > { 'mDataProp': 'dt_od_checkouts', 'bSortable': false }, > { 'mDataProp': 'dt_fines', 'bSortable': false }, >-- >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 10902
:
119023
|
119037
|
119057
|
123578
|
123587
|
123588
|
123639
|
123680
|
123681
|
123682
|
123683
|
123684
|
123849