Fix bool settings handling

tags/smeserver-expire-accounts-0.1.7-1
Daniel Berteaud 9 years ago
parent 599ed8986e
commit 3ca378f3e0
  1. 12
      root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/expireaccounts.pm

@ -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…
Cancel
Save