Bug 36742 - Do not show libraries in OPAC menu if there is just one public library
Summary: Do not show libraries in OPAC menu if there is just one public library
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Owen Leonard
QA Contact: Marcel de Rooy
URL:
Keywords: additional_work_needed
: 31817 (view as bug list)
Depends on: 30873
Blocks:
  Show dependency treegraph
 
Reported: 2024-05-01 11:33 UTC by Marcel de Rooy
Modified: 2024-10-11 10:27 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00
Circulation function:


Attachments
Bug 36742: Do not show library selection options if there is one or fewer public libraries (19.11 KB, patch)
2024-06-28 15:43 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 36742: Do not show library selection options if there is one or fewer public libraries (19.19 KB, patch)
2024-07-01 14:14 UTC, Jake Deery
Details | Diff | Splinter Review
Bug 36742: (follow-up) Add hidden branchcode input for OPAC article requests (1.29 KB, patch)
2024-07-02 15:16 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 36742: Do not show library selection options if there is one or fewer public libraries (19.24 KB, patch)
2024-10-08 13:10 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 36742: (follow-up) Add hidden branchcode input for OPAC article requests (1.29 KB, patch)
2024-10-08 13:10 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 36742: Do not show library selection options if there is one or fewer public libraries (19.34 KB, patch)
2024-10-08 13:35 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 36742: (follow-up) Add hidden branchcode input for OPAC article requests (1.38 KB, patch)
2024-10-08 13:35 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2024-05-01 11:33:01 UTC
We are testing now for libraries>1 but we should check for the number of public libraries.
Comment 1 Marcel de Rooy 2024-05-01 12:04:07 UTC
This raises the question whether we are using singleBranchMode correctly.
That variable comes from a time that we did not have the possibility to mark a library non public or designate a library as pickup location or not.
Comment 2 Owen Leonard 2024-06-28 15:43:42 UTC
Created attachment 168267 [details] [review]
Bug 36742: Do not show library selection options if there is one or fewer public libraries

If a system has only one library or only one library which is public we
don't need to show library-selection menus. It doesn't make sense to
show a dropdown with only one choice.

This patch updates instances of Branches.all to add a "public => 1"
parameter.

To test, apply the patch and start with a set of multiple public
libraries in your system (where public means the entry in Administration
-> Libraries for that library has the "Public" option set to "Yes").

Log in to the OPAC test these pages, in each case confirming that the
the library dropdown appears correctly.

- OPAC home page (with OpacAddMastheadLibraryPulldown enabled)
- OPAC news section (with existing news items and OpacNewsLibrarySelect
  enabled)
- Advanced search (Location and availability section)
- The "Most popular" page (with OpacTopissue enabled)
- The suggestion entry form (with suggestion enabled)
- The article request entry form (with ArticleRequests enabled and
  circulation rules configured to allow requests)

Test again with only one library or only one public library.
Test again with no public libraries.

