Bug 35517: Choose correct default header search tab according to permissions

This patch adds some additional template logic to the header search form
for the staff interface home page so that users with different
permissions will see the correct tab in the header search form.

To test, apply the patch and view the staff interface home page using a
user with different permissions:

- 'catalogue' and 'circulate'
  - Header should show circulation search
- 'catalogue' and 'borrowers'
  - Header should show patron search
- 'catalogue' only
  - Header should show catalog search

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Owen Leonard 2023-12-07 18:17:55 +00:00 committed by Katrin Fischer
parent 78b4fac242
commit abbacfca5d
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 16 additions and 6 deletions

View File

@ -2,20 +2,30 @@
<div id="header_search" role="tablist">
<div class="tab-content">
[% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
[% INCLUDE 'patron-search-box.inc' bs_tab_active= 1 %]
[% circ_active_tab = 1 %]
[% circ_active = "active" %]
[% ELSIF ( CAN_user_borrowers_edit_borrowers ) %]
[% patrons_active_tab = 1 %]
[% patrons_active = "active" %]
[% ELSIF ( CAN_user_catalogue ) %]
[% search_active_tab = 1 %]
[% search_active = "active" %]
[% END %]
[% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
[% INCLUDE 'patron-search-box.inc' bs_tab_active= circ_active_tab %]
[% INCLUDE 'checkin-search-box.inc' %]
[% INCLUDE 'renew-search-box.inc' %]
[% END %]
[% IF ( CAN_user_borrowers_edit_borrowers ) %]
[% INCLUDE 'member-search-box.inc' %]
[% INCLUDE 'member-search-box.inc' bs_tab_active= patrons_active_tab %]
[% END %]
[% IF ( CAN_user_catalogue ) %]
[% INCLUDE 'catalogue-search-box.inc' %]
[% INCLUDE 'catalogue-search-box.inc' bs_tab_active= search_active_tab %]
[% END %]
</div><!-- /.tab-content -->
<ul class="nav nav-tabs" role="tablist">
[% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
<li role="presentation" class="active">
<li role="presentation" class="[% circ_active | html %]">
<a title="Check out" href="#circ_search" aria-controls="circ_search" role="tab" aria-expanded="true" data-toggle="tab" class="keep_text"><i class="fa fa-fw fa-upload" aria-hidden="true"></i> <span class="tab-title">Check out</span></a>
</li>
<li role="presentation">
@ -26,12 +36,12 @@
</li>
[% END %]
[% IF ( CAN_user_borrowers_edit_borrowers ) %]
<li role="presentation">
<li role="presentation" class="[% patrons_active | html %]">
<a title="Search patrons" href="#patron_search" aria-controls="patron_search" role="tab" data-toggle="tab" class="keep_text"><i class="fa fa-fw fa-id-card" aria-hidden="true"></i> <span class="tab-title">Search patrons</span></a>
</li>
[% END %]
[% IF ( CAN_user_catalogue ) %]
<li role="presentation">
<li role="presentation" class="[% search_active | html %]">
<a title="Search catalog" href="#catalog_search" aria-controls="catalog_search" role="tab" data-toggle="tab" class="keep_text"><i class="fa fa-fw fa-search" aria-hidden="true"></i> <span class="tab-title">Search catalog</span></a>
</li>
[% END %]