X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fselect-cgp_rule_action.html;h=7cefdc4b53fe0da9471594381875d6539487edfc;hb=bfd03694e81b9bc09b24d288adde0a038fc93288;hp=25c3a25672b38891a78fa147c3ec2d47f251beb2;hpb=fa6176ab2df85c4b66026e9fe2a7242293d20ce5;p=freeside.git
diff --git a/httemplate/elements/select-cgp_rule_action.html b/httemplate/elements/select-cgp_rule_action.html
index 25c3a2567..7cefdc4b5 100644
--- a/httemplate/elements/select-cgp_rule_action.html
+++ b/httemplate/elements/select-cgp_rule_action.html
@@ -1,22 +1,58 @@
-%# XXX CSS to verticially align the select vs. the textarea
-<% include( 'select.html',
- %opt,
- 'options' => \@actions, #reverse order if we ever need to specify
- 'labels' => { '' => 'Select Action' },
- )
-%>
-
- >
-%# XXX curr value
-
-<%init>
+% unless ( $opt{'js_only'} ) {
-my %opt = @_;
+
+
+ <% include( 'select.html',
+ 'field' => $name.'_action',
+ 'id' => $id.'_action',
+ 'options' => \@actions,
+ 'curr_value' => $action,
+ 'labels' => { '' => 'Select Action' },
+ 'onchange' => $name.'_changed',
+ 'style' => 'vertical-align:top',
+ )
+ %>
+
+
+
+% }
+% unless ( $opt{'html_only'} || $opt{'js_only'} ) {
+
+% }
+<%once>
my @actions = (
'',
@@ -50,6 +86,31 @@ my @actions = (
'Accept Request',
);
-#XXX hmm, hide textarea w/Stop Processing,Discard like _condition.html
+my %noparam = ( map { $_=>1 } '', 'Stop Processing', 'Discard' );
+
+%once>
+<%init>
+
+my %opt = @_;
+
+my $name = $opt{'element_name'} || $opt{'field'} || 'ruleactionnum';
+#my $id = $opt{'id'} || 'contactnum';
+my $id = $opt{'id'} || $opt{'field'} || 'ruleactionnum';
+
+my $curr_value = $opt{'curr_value'} || $opt{'value'};
+
+my $cgp_rule_action;
+if ( $curr_value ) {
+ $cgp_rule_action = qsearchs('cgp_rule_action',
+ { 'ruleactionnum' => $curr_value } );
+} else {
+ $cgp_rule_action = new FS::cgp_rule_action {};
+}
+
+my $action = scalar($cgi->param($name.'_action'))
+ || $cgp_rule_action->action;
+
+my $disabled = $noparam{$action} ? 'DISABLED' : '';
+my $style = $disabled ? 'STYLE="visibility:hidden"' : '';
-%Init>
+%init>