Bug 7180: (follow-up) reset statistic values on reloading the page

On the "Default accounting details", if a dropdown list was created for
a statistic value, on reloading the page it still exist. It should not
given the fund value is reset.

The CGIsort variable is useless and can be remove: the dropdown list
is generated using the ajax call.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Jonathan Druart 2014-04-23 09:56:26 +02:00 committed by Galen Charlton
parent dee6710fc8
commit 953c9d511b
2 changed files with 6 additions and 61 deletions

View file

@ -311,37 +311,6 @@ foreach my $r ( @{$budgets_hierarchy} ) {
}
$template->param( budget_loop => $budget_loop,);
my $CGIsort1;
if ($budget) { # its a mod ..
if ( defined $budget->{'sort1_authcat'} ) { # with custom Asort* planning values
$CGIsort1 = GetAuthvalueDropbox( $budget->{'sort1_authcat'}, $data->{'sort1'} );
}
} elsif ( scalar(@$budgets) ) {
} elsif ( scalar(@$budgets_hierarchy) ) {
$CGIsort1 = GetAuthvalueDropbox( @$budgets_hierarchy[0]->{'sort1_authcat'}, '' );
}
# if CGIsort is successfully fetched, the use it
# else - failback to plain input-field
if ($CGIsort1) {
$template->param( CGIsort1 => $CGIsort1 );
} else {
$template->param( sort1 => $data->{'sort1'} );
}
my $CGIsort2;
if ($budget) {
if ( defined $budget->{'sort2_authcat'} ) {
$CGIsort2 = GetAuthvalueDropbox( $budget->{'sort2_authcat'}, $data->{'sort2'} );
}
} elsif ( scalar(@$budgets_hierarchy) ) {
$CGIsort2 = GetAuthvalueDropbox( @$budgets_hierarchy[0]->{sort2_authcat}, '' );
}
if ($CGIsort2) {
$template->param( CGIsort2 => $CGIsort2 );
} else {
$template->param( sort2 => $data->{'sort2'} );
}
output_html_with_http_headers $input, $cookie, $template->output;

View file

@ -65,6 +65,8 @@
$(this).parent().siblings('li').find('input[name="sort2"]').attr('name', 'all_sort2');
} );
$("select[name='all_budget_id']").change();
$("#records_to_import fieldset.rows ol").hide();
$('input:checkbox[name="import_record_id"]').change(function(){
var container = $(this).parents("fieldset");
@ -316,38 +318,12 @@
</li>
<li>
<div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
<label for="sort1">Statistic 1: </label>
[% IF CGIsort1 %]
<select id="all_sort1" size="1" name="all_sort1">
[% FOREACH sort_opt IN CGIsort1 %]
[% IF sort_opt.default %]
<option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
[% ELSE %]
<option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
[% END %]
[% END %]
</select>
[% ELSE %]
<input type="text" id="all_sort1" size="20" name="all_sort1" value="[% sort1 %]" />
[% END %]
<label for="all_sort1">Statistic 1: </label>
<input type="text" id="all_sort1" size="20" name="all_sort1" value="" />
</li>
<li>
<span id="sort2_zone">
<label for="sort2">Statistic 2: </label>
[% IF CGIsort2 %]
<select id="all_sort2" size="1" name="all_sort1">
[% FOREACH sort_opt IN CGIsort2 %]
[% IF sort_opt.default %]
<option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
[% ELSE %]
<option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
[% END %]
[% END %]
</select>
[% ELSE %]
<input type="text" id="all_sort2" size="20" name="all_sort2" value="[% sort2 %]" />
[% END %]
</span>
<label for="all_sort2">Statistic 2: </label>
<input type="text" id="all_sort2" size="20" name="all_sort2" value="" />
</li>
</ol>
</fieldset>