diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-05-02 13:33:14 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-05-02 13:33:14 -0700 |
commit | 14b88fec3eb275ae5339bb7ad1d72bdb333454c0 (patch) | |
tree | 95751010b92d8d8f3cc47401080d9a10306a7eb8 /httemplate | |
parent | b3f48204012dd722912dcb3703908bd1eaf6df7b (diff) |
allow agent override to NO of global payment_receipt set to YES, RT#17468
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/config/config-process.cgi | 4 | ||||
-rw-r--r-- | httemplate/config/config-view.cgi | 2 | ||||
-rw-r--r-- | httemplate/config/config.cgi | 39 |
3 files changed, 33 insertions, 12 deletions
diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index 3dcb1d3ef..f1cbb1831 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -47,7 +47,7 @@ '</pre></font>'; % } elsif ( $type eq 'checkbox' ) { -% if ( $conf->exists($i->key, $agentnum) ) { +% if ( $conf->config_bool($i->key, $agentnum) ) { configCell.style.backgroundColor = '#00ff00'; configCell.innerHTML = 'YES'; % } else { @@ -184,7 +184,7 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { } # warn @touch; $conf->touch($_, $agentnum) foreach @touch; -$conf->delete($_, $agentnum) foreach @delete; +$conf->delete_bool($_, $agentnum) foreach @delete; if (scalar(@error)) { $cgi->param('error', join(' ', @error)); diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 02acd5853..02a24adbf 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -211,7 +211,7 @@ invoice language options: % } elsif ( $type eq 'checkbox' ) { <tr> - <td id="<% $agentnum.$i->key.$n %>" bgcolor="#<% $conf->exists($i->key, $agentnum) ? '00ff00">YES' : 'ff0000">NO' %></td> + <td id="<% $agentnum.$i->key.$n %>" bgcolor="#<% $conf->config_bool($i->key, $agentnum) ? '00ff00">YES' : 'ff0000">NO' %></td> </tr> % } elsif ( $type eq 'select' && $i->select_hash ) { diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi index 6a1eaecf7..a4f9890a5 100644 --- a/httemplate/config/config.cgi +++ b/httemplate/config/config.cgi @@ -40,12 +40,14 @@ Setting <b><% $key %></b> <table><tr><td> % my $n = 0; +% my $submit = 0; % foreach my $type (@types) { % if ( $type eq '' ) { <font color="#ff0000">no type</font> % } elsif ( $type eq 'image' ) { +% $submit++; <% $conf->exists($key, $agentnum) ? 'Current image<br>'. @@ -59,24 +61,37 @@ Setting <b><% $key %></b> New image filename <input type="file" name="<% "$key$n" %>"> % } elsif ( $type eq 'binary' ) { +% $submit++; Filename <input type="file" name="<% "$key$n" %>"> % } elsif ( $type eq 'textarea' ) { +% $submit++; <textarea name="<% "$key$n" %>" rows=12 cols=78 wrap="off"><% join("\n", $conf->config($key, $agentnum)) |h %></textarea> % } elsif ( $type eq 'checkbox' ) { +% +% if ( $agentnum && $conf->exists($key) && ! $agent_bool ) { - <input name="<% "$key$n" %>" type="checkbox" value="1" - <% $conf->exists($key, $agentnum) ? 'CHECKED' : '' %> > + <input name="<% "$key$n" %>" type="checkbox" value="1" CHECKED DISABLED> + <FONT SIZE="-1"><I>(global setting cannot yet be overridden)</I></FONT> -% } elsif ( $type eq 'text' ) { +% } else { +% $submit++; - <input name="<% "$key$n" %>" type="text" value="<% $conf->exists($key, $agentnum) ? $conf->config($key, $agentnum) : '' |h %>"> + <input name="<% "$key$n" %>" type="checkbox" value="1" + <% $conf->config_bool($key, $agentnum) ? 'CHECKED' : '' %> > +% } -% } elsif ( $type eq 'select' || $type eq 'selectmultiple' ) { +% } elsif ( $type eq 'text' ) { +% $submit++; + <input name="<% "$key$n" %>" type="text" value="<% $conf->exists($key, $agentnum) ? $conf->config($key, $agentnum) : '' |h %>"> + +% } elsif ( $type eq 'select' || $type eq 'selectmultiple' ) { +% $submit++; + <select name="<% "$key$n" %>" <% $type eq 'selectmultiple' ? 'MULTIPLE' : '' %>> % @@ -131,7 +146,8 @@ Setting <b><% $key %></b> </select> -% } elsif ( $type eq 'select-sub' ) { +% } elsif ( $type eq 'select-sub' ) { +% $submit++; <select name="<% "$key$n" %>" <% $config_item->multiple ? 'MULTIPLE' : '' %>> @@ -167,8 +183,8 @@ Setting <b><% $key %></b> </select> -% } elsif ( $type eq 'editlist' ) { -% +% } elsif ( $type eq 'editlist' ) { +% $submit++; <script> function doremove<% "$key$n" %>() { fromObject = document.OneTrueForm.<% "$key$n" %>; @@ -284,6 +300,7 @@ Setting <b><% $key %></b> </tr></table> % } elsif ( $element_types{$type} ) { +% $submit++; % % my %opt = ( 'element_name' => "$key$n", % 'empty_label' => ' ', @@ -313,7 +330,10 @@ Setting <b><% $key %></b> % } </tr> </table> -<INPUT TYPE="submit" VALUE="<% $title %>"> + +% if ( $submit ) { + <INPUT TYPE="submit" VALUE="<% $title %>"> +% } </FORM> </BODY> @@ -365,5 +385,6 @@ my $config_item = $confitems{$key}; my $description = $config_item->description; my $config_type = $config_item->type; my @types = ref($config_type) ? @$config_type : ($config_type); +my $agent_bool = $config_item->agent_bool; </%init> |