X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fconfig%2Fconfig-process.cgi;h=6af7d2322606302914e4065c857adf636ffe666b;hp=3dcb1d3ef8be8ba0a753a62f1583d65f52bfb4c9;hb=4fd1280540e2c9b90fa59c0c32d691f5222f65d4;hpb=fb4ab1073f0d15d660c6cdc4e07afebf68ef3924 diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index 3dcb1d3ef..6af7d2322 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -47,7 +47,7 @@ ''; % } 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 { @@ -75,7 +75,7 @@ configCell.innerHTML = <% $value |js_string %>; % } elsif ( $type eq 'select-sub' && ! $i->multiple ) { configCell.innerHTML = - <% $conf->config($i->key, $agentnum) |js_string %> + ': ' + + <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' |js_string %> + ': ' + <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) |js_string %>; % } else { //alert('unknown type <% $type %>'); @@ -116,7 +116,7 @@ if ( $conf->exists('disable_settings_changes') ) { } } -$FS::Conf::DEBUG = 1; +#$FS::Conf::DEBUG = 1; my @config_items = grep { $_->key != ~/^invoice_(html|latex|template)/ } $conf->config_items; my %confitems = map { $_->key => $_ } $conf->config_items; @@ -155,7 +155,9 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { } } elsif ( $type eq 'checkbox' ) { if ( defined $cgi->param($i->key.$n) ) { - push @touch, $i->key; + my $error = &{$i->validate}('', $n) if $i->validate; + push @error, $error if $error; + push @touch, $i->key if !$error; } else { push @delete, $i->key; } @@ -164,10 +166,10 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { or ( $type =~ /^select(-(sub|part_svc|part_pkg|pkg_class|agent))?$/ || $i->multiple ) ) { - if ( scalar(@{[ $cgi->param($i->key.$n) ]}) ) { + if ( scalar(@{[ $cgi->param($i->key.$n) ]}) && $cgi->param($i->key.$n) ne '' ) { my $error = &{$i->validate}([ $cgi->param($i->key.$n) ], $n) if $i->validate; push @error, $error if $error; - $conf->set($i->key, join("\n", @{[ $cgi->param($i->key.$n) ]} ), $agentnum); + $conf->set($i->key, join("\n", @{[ $cgi->param($i->key.$n) ]} ), $agentnum) if !$error; } else { $conf->delete($i->key, $agentnum); } @@ -184,7 +186,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));