From fe986573dd6a6b10dc0456be2609ee29cb459ac8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 14 Jan 2015 12:03:10 +0100 Subject: [PATCH] Bug 13578: Make sure the 'public' parameter is passed to the last step If no caching system is up ($usecache == 0), the public parameter is lost on the step 3. The hash passed to the template looks like: 'cache_expiry', 300, 'cache_expiry_units', 'public', 1 So the template receives cache_expiry = 300, cache_expiry_units = 'public' and 1 = undef. This patch fixes the problem passing the cache_expiry* parameters only if the usecache is set. Test plan: 0/ Disable any caching system 1/ Create a new public report and go up to the 6th step, save the report and verify the report is created as public 2/ Enable a caching system 2/ Create a public report with a cache expiry value, save it and verify the report is created as public and the cache expiry value is correct. Signed-off-by: Brendan Gallagher Signed-off-by: Katrin Fischer Works as described. Signed-off-by: Tomas Cohen Arazi --- reports/guided_reports.pl | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index 9b09ac0e81..a3009b2062 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -215,8 +215,6 @@ elsif ( $phase eq 'Update SQL'){ 'group' => $group, 'subgroup' => $subgroup, 'notes' => $notes, - 'cache_expiry' => $cache_expiry, - 'cache_expiry_units' => $cache_expiry_units, 'public' => $public, 'problematic_authvals' => $problematic_authvals, 'warn_authval_problem' => 1, @@ -231,7 +229,6 @@ elsif ( $phase eq 'Update SQL'){ group => $group, subgroup => $subgroup, notes => $notes, - cache_expiry => $cache_expiry, public => $public, } ); $template->param( @@ -240,6 +237,12 @@ elsif ( $phase eq 'Update SQL'){ 'id' => $id, ); } + if ( $usecache ) { + $template->param( + cache_expiry => $cache_expiry, + cache_expiry_units => $cache_expiry_units, + ); + } } } @@ -312,6 +315,7 @@ elsif ( $phase eq 'Choose these columns' ) { my $type = $input->param('type'); my @columns = $input->param('columns'); my $column = join( ',', @columns ); + $template->param( 'build4' => 1, 'area' => $area, @@ -319,10 +323,15 @@ elsif ( $phase eq 'Choose these columns' ) { 'column' => $column, definitions => get_from_dictionary($area), criteria => get_criteria($area,$input), - 'cache_expiry' => $input->param('cache_expiry'), - 'cache_expiry_units' => $input->param('cache_expiry_units'), 'public' => $input->param('public'), ); + if ( $usecache ) { + $template->param( + cache_expiry => $input->param('cache_expiry'), + cache_expiry_units => $input->param('cache_expiry_units'), + ); + } + } elsif ( $phase eq 'Choose these criteria' ) { @@ -373,10 +382,14 @@ elsif ( $phase eq 'Choose these criteria' ) { 'column' => $column, 'definition' => $definition, 'criteriastring' => $query_criteria, - 'cache_expiry' => $input->param('cache_expiry'), - 'cache_expiry_units' => $input->param('cache_expiry_units'), 'public' => $input->param('public'), ); + if ( $usecache ) { + $template->param( + cache_expiry => $input->param('cache_expiry'), + cache_expiry_units => $input->param('cache_expiry_units'), + ); + } # get columns my @columns = split( ',', $column ); @@ -555,13 +568,17 @@ elsif ( $phase eq 'Save Report' ) { 'reportname' => $name, 'type' => $type, 'notes' => $notes, - 'cache_expiry' => $cache_expiry, - 'cache_expiry_units' => $cache_expiry_units, 'public' => $public, 'problematic_authvals' => $problematic_authvals, 'warn_authval_problem' => 1, 'phase_save' => 1 ); + if ( $usecache ) { + $template->param( + cache_expiry => $cache_expiry, + cache_expiry_units => $cache_expiry_units, + ); + } } else { # No params problem found or asked to save anyway my $id = save_report( { -- 2.39.5