projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Email::Sender::Transport::SMTP::TLS no longer needed
[freeside.git]
/
httemplate
/
config
/
config-process.cgi
diff --git
a/httemplate/config/config-process.cgi
b/httemplate/config/config-process.cgi
index
4e1c85a
..
6af7d23
100644
(file)
--- a/
httemplate/config/config-process.cgi
+++ b/
httemplate/config/config-process.cgi
@@
-25,7
+25,7
@@
% }
%
%} else {
% }
%
%} else {
-<
% header('Configuration set') %
>
+<
& /elements/header-popup.html, 'Configuration set' &
>
<SCRIPT TYPE="text/javascript">
% my $n = 0;
% foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
<SCRIPT TYPE="text/javascript">
% my $n = 0;
% foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
@@
-47,7
+47,7
@@
'</pre></font>';
% } elsif ( $type eq 'checkbox' ) {
'</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 {
configCell.style.backgroundColor = '#00ff00';
configCell.innerHTML = 'YES';
% } else {
@@
-65,7
+65,7
@@
% } elsif ( $type eq 'text' || $type eq 'select' ) {
configCell.innerHTML = <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' |js_string %>;
% } elsif ( $type eq 'text' || $type eq 'select' ) {
configCell.innerHTML = <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' |js_string %>;
-% } elsif ( $type =~ /^select-(part_svc|part_pkg|pkg_class)$/ && ! $i->multiple ) {
+% } elsif ( $type =~ /^select-(part_svc|part_pkg|pkg_class
|agent
)$/ && ! $i->multiple ) {
% my $table = $1;
% my $namecol = $namecol{$table};
% my $pkey = dbdef->table($table)->primary_key;
% my $table = $1;
% my $namecol = $namecol{$table};
% my $pkey = dbdef->table($table)->primary_key;
@@
-75,7
+75,7
@@
configCell.innerHTML = <% $value |js_string %>;
% } elsif ( $type eq 'select-sub' && ! $i->multiple ) {
configCell.innerHTML =
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 %>');
<% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) |js_string %>;
% } else {
//alert('unknown type <% $type %>');
@@
-95,6
+95,7
@@
my %namecol = (
'part_svc' => 'svc',
'part_pkg' => 'pkg',
'pkg_class' => 'classname',
'part_svc' => 'svc',
'part_pkg' => 'pkg',
'pkg_class' => 'classname',
+ 'agent' => 'agent',
);
</%once>
<%init>
);
</%once>
<%init>
@@
-102,7
+103,9
@@
my %namecol = (
my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied\n" unless $curuser->access_right('Configuration');
my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied\n" unless $curuser->access_right('Configuration');
-my $conf = new FS::Conf;
+my $locale = $cgi->param('locale') || '';
+
+my $conf = new FS::Conf { 'locale' => $locale };
if ( $conf->exists('disable_settings_changes') ) {
my @changers = split(/\s*,\s*/, $conf->config('disable_settings_changes'));
if ( $conf->exists('disable_settings_changes') ) {
my @changers = split(/\s*,\s*/, $conf->config('disable_settings_changes'));
@@
-113,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;
my @config_items = grep { $_->key != ~/^invoice_(html|latex|template)/ }
$conf->config_items;
my %confitems = map { $_->key => $_ } $conf->config_items;
@@
-152,23
+155,25
@@
foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
}
} elsif ( $type eq 'checkbox' ) {
if ( defined $cgi->param($i->key.$n) ) {
}
} 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;
}
} elsif (
$type =~ /^(editlist|selectmultiple)$/
} else {
push @delete, $i->key;
}
} elsif (
$type =~ /^(editlist|selectmultiple)$/
- or ( $type =~ /^select(-(sub|part_svc|part_pkg|pkg_class))?$/
+ or ( $type =~ /^select(-(sub|part_svc|part_pkg|pkg_class
|agent
))?$/
|| $i->multiple )
) {
|| $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;
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);
}
} else {
$conf->delete($i->key, $agentnum);
}
- } elsif ( $type =~ /^(text|select(-(sub|part_svc|part_pkg|pkg_class))?)$/ ) {
+ } elsif ( $type =~ /^(text|select(-(sub|part_svc|part_pkg|pkg_class
|agent
))?)$/ ) {
if ( $cgi->param($i->key.$n) ne '' ) {
my $error = &{$i->validate}($cgi->param($i->key.$n), $n) if $i->validate;
push @error, $error if $error;
if ( $cgi->param($i->key.$n) ne '' ) {
my $error = &{$i->validate}($cgi->param($i->key.$n), $n) if $i->validate;
push @error, $error if $error;
@@
-181,7
+186,7
@@
foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
}
# warn @touch;
$conf->touch($_, $agentnum) foreach @touch;
}
# 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));
if (scalar(@error)) {
$cgi->param('error', join(' ', @error));