Bug 18743

Summary: Filter suggestion lists correctly for IndependentBranches
Product: Koha Reporter: Séverine Queune <severine.queune>
Component: AcquisitionsAssignee: Alex Buckley <alexbuckley>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: alexbuckley, katrin.fischer
Version: master   
Hardware: All   
OS: All   
Whiteboard:
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 18743 - Partially working filter of suggestions by libraries
Bug 18743 - Removed library filter in Acquisition suggestions when IndependentBranches enabled
Bug 18743 - Removed library filter in Acquisition suggestions when IndependentBranches enabled
Bug 18743 - ALTERNATE: Take IndependantBranches syspref into account

Description Séverine Queune 2017-06-07 15:02:02 UTC
There should be an automatic filter on current site when working on the suggestion list ansd using the syspref IndependentBranches.
The filter in the last menu "Acquisition information" doesn't work, and the first option "Organize by" only sort them in the same tab.

It created a display bug when a librarian from the A library accepted/refused 2 suggestions for the B library and tried to change the site : these 2 suggestions now appear on the "OPAC Purchase suggestions" when there is no user logged.
Comment 1 Alex Buckley 2017-06-30 03:40:43 UTC Comment hidden (obsolete)
Comment 2 Alex Buckley 2017-06-30 21:20:32 UTC
Hi Severine 

I am working through making a patch for this bug report and just to clarify the issue I thought I would write this up:

When IndependentBranches is enabled then both the 'organise by', and 'Acquisition information' filters should not have a library option because only suggestions from the currently logged in library branch should be displayed. 

An additional bug I have found on the current master is:

When the IndependentBranches syspref is set to 'no' then only suggestions from the currently logged in branch are displayed.
For example if the staff member is logged into Fairfield branch then only suggestions submitted to Fairfield branch are displayed. 

This is incorrect because with IndependentBranches not enabled then the user should be able to see all suggestions from all library branches and this is when the 'Organise by' and 'Acquisition information' filters should have a library option.  

Whereas when IndependentBranches syspref is set to 'yes' then all suggestions from all library branches are displayed which is not correct. When IndependentBranches is set to true then only the suggestions from the currently logged in branch should be displayed. 

Regards 
Alex Buckley
Comment 3 Alex Buckley 2017-07-01 03:50:38 UTC Comment hidden (obsolete)
Comment 4 Alex Buckley 2017-07-03 05:27:01 UTC
Created attachment 64768 [details] [review]
Bug 18743 - Removed library filter in Acquisition suggestions when IndependentBranches enabled

Also ensured that when a superlibrarian is logged in then suggestions from
all branches are displayed with IndependentBranches being either on or off, as this
syspref does not affect what suggestions superlibrarians can see.

But when non-superlibrarian user with access to the acquisitions module
visits it when IndependentBranches is enabled then only suggestions of
the branch they are logged in with are displayed.

If non-superlibrarian users log in when IndependentBranches is not
enabled then suggestions from all branches are displayed.

Note: The library filter in the 'Organize by' area (which is displayed when multiple branches suggestions are displayed according to the aforementioned logic) successfully splits the suggestions into different tabs with the correct number of suggestions for each branch
displayed in each tab.

Test plan:
1. Relicate the bug described in description comment

2. Apply patch

3. Create 2 suggestions a library branch (which I will refer to in this
test plan as branch A)

4. Create 1 suggestion for a different branch (which I will refer to as
branch B)

5. Log into staff client as superlibrarian with either branch and ensure the
IndependentBranches syspref is set to 'yes'

6. Go to Acquisitions->Suggestions Management

7. Notice that suggestions from branch A and B are displayed

8. In the Organize by are click to filter by library and click go

9. Notice that one tab says <name of branch A> (2) whilst the other tab
says <name of branch B> (1) with each tab containing the relevant
suggestions to that branch

10. In the Acquisition information filter select branch A and then click
'Go' and notice that it successfully filters the results and shows 2
suggestions of branch A only

11. Now change the IndependentBranches syspref to 'no'

12. Repeat steps 6, 7, 8, 9, 10 noticing the same outcome in step 9 and
10

13. Log out and log back into staff client in branch A as a non-superlibrarian user
who has access to the Acquisitions module

14. Currently IndependentBranches is set to 'no' so go to
Acquisitions->Suggestions Management

15. Repeat steps 6, 7, 8, 9, 10 and notice the same outcome as step 9
and 10

16. Change IndependentBranches to 'yes'

17. Go to Acquisitions->Suggestions Management

18. Notice that only suggestions from branch A (the branch you are
logged in with) are displayed. This is because when IndependentBranches
is enabled non-superlibrarians do not need to see suggestions from other
branches

19. Also notice that there is no 'library' option in the 'Organized by'
area and there is no library filter in the acquisition information area. This is because only suggestions from the current branch are displayed and so organizing/filtering by library is redundant.

Sponsored-by: Catalyst IT
Comment 5 Katrin Fischer 2017-08-08 12:13:00 UTC
Hi Alex,

something seems not to be working quite right. What I have done:

1) Made 2 suggestions from the OPAC for Centerville and Fairfield. Centerville is my home library (turn on AllowPurchaseSuggestionBranchChoice)
2) Made 1 suggestion from the intranet for 'any' library
3) Checked that with independent branches off, I can see all 3 suggestions in "Pending"
4) Turned on IndependentBranches - no change in behaviour
5) Applied patch, restarted plack etc.
6) No matter how I 'organize by' I don't see any of the suggestions now, the page is always empty, no tabs shown.
Comment 6 David Bourgault 2017-10-19 18:06:39 UTC
Created attachment 68298 [details] [review]
Bug 18743 - ALTERNATE: Take IndependantBranches syspref into account

---
THIS IS AN ALTERNATE PATCH
I am submitting it here, because it covers less than Alex's patch, but does so in a simpler fashion.
APPLY ONLY THIS PATCH, OR THE OTHER, NOT BOTH.
---

Displays suggestions for all libraries when IndependantBranches is set to no, or user is Super librarian by adding a missing if statement.

TEST PLAN
[0] Apply patch
[1] Set IndependentBranches to 'Yes'.
[2] Create a suggestion with a user from branch A.
[3] As a superlibrarian, visit the suggestion page, you should see the suggestion.
[4] As staff from branch A, visit the sugg. page, you should see the suggestion.
[5] As staff from branch B, visit the sugg. pase, you should NOT see the suggestion.
[6] Set IndependentBranches to 'No'.
[7] Redo step 3-5. You should always see the suggestion.
[8] Sign-off.
[9] Have fun.
Comment 7 Katrin Fischer 2017-10-28 12:04:05 UTC
Hi David,

this does not seem to work really well yet. To test:
- Add a suggestion for A, B and any.
- Add a staff user with acq permissions from A.
- Activated independent branches.
- Verify that selecting the 'Any' option from the branches list you can still always see all suggestions.