From: Moritz Bunkus Date: Fri, 5 Jul 2013 12:41:08 +0000 (+0200) Subject: Admin: Zuordnungen User <-> Gruppen <-> Mandanten auch leeren können X-Git-Tag: release-3.1.0beta1~206 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=d5aaeae13f7ee92b02903c445b8d7a2daf531d0e;p=kivitendo-erp.git Admin: Zuordnungen User <-> Gruppen <-> Mandanten auch leeren können --- diff --git a/SL/Controller/Admin.pm b/SL/Controller/Admin.pm index fe7dac531..bcc9436b7 100644 --- a/SL/Controller/Admin.pm +++ b/SL/Controller/Admin.pm @@ -135,6 +135,10 @@ sub action_save_user { my $props = delete($params->{config_values}) || { }; my $is_new = !$params->{id}; + # Assign empty arrays if the browser doesn't send those controls. + $params->{clients} ||= []; + $params->{groups} ||= []; + $self->user($is_new ? SL::DB::AuthUser->new : SL::DB::AuthUser->new(id => $params->{id})->load) ->assign_attributes(%{ $params }) ->config_values({ %{ $self->user->config_values }, %{ $props } }); @@ -206,6 +210,10 @@ sub action_save_client { my $params = delete($::form->{client}) || { }; my $is_new = !$params->{id}; + # Assign empty arrays if the browser doesn't send those controls. + $params->{groups} ||= []; + $params->{users} ||= []; + $self->client($is_new ? SL::DB::AuthClient->new : SL::DB::AuthClient->new(id => $params->{id})->load)->assign_attributes(%{ $params }); my @errors = $self->client->validate; @@ -278,6 +286,10 @@ sub action_save_group { my $params = delete($::form->{group}) || { }; my $is_new = !$params->{id}; + # Assign empty arrays if the browser doesn't send those controls. + $params->{clients} ||= []; + $params->{users} ||= []; + $self->group($is_new ? SL::DB::AuthGroup->new : SL::DB::AuthGroup->new(id => $params->{id})->load)->assign_attributes(%{ $params }); my @errors = $self->group->validate;