Browse Source

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.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.11.x
Owen Leonard 3 years ago
committed by Jonathan Druart
parent
commit
40a79145df
  1. 1
      circ/ysearch.pl
  2. 23
      koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
  3. 8
      koha-tmpl/intranet-tmpl/prog/en/includes/circ-patron-search-results.inc
  4. 25
      koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc
  5. 10
      koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt

1
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 // '',
};
}

23
koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss

@ -4442,6 +4442,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) {
}

8
koha-tmpl/intranet-tmpl/prog/en/includes/circ-patron-search-results.inc

@ -28,7 +28,13 @@
<td>[% borrower.cardnumber | html %]</td>
<td data-order="[% borrower.dateofbirth | html %]">[% 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>

25
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 );

10
koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt

@ -465,7 +465,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 },

Loading…
Cancel
Save