1 % unless ( $opt{'js_only'} ) {
3 <INPUT TYPE="hidden" NAME="<%$name%>" ID="<%$id%>" VALUE="<%$curr_value%>">
5 <% include( 'select.html',
6 'field' => $name.'_action',
8 'options' => \@actions,
9 'curr_value' => $action,
10 'labels' => { '' => 'Select Action' },
11 'onchange' => $name.'_changed',
12 'style' => 'vertical-align:top',
16 <TEXTAREA NAME = "<% $name %>_params"
17 ID = "<% $id %>_params"
23 ><% scalar($cgi->param($name.'_params')) || $cgp_rule_action->params |h %></TEXTAREA>
26 % unless ( $opt{'html_only'} || $opt{'js_only'} ) {
27 <SCRIPT TYPE="text/javascript">
29 % unless ( $opt{'html_only'} ) {
31 function <% $name %>_changed(what) {
33 <% $opt{'onchange'} %>
35 var <% $name %>_value = what.options[what.selectedIndex].value;
37 var params_Element = what.form.<% $name %>_params;
39 // if bool, hide/disable _op and _params entirely
40 if ( <%$name%>_value == '' || <%$name%>_value == 'Stop Processing' || <%$name%>_value == 'Discard' ) {
41 params_Element.disabled = true;
42 params_Element.style.visibility = "hidden";
44 params_Element.disabled = false;
45 params_Element.style.visibility = "visible";
52 % unless ( $opt{'html_only'} || $opt{'js_only'} ) {
60 #generic http://www.communigate.com/CommunigatePro/Rules.html#Actions
68 #email http://www.communigate.com/CommunigatePro/QueueRules.html#Actions
83 'Copy attachments into',
89 my %noparam = ( map { $_=>1 } '', 'Stop Processing', 'Discard' );
96 my $name = $opt{'element_name'} || $opt{'field'} || 'ruleactionnum';
97 #my $id = $opt{'id'} || 'contactnum';
98 my $id = $opt{'id'} || $opt{'field'} || 'ruleactionnum';
100 my $curr_value = $opt{'curr_value'} || $opt{'value'};
104 $cgp_rule_action = qsearchs('cgp_rule_action',
105 { 'ruleactionnum' => $curr_value } );
107 $cgp_rule_action = new FS::cgp_rule_action {};
110 my $action = scalar($cgi->param($name.'_action'))
111 || $cgp_rule_action->action;
113 my $disabled = $noparam{$action} ? 'DISABLED' : '';
114 my $style = $disabled ? 'STYLE="visibility:hidden"' : '';