diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl index 9e5736d45a..3b10dfab52 100755 --- a/opac/opac-shelves.pl +++ b/opac/opac-shelves.pl @@ -60,7 +60,15 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ my $op = $query->param('op') || 'list'; my $referer = $query->param('referer') || $op; -my $category = $query->param('category') || 1; +my $category = 1; +if ( $query->param('category') && ( + ($query->param('category') == 1) || + ($query->param('category') == 2) + ) + ){ + $category = $query->param('category'); +} + my ( $shelf, $shelfnumber, @messages ); if ( $op eq 'add_form' ) { @@ -88,7 +96,7 @@ if ( $op eq 'add_form' ) { $shelf = Koha::Virtualshelf->new( { shelfname => scalar $query->param('shelfname'), sortfield => scalar $query->param('sortfield'), - category => scalar $query->param('category') || 1, + category => $category || 1, allow_change_from_owner => $allow_changes_from > 0, allow_change_from_others => $allow_changes_from == ANYONE, owner => scalar $loggedinuser, @@ -122,7 +130,7 @@ if ( $op eq 'add_form' ) { my $allow_changes_from = $query->param('allow_changes_from'); $shelf->allow_change_from_owner( $allow_changes_from > 0 ); $shelf->allow_change_from_others( $allow_changes_from == ANYONE ); - $shelf->category( scalar $query->param('category') ); + $shelf->category( $category ); eval { $shelf->store }; if ($@) {