Bug 31654 - Hide non-public libraries from MastheadLibraryPulldown
Summary: Hide non-public libraries from MastheadLibraryPulldown
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Thomas Klausner
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
: 12242 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-09-29 14:14 UTC by Thomas Klausner
Modified: 2023-06-08 22:29 UTC (History)
7 users (show)

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


Attachments
do not list library in masthead and advanced search if branches.public is false (bug_31654_hide_nonpublic_libs) (2.28 KB, patch)
2022-09-30 11:34 UTC, Thomas Klausner
Details | Diff | Splinter Review
Bug 31654: Hide non-public libraries from MastheadLibraryPulldown (bug_31654_hide_nonpublic_libs) (3.32 KB, patch)
2022-10-05 10:15 UTC, Thomas Klausner
Details | Diff | Splinter Review
Bug 31654: Hide non-public libraries from MastheadLibraryPulldown (bug_31654_hide_nonpublic_libs) (3.37 KB, patch)
2022-10-24 14:09 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 31654: Hide non-public libraries from MastheadLibraryPulldown (bug_31654_hide_nonpublic_libs) (3.44 KB, patch)
2022-11-03 14:19 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 31654: (follow-up) Update hint (1.29 KB, patch)
2022-11-03 14:19 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Klausner 2022-09-29 14:14:32 UTC
We have a few internal libraries (branches) that are used by librarians, but should not be visible to "normal" patrons (mostly because they cannot access those books).

Currently there is no way to hide a library from the Masthead Pulldown or in the advanced search.

Bug 27360 introduced the flag branches.public. This could be used to also hide the library from MastheadPulldown and the AdvancedSearch List.

It seems that there is some additional / similar work going on in Bug 12242

Can we submit a patch that uses branches.public to hide libraries? Or should we wait what 27360 and 12242 will bring? Or can/should we also work on those tickets?
Comment 1 Thomas Klausner 2022-09-30 11:34:11 UTC
Created attachment 141123 [details] [review]
do not list library in masthead and advanced search if branches.public is false (bug_31654_hide_nonpublic_libs)
Comment 2 Thomas Klausner 2022-09-30 11:41:37 UTC
Test Plan:

* Set OpacAddMastheadLibraryPulldown to "Add"
* Go to Administration -> Libraries, edit "Fairfield", set "public" = "no" (at the end of the form)
* Or connect to DB and run
  update branches set public = 0 where branchcode like 'F%';
  This will set all three libraries starting with F to non-public
* open OPAC
* The "All libraries" Pulldown in the Header (between search slot and search button) still shows the non-public libraries
* Go to OPAC -> Advanced Search, scroll to "Location and availability": The selectbox still shows the non-public libraries

Now apply the patch

* Open OPAC
* The "All libraries" Pulldown in the Header now should not contain the libraries set to "public = no"
* And in the Advanced Search "Location and availability" pulldown those libraries should also not be shown.

Sponsored-by: Steiermärkische Landesbibliothek
Comment 3 David Cook 2022-10-03 22:43:25 UTC
This is something I'm interested in as well.

I don't have time for it this week, but I could probably test/QA it next week.
Comment 4 Lucas Gass (lukeg) 2022-10-04 22:44:52 UTC
Hey Thomas,

This will be a nice addition! There are a few problems with your patch:

 FAIL	koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
   FAIL	  forbidden patterns
		forbidden pattern: tab char (line 235)



* Commit title does not start with 'Bug XXXXX: ' - abec2a9a88


Can you make sure your commit title starts with "Bug 31654: " and have a look at the bad pattern in masthead.inc?
Comment 5 Katrin Fischer 2022-10-05 07:07:43 UTC
As you are just starting out: the QA tools script that points out these kind of errors can be run by everyone. On ktd it's just: 'qa -v 2'.
Comment 6 Thomas Klausner 2022-10-05 10:15:56 UTC
Created attachment 141335 [details] [review]
Bug 31654: Hide non-public libraries from MastheadLibraryPulldown (bug_31654_hide_nonpublic_libs)

Do not list library in masthead and advanced search if branches.public is false

Test Plan:

* Set OpacAddMastheadLibraryPulldown to "Add"
* Go to Administration -> Libraries, edit "Fairfield", set "public" = "no" (at the end of the form)
* Or connect to DB and run
  update branches set public = 0 where branchcode like 'F%';
  This will set all three libraries starting with F to non-public
* open OPAC
* The "All libraries" Pulldown in the Header (between search slot and search button) still shows the non-public libraries
* Go to OPAC -> Advanced Search, scroll to "Location and availability": The selectbox still shows the non-public libraries

