Bug 15810

Summary: Can't create private lists if OpacAllowPublicListCreation is set to 'not allow'
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: ListsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: brendan, julian.maurice, kyle, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15809
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 15811    
Attachments: Bug 15810: Make sure the CGI->param is not called in a list context when creating private shelves
[SIGNED OFF] Bug 15810: Make sure the CGI->param is not called in a list context when creating private shelves
Bug 15810: Make sure the CGI->param is not called in a list context when creating private shelves

Description Katrin Fischer 2016-02-12 14:22:44 UTC
If you try to create a private list from the OPAC and the OpacAllowPublicListCreation is set to 'not allow' public lists to be created by the patron, an error occurs:

Koha::Schema::Result::Virtualshelve at  /usr/share/koha/lib/Koha/Object.pm line
Comment 1 Jonathan Druart 2016-02-12 14:38:34 UTC Comment hidden (obsolete)
Comment 2 Katrin Fischer 2016-02-12 14:50:13 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall 2016-02-19 12:31:41 UTC
I cannot re-create this bug. Is the test plan incomplete, or has this been fixed in master incidentally?
Comment 4 Katrin Fischer 2016-02-19 12:34:41 UTC
We have tested this on 3.22.3 - there it's definitely a problem. 
Have you set the system preference? It will hide several options from the form.
Comment 5 Kyle M Hall 2016-02-19 12:36:22 UTC
(In reply to Katrin Fischer from comment #4)
> We have tested this on 3.22.3 - there it's definitely a problem. 
> Have you set the system preference? It will hide several options from the
> form.

Yes, I enabled the syspref which made "private" the only list option available. Can you confirm you can recreate the bug on master?
Comment 6 Katrin Fischer 2016-02-19 12:37:47 UTC
Sorry - can't check right now, will try later.
Comment 7 Kyle M Hall 2016-02-19 13:43:56 UTC
(In reply to Katrin Fischer from comment #6)
> Sorry - can't check right now, will try later.

Confirmed the bug. I was looking in the wrong place ; )
Comment 8 Katrin Fischer 2016-02-19 13:49:10 UTC
Yay! something off the to-do list :)
Comment 9 Kyle M Hall 2016-02-19 13:53:54 UTC
Created attachment 48232 [details] [review]
Bug 15810: Make sure the CGI->param is not called in a list context when creating private shelves

This patch fixes the following bug:
If OpacAllowPublicListCreation is set to "not allow", the creation of a
private list raises an error at the OPAC.

CGI->param is called in a list context and some parameters are not
filled from the template if the pref is set to "not allow".
To make sure we don't have a "Odd number of elements in anonymous hash",
we force the context to scalar.

Test plan:
1/ Set OpacAllowPublicListCreation to "not allow"
2/ Create private and public lists at the OPAC and the intranet
=> Everything should work fine with this patch applied

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 10 Brendan Gallagher 2016-02-22 20:33:09 UTC
pushed to master - should be in the may 2016 release. thanks
Comment 11 Julian Maurice 2016-02-26 09:58:58 UTC
Patch pushed to 3.22.x, will be in 3.22.4