From 6873aec01740ea7c70a5e20a3f3bce6e76bca410 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 30 Apr 2010 02:32:39 +0000 Subject: communigate (phase 2): rules: show conditions/actions on rule browse, fix rule edit for conditions and actions without op/param, fix rule edit stickiness on errors. RT#7514 --- httemplate/elements/select-cgp_rule_action.html | 8 +++++--- httemplate/elements/select-cgp_rule_condition.html | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'httemplate/elements') diff --git a/httemplate/elements/select-cgp_rule_action.html b/httemplate/elements/select-cgp_rule_action.html index 9ac930633..7cefdc4b5 100644 --- a/httemplate/elements/select-cgp_rule_action.html +++ b/httemplate/elements/select-cgp_rule_action.html @@ -6,8 +6,7 @@ 'field' => $name.'_action', 'id' => $id.'_action', 'options' => \@actions, - 'curr_value' => scalar($cgi->param($name.'_action')) - || $cgp_rule_action->action, + 'curr_value' => $action, 'labels' => { '' => 'Select Action' }, 'onchange' => $name.'_changed', 'style' => 'vertical-align:top', @@ -108,7 +107,10 @@ if ( $curr_value ) { $cgp_rule_action = new FS::cgp_rule_action {}; } -my $disabled = $noparam{$curr_value} ? 'DISABLED' : ''; +my $action = scalar($cgi->param($name.'_action')) + || $cgp_rule_action->action; + +my $disabled = $noparam{$action} ? 'DISABLED' : ''; my $style = $disabled ? 'STYLE="visibility:hidden"' : ''; diff --git a/httemplate/elements/select-cgp_rule_condition.html b/httemplate/elements/select-cgp_rule_condition.html index 0c305d916..622cbe86d 100644 --- a/httemplate/elements/select-cgp_rule_condition.html +++ b/httemplate/elements/select-cgp_rule_condition.html @@ -6,8 +6,7 @@ 'field' => $name.'_condition', 'id' => $id.'_condition', 'options' => \@conditions, - 'curr_value' => scalar($cgi->param($name.'_condition')) - || $cgp_rule_condition->condition, + 'curr_value' => $condition, 'labels' => { '' => 'Select Condition' }, 'onchange' => $name.'_changed', ) @@ -190,7 +189,10 @@ if ( $curr_value ) { $cgp_rule_condition = new FS::cgp_rule_condition {}; } -my @op = &$cond2op($curr_value); +my $condition = scalar($cgi->param($name.'_condition')) + || $cgp_rule_condition->condition; + +my @op = &$cond2op($condition); my $disabled = scalar(@op) ? '' : 1; my $style = $disabled ? 'visibility:hidden' : ''; -- cgit v1.2.1