Sponsored-by: Athens County Public Libraries
Comment 3 Owen Leonard 2024-06-28 15:50:38 UTC
*** Bug 31817 has been marked as a duplicate of this bug. ***
Comment 4 Martin Renvoize (ashimema) 2024-07-01 11:16:03 UTC
sha1 failure again I'm afraid Owen :(
Comment 5 Owen Leonard 2024-07-01 11:29:47 UTC
(In reply to Martin Renvoize from comment #4)
> sha1 failure again I'm afraid Owen :(

Sorry, forgot to link the dependency
Comment 6 Jake Deery 2024-07-01 14:14:22 UTC
Created attachment 168317 [details] [review]
Bug 36742: Do not show library selection options if there is one or fewer public libraries

If a system has only one library or only one library which is public we
don't need to show library-selection menus. It doesn't make sense to
show a dropdown with only one choice.

This patch updates instances of Branches.all to add a "public => 1"
parameter.

To test, apply the patch and start with a set of multiple public
libraries in your system (where public means the entry in Administration
-> Libraries for that library has the "Public" option set to "Yes").

Log in to the OPAC test these pages, in each case confirming that the
the library dropdown appears correctly.

- OPAC home page (with OpacAddMastheadLibraryPulldown enabled)
- OPAC news section (with existing news items and OpacNewsLibrarySelect
  enabled)
- Advanced search (Location and availability section)
- The "Most popular" page (with OpacTopissue enabled)
- The suggestion entry form (with suggestion enabled)
- The article request entry form (with ArticleRequests enabled and
  circulation rules configured to allow requests)

Test again with only one library or only one public library.
Test again with no public libraries.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Jake Deery <jake.deery@ptfs-europe.com>
Comment 7 Jake Deery 2024-07-01 14:14:43 UTC
Really nice, Owen. All the pages you've mentioned work so far. I do see a library dropdown on /cgi-bin/koha/opac-memberentry.pl — both when logged in, and when logged out — as well as on the facets (holding libraries). I can also see holdings for non-public libraries within the record's holdings table.

Do we want to see non-public libraries here? This might not be a question in the scope of this bug, though.

Signed off with thanks
Comment 8 Owen Leonard 2024-07-01 19:48:13 UTC
(In reply to Jake Deery from comment #7)
> I do see a library dropdown on /cgi-bin/koha/opac-memberentry.pl

We have a preference for controlling which libraries go here. I wonder if that's enough?

> I can also see holdings for non-public libraries within the record's holdings
> table.

I'm not sure about this. We have OpacHiddenItems and 942n "Suppress in OPAC." Do we need another layer?
Comment 9 Jake Deery 2024-07-02 07:48:04 UTC
No — probably not, Owen. I wasn't familiar with either of these options, and they do exactly what you've described. I'll learn.

Nice one on this one, it'll be a nifty enhancement :-)
Comment 10 Marcel de Rooy 2024-07-02 12:01:18 UTC
Owen,
It seems that this changes makes a difference for e.g. article requests. I do not see any branch saved in the record anymore. This is in the 1 branch case.
Previously this branch was saved in the record.
That implies that you only see the request when looking for All libraries in staff. Can imagine that having no branch in the record is an unwished side-effect?
Comment 11 Owen Leonard 2024-07-02 15:16:38 UTC
Created attachment 168377 [details] [review]
Bug 36742: (follow-up) Add hidden branchcode input for OPAC article requests

This patch adds a hidden input containing the logged-in user's
branchcode to the article request form when there is only one public
branch.
Comment 12 Owen Leonard 2024-07-02 15:17:34 UTC
(In reply to Marcel de Rooy from comment #10)
> Can imagine that having no branch in the record is an unwished
> side-effect?

Agreed. I think it would cause confusion to have requests which were only visible if you viewed all libraries.
Comment 13 Marcel de Rooy 2024-07-19 09:32:19 UTC
Still looking at the suggestions part:

git grep branchcode_hidden
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt:                                        [% UNLESS ( branchcode_hidden || AllPublicBranches.size < 2 )%]

It seems that branchcode_hidden is only there? Is it just some old artifact?

And similarly:
git grep branchcode_required
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt:                                                [% IF ( branchcode_required ) %]

How should this work?
Comment 14 Kyle M Hall (khall) 2024-07-19 10:48:22 UTC
It would be nice if the query to get the branches were lazy loaded. As it stands the query looks to be unused unless OpacAddMastheadLibraryPulldown is enabled for at least one instance.

Setting to FQA just because we need a response to Marcel.
Comment 15 Owen Leonard 2024-07-26 15:44:36 UTC
(In reply to Marcel de Rooy from comment #13)
> It seems that branchcode_hidden is only there? Is it just some old artifact?

git blame knows: Bug 23420: Add OPACSuggestionUnwantedFields system pref

> git grep branchcode_required
> koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt:               
> [% IF ( branchcode_required ) %]

Bug 22657: Remove JavaScript from OPAC suggestion validation of required fields

Both changes are very specific to the suggestions page. branchcode_hidden is about hiding the library selection field on the suggestions form. branchcode_required is about marking the library option as required.
Comment 16 Marcel de Rooy 2024-10-04 09:41:27 UTC
Sorry for this late reply. Owen, could you rebase please? Thanks
Comment 17 Owen Leonard 2024-10-08 13:10:25 UTC
Created attachment 172520 [details] [review]
Bug 36742: Do not show library selection options if there is one or fewer public libraries

If a system has only one library or only one library which is public we
don't need to show library-selection menus. It doesn't make sense to
show a dropdown with only one choice.

This patch updates instances of Branches.all to add a "public => 1"
parameter.

To test, apply the patch and start with a set of multiple public
libraries in your system (where public means the entry in Administration
-> Libraries for that library has the "Public" option set to "Yes").

Log in to the OPAC test these pages, in each case confirming that the
the library dropdown appears correctly.

- OPAC home page (with OpacAddMastheadLibraryPulldown enabled)
- OPAC news section (with existing news items and OpacNewsLibrarySelect
  enabled)
- Advanced search (Location and availability section)
- The "Most popular" page (with OpacTopissue enabled)
- The suggestion entry form (with suggestion enabled)
- The article request entry form (with ArticleRequests enabled and
  circulation rules configured to allow requests)

Test again with only one library or only one public library.
Test again with no public libraries.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Jake Deery <jake.deery@ptfs-europe.com>
Comment 18 Owen Leonard 2024-10-08 13:10:27 UTC
Created attachment 172521 [details] [review]
Bug 36742: (follow-up) Add hidden branchcode input for OPAC article requests

This patch adds a hidden input containing the logged-in user's
branchcode to the article request form when there is only one public
branch.
Comment 19 Marcel de Rooy 2024-10-08 13:35:13 UTC
Created attachment 172524 [details] [review]
Bug 36742: Do not show library selection options if there is one or fewer public libraries

If a system has only one library or only one library which is public we
don't need to show library-selection menus. It doesn't make sense to
show a dropdown with only one choice.

This patch updates instances of Branches.all to add a "public => 1"
parameter.

To test, apply the patch and start with a set of multiple public
libraries in your system (where public means the entry in Administration
-> Libraries for that library has the "Public" option set to "Yes").

Log in to the OPAC test these pages, in each case confirming that the
the library dropdown appears correctly.

- OPAC home page (with OpacAddMastheadLibraryPulldown enabled)
- OPAC news section (with existing news items and OpacNewsLibrarySelect
  enabled)
- Advanced search (Location and availability section)
- The "Most popular" page (with OpacTopissue enabled)
- The suggestion entry form (with suggestion enabled)
- The article request entry form (with ArticleRequests enabled and
  circulation rules configured to allow requests)

Test again with only one library or only one public library.
Test again with no public libraries.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Jake Deery <jake.deery@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 20 Marcel de Rooy 2024-10-08 13:35:16 UTC
Created attachment 172525 [details] [review]
Bug 36742: (follow-up) Add hidden branchcode input for OPAC article requests

This patch adds a hidden input containing the logged-in user's
branchcode to the article request form when there is only one public
branch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 21 Katrin Fischer 2024-10-11 10:14:33 UTC
It looks like this good a bit "broader" and now fixes more cases when there is only one public library. We should adapt the bug description.

I just fail to find the right words right now. Something about making the OPAC accounting for there only being one public library...
Comment 22 Katrin Fischer 2024-10-11 10:27:37 UTC
Pushed for 24.11!

Well done everyone, thank you!