Fix bool settings handling
This commit is contained in:
parent
599ed8986e
commit
3ca378f3e0
|
@ -204,8 +204,7 @@ sub get_user_prop{
|
|||
|
||||
sub get_user_bool{
|
||||
my ($self, $field) = @_;
|
||||
my $val = $self->get_user_prop($self, $field);
|
||||
$val = $defaults{$field} if ($val eq '');
|
||||
my $val = $a->get($self->{cgi}->param('acctName'))->prop("$field") || $defaults{$field} || '';
|
||||
return ($val =~ m/^yes|enabled|1|on$/) ? 'enabled' : 'disabled';
|
||||
}
|
||||
|
||||
|
@ -216,8 +215,7 @@ sub get_conf_prop{
|
|||
|
||||
sub get_conf_bool{
|
||||
my ($self, $field) = @_;
|
||||
my $val = $self->get_conf_prop($self, $field);
|
||||
$val = $defaults{$field} if ($val eq '');
|
||||
my $val = $c->get('ExpireAccounts')->prop($field) || $defaults{$field} || '';
|
||||
return ($val =~ m/^yes|enabled|1|on$/) ? 'enabled' : 'disabled';
|
||||
}
|
||||
|
||||
|
@ -241,7 +239,7 @@ sub modify_config{
|
|||
my ($self) = @_;
|
||||
my $rec = $c->get('ExpireAccounts') || $c->new_record('ExpireAccounts', { type => 'service' });
|
||||
my %new_props = ();
|
||||
foreach my $prop (qw(WarningDelay DaysBetweenWarnings WarningRecipient)){
|
||||
foreach my $prop (qw(WarningDelay DaysBetweenWarnings WarningRecipient WarnUsers)){
|
||||
if (!$self->{cgi}->param($prop) || $self->{cgi}->param($prop) eq ''){
|
||||
$rec->delete_prop($prop);
|
||||
}
|
||||
|
@ -249,10 +247,6 @@ sub modify_config{
|
|||
$new_props{$prop} = $self->{cgi}->param($prop);
|
||||
}
|
||||
}
|
||||
# Bool props
|
||||
foreach my $prop (qw(WarnUsers)){
|
||||
$new_props{$prop} = ($self->{cgi}->param($prop)) ? 'enabled' : 'disabled';
|
||||
}
|
||||
$rec->merge_props(%new_props);
|
||||
$self->success('CONFIG_MODIFIED');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue