In the OPAC, if there are no search groups defined, there's no reason to
embed library choices inside an <optgroup>. <optgroup> should only be
used to differentiate the list of individual libraries from search
groups. This patch removes the <optgroup> when no search groups are
enabled.

To test, apply the patch and:

- Enable OpacAddMastheadLibraryPulldown.
- Create a library search group in Administration ->
  Libraries and Groups and enable it by checking the "show in search
  pulldown" box.
- View the library pulldown in the OPAC search bar. Libraries and groups
  should be separated into <optgroup>s.
- Disable your library search group and refresh the OPAC page. The
  pulldown of libraries should now display libraries with no <optgroup>.
---
 koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc 
b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
index f9edb01..651e669 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
@@ -87,13 +87,13 @@
    [% IF ( OpacAddMastheadLibraryPulldown ) %]
       <select name="branch_group_limit" id="select_library" class="left">
          <option value="">All libraries</option>
-         <optgroup label="Libraries">
+         [% IF BranchCategoriesLoop %]<optgroup label="Libraries">[% END %]
              [% FOREACH BranchesLoo IN BranchesLoop %]
                 [% IF ( BranchesLoo.selected ) %]<option selected="selected" 
value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option>
                 [% ELSE %]<option value="branch:[% BranchesLoo.value %]">[% 
BranchesLoo.branchname %]</option>[% END %]
              [% END %]
-         </optgroup>
          [% IF BranchCategoriesLoop %]
+             </optgroup>
              <optgroup label="Groups">
                  [% FOREACH bc IN BranchCategoriesLoop %]
                      [% IF ( bc.selected ) %]
-- 
1.7.9.5
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to