From 5768b26e5c201e42cb71a741c15aaa82f800fb92 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 9 Dec 2017 19:20:21 +0000 Subject: [PATCH] fix defaults for module_options --- lib/App/Netdisco/Web/Report.pm | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/App/Netdisco/Web/Report.pm b/lib/App/Netdisco/Web/Report.pm index 740cd950..bf48d73b 100644 --- a/lib/App/Netdisco/Web/Report.pm +++ b/lib/App/Netdisco/Web/Report.pm @@ -18,13 +18,8 @@ get '/report/*' => require_login sub { $class_list = [ schema('netdisco')->resultset('DeviceModule') ->get_distinct_col('class') ]; - # this is a bit fragile... three params currently - my %params = request->params(); - if (3 == scalar keys %params) { - foreach my $col ( @{ var('module_options') } ) { - next unless $col->{default} eq 'on'; - $params{ $col->{name} } = 'checked'; - } + foreach my $col ( @{ var('module_options') } ) { + params->{$col->{name}} = 'checked' if $col->{default} eq 'on'; } } elsif ( $tag eq 'portssid' ) {