From 3ca378f3e000b39c33b3d6747c75d3c359108ffb Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 2 Mar 2016 09:24:50 +0100 Subject: [PATCH] Fix bool settings handling --- .../vendor_perl/esmith/FormMagick/Panel/expireaccounts.pm | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/expireaccounts.pm b/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/expireaccounts.pm index 780543a..20f467f 100644 --- a/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/expireaccounts.pm +++ b/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'); }