Browse Source

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>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
new_12478_elasticsearch
Jonathan Druart 8 years ago
committed by Brendan Gallagher
parent
commit
d6329e4f96
  1. 14
      opac/opac-shelves.pl
  2. 14
      virtualshelves/shelves.pl

14
opac/opac-shelves.pl

@ -72,13 +72,13 @@ if ( $op eq 'add_form' ) {
if ( $loggedinuser ) {
eval {
$shelf = Koha::Virtualshelf->new(
{ shelfname => $query->param('shelfname'),
sortfield => $query->param('sortfield'),
category => $query->param('category') || 1,
allow_add => $query->param('allow_add'),
allow_delete_own => $query->param('allow_delete_own'),
allow_delete_other => $query->param('allow_delete_other'),
owner => $loggedinuser,
{ shelfname => scalar $query->param('shelfname'),
sortfield => scalar $query->param('sortfield'),
category => scalar $query->param('category') || 1,
allow_add => scalar $query->param('allow_add'),
allow_delete_own => scalar $query->param('allow_delete_own'),
allow_delete_other => scalar $query->param('allow_delete_other'),
owner => scalar $loggedinuser,
}
);
$shelf->store;

14
virtualshelves/shelves.pl

@ -65,13 +65,13 @@ if ( $op eq 'add_form' ) {
} elsif ( $op eq 'add' ) {
eval {
$shelf = Koha::Virtualshelf->new(
{ shelfname => $query->param('shelfname'),
sortfield => $query->param('sortfield'),
category => $query->param('category'),
allow_add => $query->param('allow_add'),
allow_delete_own => $query->param('allow_delete_own'),
allow_delete_other => $query->param('allow_delete_other'),
owner => $query->param('owner'),
{ shelfname => scalar $query->param('shelfname'),
sortfield => scalar $query->param('sortfield'),
category => scalar $query->param('category'),
allow_add => scalar $query->param('allow_add'),
allow_delete_own => scalar $query->param('allow_delete_own'),
allow_delete_other => scalar $query->param('allow_delete_other'),
owner => scalar $query->param('owner'),
}
);
$shelf->store;

Loading…
Cancel
Save