From db12b9f8fcdf32157d5f283d7b9ba2a29c90894d Mon Sep 17 00:00:00 2001 From: Wainui Witika-Park Date: Sun, 27 Jun 2021 04:15:31 +0000 Subject: [PATCH] Revert "Bug 28409: Simplify data validation" This reverts commit 034a76eebb0b7bee396cd8eed21bd73d552591eb. --- opac/opac-shelves.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl index 861df234f4..3b10dfab52 100755 --- a/opac/opac-shelves.pl +++ b/opac/opac-shelves.pl @@ -61,7 +61,13 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ my $op = $query->param('op') || 'list'; my $referer = $query->param('referer') || $op; my $category = 1; -$category = 2 if $query->param('category') && $query->param('category') == 2; +if ( $query->param('category') && ( + ($query->param('category') == 1) || + ($query->param('category') == 2) + ) + ){ + $category = $query->param('category'); +} my ( $shelf, $shelfnumber, @messages ); @@ -90,7 +96,7 @@ if ( $op eq 'add_form' ) { $shelf = Koha::Virtualshelf->new( { shelfname => scalar $query->param('shelfname'), sortfield => scalar $query->param('sortfield'), - category => $category, + category => $category || 1, allow_change_from_owner => $allow_changes_from > 0, allow_change_from_others => $allow_changes_from == ANYONE, owner => scalar $loggedinuser, @@ -394,7 +400,7 @@ $template->param( referer => $referer, shelf => $shelf, messages => \@messages, - category => $category, + category => ($category == 1 || $category == 2) ? $category : "", print => scalar $query->param('print') || 0, listsview => 1, ); -- 2.39.5