From: Moritz Bunkus Date: Thu, 13 Jun 2013 09:08:03 +0000 (+0200) Subject: Admin-Controller: gelöschte User in allen Mandanten-Employee-Tabellen als gelöscht... X-Git-Tag: release-3.1.0beta1~331^2~22 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=f1a6f40168188b4e7e1d55db3c9c4e88749aa68b;p=kivitendo-erp.git Admin-Controller: gelöschte User in allen Mandanten-Employee-Tabellen als gelöscht flaggen --- diff --git a/SL/Controller/Admin.pm b/SL/Controller/Admin.pm index 5fdc308fc..7277e7940 100644 --- a/SL/Controller/Admin.pm +++ b/SL/Controller/Admin.pm @@ -157,12 +157,21 @@ sub action_save_user { sub action_delete_user { my ($self) = @_; + my @clients = @{ $self->user->clients || [] }; + if (!$self->user->delete) { flash('error', t8('The user could not be deleted.')); $self->edit_user_form(title => t8('Edit User')); return; } + # Flag corresponding entries in 'employee' as deleted. + foreach my $client (@clients) { + my $dbh = $client->dbconnect(AutoCommit => 1) || next; + $dbh->do(qq|UPDATE employee SET deleted = TRUE WHERE login = ?|, undef, $self->user->login); + $dbh->disconnect; + } + flash_later('info', t8('The user has been deleted.')); $self->redirect_to(action => 'show'); }