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 <brendan@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described.
Signed-off-by: Mason James <mtj@kohaaloha.com>
This commit is contained in:
Jonathan Druart 2015-01-14 12:03:10 +01:00 committed by Mason James
parent 66c618f274
commit 6a51764a03
1 changed files with 26 additions and 9 deletions

View File

@ -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( {