Bug 21911 - Scoping OPACs by branch does not work with new library groups
Summary: Scoping OPACs by branch does not work with new library groups
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Target Milestone: ---
Assignee: Nick Clemens
QA Contact: Marcel de Rooy
URL:
Whiteboard:
Keywords:
Depends on: 21910
Blocks:
  Show dependency treegraph
 
Reported: 2018-11-29 14:17 UTC by Nick Clemens
Modified: 2018-12-19 13:34 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 21911: Fix OPAC scoping to work with new group system (3.22 KB, patch)
2018-11-29 14:22 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 21911: Fix OPAC scoping to work with new group system (3.28 KB, patch)
2018-11-29 15:40 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21911: Regression test (2.26 KB, patch)
2018-11-30 08:15 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 21911: Fix OPAC scoping to work with new group system (3.37 KB, patch)
2018-12-07 07:14 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 21911: Regression test (2.35 KB, patch)
2018-12-07 07:14 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 Nick Clemens 2018-11-29 14:17:27 UTC
Previously one could scope an OPAC to a specific library group using lines as below in the apache configuration:

    SetEnv OPAC_SEARCH_LIMIT branch:HCC_GROUP
    SetEnv OPAC_LIMIT_OVERRIDE 1
    RequestHeader add X-Koha-SetEnv "OPAC_SEARCH_LIMIT branch:HCC_GROUP"
    RequestHeader add X-Koha-SetEnv "OPAC_LIMIT_OVERRIDE 1"

This does not work with the new groups system as the groups do not have codes
Comment 1 Nick Clemens 2018-11-29 14:22:12 UTC
Created attachment 82743 [details] [review]
Bug 21911: Fix OPAC scoping to work with new group system

To test:

0 - Apply patch
1 - Create a library group enabled for opac search limits and add some
libraries
2 - Check the DB (or advanced search dropdown) to get the id of the
group (using 7 as example below)
3 - Add to apache configuration (OPAC virtualhost)
   SetEnv OPAC_SEARCH_LIMIT branch:multibranchlimit-7
   SetEnv OPAC_LIMIT_OVERRIDE 1
   RequestHeader add X-Koha-SetEnv "OPAC_SEARCH_LIMIT
   branch:multibranchlimit-7"
   RequestHeader add X-Koha-SetEnv "OPAC_LIMIT_OVERRIDE 1"
4 - Ensure OpacAddMastheadLibraryPulldown is disabled
5 - Restart all the things
6 - Visit the opac
7 - Perform a search, confirm it is scoped to the branches in the group
Comment 2 Martin Renvoize 2018-11-29 15:40:11 UTC
Created attachment 82754 [details] [review]
Bug 21911: Fix OPAC scoping to work with new group system

To test:

0 - Apply patch
1 - Create a library group enabled for opac search limits and add some
libraries
2 - Check the DB (or advanced search dropdown) to get the id of the
group (using 7 as example below)
3 - Add to apache configuration (OPAC virtualhost)
   SetEnv OPAC_SEARCH_LIMIT branch:multibranchlimit-7
   SetEnv OPAC_LIMIT_OVERRIDE 1
   RequestHeader add X-Koha-SetEnv "OPAC_SEARCH_LIMIT
   branch:multibranchlimit-7"
   RequestHeader add X-Koha-SetEnv "OPAC_LIMIT_OVERRIDE 1"
4 - Ensure OpacAddMastheadLibraryPulldown is disabled
5 - Restart all the things
6 - Visit the opac
7 - Perform a search, confirm it is scoped to the branches in the group

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 3 Martin Renvoize 2018-11-29 15:42:29 UTC
Works as expected, Signing off..

With my QA hat on, it would be lovely to have a regression test for this.
Comment 4 Josef Moravec 2018-11-30 08:15:30 UTC
Created attachment 82767 [details] [review]
Bug 21911: Regression test

This tests usuall cases, but note, that administrator could make a
branch with code "%%%" or so, which this test does not cover, and some
functionalities will not work in that case: opac limit override,
                holdinbranch facet
Comment 5 Josef Moravec 2018-11-30 08:20:07 UTC
The problem is a bit wider a think:

It is possible ta create a library with code "%%%" for example - it is weird, but you can do it.

Then this will not work again... even facets does not work with these kind of library codes....
Comment 6 Marcel de Rooy 2018-12-07 07:14:15 UTC
Created attachment 82949 [details] [review]
Bug 21911: Fix OPAC scoping to work with new group system

To test:

0 - Apply patch
1 - Create a library group enabled for opac search limits and add some
libraries
2 - Check the DB (or advanced search dropdown) to get the id of the
group (using 7 as example below)
3 - Add to apache configuration (OPAC virtualhost)
   SetEnv OPAC_SEARCH_LIMIT branch:multibranchlimit-7
   SetEnv OPAC_LIMIT_OVERRIDE 1
   RequestHeader add X-Koha-SetEnv "OPAC_SEARCH_LIMIT
   branch:multibranchlimit-7"
   RequestHeader add X-Koha-SetEnv "OPAC_LIMIT_OVERRIDE 1"
4 - Ensure OpacAddMastheadLibraryPulldown is disabled
5 - Restart all the things
6 - Visit the opac
7 - Perform a search, confirm it is scoped to the branches in the group

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 7 Marcel de Rooy 2018-12-07 07:14:20 UTC
Created attachment 82950 [details] [review]
Bug 21911: Regression test

This tests usuall cases, but note, that administrator could make a
branch with code "%%%" or so, which this test does not cover, and some
functionalities will not work in that case: opac limit override,
                holdinbranch facet

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Nick Clemens 2018-12-11 20:56:22 UTC
Awesome work all!

Pushed to master for 19.05
Comment 9 Martin Renvoize 2018-12-12 10:46:03 UTC
Pushed to 18.11.x for 18.11.01
Comment 10 Jesse Maseto 2018-12-18 19:24:39 UTC
Pushed to 18.05.x for 18.05.07
Comment 11 Fridolin SOMERS 2018-12-19 13:34:31 UTC
Depends on Bug 21910 not in 17.11.x