Now apply the patch

* Open OPAC
* The "All libraries" Pulldown in the Header now should not contain the libraries set to "public = no"
* And in the Advanced Search "Location and availability" pulldown those libraries should also not be shown.

Sponsored-by: Steiermärkische Landesbibliothek
Comment 7 Thomas Klausner 2022-10-05 10:17:42 UTC
Hi Lucas!

I now fixed the problems with the patch and submitted a new one.

@Katrin Thanks for pointing out `qa-test-tools/koha-qa.pl` :-)

Greetings,
domm
Comment 8 Lucas Gass (lukeg) 2022-10-05 14:22:06 UTC
Awesome, thanks Thomas! I did notice two things, neither of which are your fault. 

1.  Should we update the hint on branches.tt which currently reads "Set to 'yes' to show this library on the Libraries page in the OPAC."

2. I cannot set branches to public via administration. I filed a seperate bug for this:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31688
Comment 9 David Nind 2022-10-14 18:55:32 UTC
A temporary work around to making libraries not public until bug 31785 is in master (fixes MySQL strict mode issues) is to use SQL: update branches set public=0 where branchcode = XXX;

Where XXX = code for library you want to make not public, such as CPL.
Comment 10 David Nind 2022-10-15 19:39:18 UTC
(In reply to David Nind from comment #9)
> A temporary work around to making libraries not public until bug 31785 is in
> master

This has now been pushed to master, so you should now be able to make a library not public.
Comment 11 Biblibre Sandboxes 2022-10-24 14:09:26 UTC
Created attachment 142514 [details] [review]
Bug 31654: Hide non-public libraries from MastheadLibraryPulldown (bug_31654_hide_nonpublic_libs)

Do not list library in masthead and advanced search if branches.public is false

Test Plan:

* Set OpacAddMastheadLibraryPulldown to "Add"
* Go to Administration -> Libraries, edit "Fairfield", set "public" = "no" (at the end of the form)
* Or connect to DB and run
  update branches set public = 0 where branchcode like 'F%';
  This will set all three libraries starting with F to non-public
* open OPAC
* The "All libraries" Pulldown in the Header (between search slot and search button) still shows the non-public libraries
* Go to OPAC -> Advanced Search, scroll to "Location and availability": The selectbox still shows the non-public libraries

Now apply the patch

* Open OPAC
* The "All libraries" Pulldown in the Header now should not contain the libraries set to "public = no"
* And in the Advanced Search "Location and availability" pulldown those libraries should also not be shown.

Sponsored-by: Steiermärkische Landesbibliothek

Signed-off-by: Claude <claude.demeure@mailo.com>
Comment 12 Martin Renvoize (ashimema) 2022-11-03 14:11:06 UTC
*** Bug 12242 has been marked as a duplicate of this bug. ***
Comment 13 Martin Renvoize (ashimema) 2022-11-03 14:19:37 UTC
Created attachment 143117 [details] [review]
Bug 31654: Hide non-public libraries from MastheadLibraryPulldown (bug_31654_hide_nonpublic_libs)

Do not list library in masthead and advanced search if branches.public is false

Test Plan:

* Set OpacAddMastheadLibraryPulldown to "Add"
* Go to Administration -> Libraries, edit "Fairfield", set "public" = "no" (at the end of the form)
* Or connect to DB and run
  update branches set public = 0 where branchcode like 'F%';
  This will set all three libraries starting with F to non-public
* open OPAC
* The "All libraries" Pulldown in the Header (between search slot and search button) still shows the non-public libraries
* Go to OPAC -> Advanced Search, scroll to "Location and availability": The selectbox still shows the non-public libraries

Now apply the patch

* Open OPAC
* The "All libraries" Pulldown in the Header now should not contain the libraries set to "public = no"
* And in the Advanced Search "Location and availability" pulldown those libraries should also not be shown.

Sponsored-by: Steiermärkische Landesbibliothek
Signed-off-by: Claude Demeure <claude.demeure@mailo.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 14 Martin Renvoize (ashimema) 2022-11-03 14:19:42 UTC
Created attachment 143118 [details] [review]
Bug 31654: (follow-up) Update hint

This patch updates the 'public' hint to include the additional
functionality we now tie to it.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 15 Martin Renvoize (ashimema) 2022-11-03 14:20:32 UTC
Great work, QA scripts are happy and I added the minor follow-up to clarify the hint when enabled/disabling the public option.

Passing QA
Comment 16 Tomás Cohen Arazi (tcohen) 2022-11-04 22:25:35 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!