Bug 10902: (follow-up) Account for singleBranchMode
authorOwen Leonard <oleonard@myacpl.org>
Tue, 10 Aug 2021 11:56:45 +0000 (11:56 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 16 Aug 2021 09:55:56 +0000 (11:55 +0200)
This patch checks singleBranchMode before highlighting the current
branch in search results.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/includes/circ-patron-search-results.inc
koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc
koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt

index 82f9e22..a69466e 100644 (file)
@@ -29,7 +29,7 @@
                 <td data-order="[% borrower.dateofbirth | html %]">[% INCLUDE 'patron-age.inc' patron = borrower %]</td>
                 <td>[% Categories.GetName( borrower.categorycode ) | html %]</td>
                 <td>
-                    [% IF ( Branches.GetLoggedInBranchcode == borrower.branchcode ) %]
+                    [% IF ( Branches.GetLoggedInBranchcode == borrower.branchcode && !singleBranchMode ) %]
                         <span class="currentlibrary">[% Branches.GetName( borrower.branchcode ) | html %]</span>
                     [% ELSE %]
                         [% Branches.GetName( borrower.branchcode ) | html %]
index 4a01bc3..2027813 100644 (file)
                                     + ( item.zipcode ? item.zipcode.escapeHtml() : "" ) + " "
                                     + ( item.country ? item.country.escapeHtml() : "" )
                                     + "</small></a>";
-                        itemString += " <span class=\"ac-library\">" + item.branchname + "</span> " + "</a>";
+                        [% UNLESS ( singleBranchMode ) %]
+                            itemString += " <span class=\"ac-library\">" + item.branchname + "</span> " + "</a>";
+                        [% END %]
                         return $( "<li></li>" )
                         .addClass( loggedInClass )
                         .data( "ui-autocomplete-item", item )
                             + ( item.city        ? item.city.escapeHtml() : "" )        + " "
                             + ( item.zipcode     ? item.zipcode.escapeHtml() : "" )     + " "
                             + ( item.country     ? item.country.escapeHtml() : "" ) + " "
-                            + "<span class=\"ac-library\">"
-                            + ( item.branchname  ? item.branchname.escapeHtml() : "" )
-                            + "</span>"
+                            [% UNLESS ( singleBranchMode ) %]
+                                + "<span class=\"ac-library\">"
+                                + ( item.branchname  ? item.branchname.escapeHtml() : "" )
+                                + "</span>"
+                            [% END %]
                         + "</small>"
                     + "</a>" )
                 .appendTo( ul );
index 0b7ed3f..f3c14cc 100644 (file)
     [% Asset.js("lib/hc-sticky.js") | $raw %]
     [% Asset.js("js/members-menu.js") | $raw %]
     <script>
+        var singleBranchMode = '[% singleBranchMode | html %]';
         $(document).ready(function() {
             $('#merge-patrons').prop('disabled', true);
             $('#memberresultst').on('change', 'input.selection', function() {
                     { 'mDataProp': 'dt_category' },
                     {
                         'mDataProp': function ( oObj ) {
-                            if( oObj.dt_branch == "[% Branches.GetLoggedInBranchname | html %]" ){
+                            if( !singleBranchMode &&  oObj.dt_branch == "[% Branches.GetLoggedInBranchname | html %]" ){
                                 return "<span class=\"currentlibrary\">" + oObj.dt_branch + "</span>";
                             } else {
                                 return oObj.dt_branch;