From 034a76eebb0b7bee396cd8eed21bd73d552591eb Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 21 May 2021 09:09:53 +0200 Subject: [PATCH] Bug 28409: Simplify data validation Simplify the affectation then trust it. Signed-off-by: Victor Grousset/tuxayo JD Amended patch: remove duplicate comma Signed-off-by: Kyle M Hall Signed-off-by: Victor Grousset/tuxayo (cherry picked from commit 51a7c3c62e323e41983b7350cd8e62b42600e5cf) Signed-off-by: Wainui Witika-Park (cherry picked from commit 51a7c3c62e323e41983b7350cd8e62b42600e5cf) --- opac/opac-shelves.pl | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl index 3b10dfab52..861df234f4 100755 --- a/opac/opac-shelves.pl +++ b/opac/opac-shelves.pl @@ -61,13 +61,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ my $op = $query->param('op') || 'list'; my $referer = $query->param('referer') || $op; my $category = 1; -if ( $query->param('category') && ( - ($query->param('category') == 1) || - ($query->param('category') == 2) - ) - ){ - $category = $query->param('category'); -} +$category = 2 if $query->param('category') && $query->param('category') == 2; my ( $shelf, $shelfnumber, @messages ); @@ -96,7 +90,7 @@ if ( $op eq 'add_form' ) { $shelf = Koha::Virtualshelf->new( { shelfname => scalar $query->param('shelfname'), sortfield => scalar $query->param('sortfield'), - category => $category || 1, + category => $category, allow_change_from_owner => $allow_changes_from > 0, allow_change_from_others => $allow_changes_from == ANYONE, owner => scalar $loggedinuser, @@ -400,7 +394,7 @@ $template->param( referer => $referer, shelf => $shelf, messages => \@messages, - category => ($category == 1 || $category == 2) ? $category : "", + category => $category, print => scalar $query->param('print') || 0, listsview => 1, ); -- 2.39.5