From f1a6f40168188b4e7e1d55db3c9c4e88749aa68b Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 13 Jun 2013 11:08:03 +0200 Subject: [PATCH] =?utf8?q?Admin-Controller:=20gel=C3=B6schte=20User=20in?= =?utf8?q?=20allen=20Mandanten-Employee-Tabellen=20als=20gel=C3=B6scht=20f?= =?utf8?q?laggen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/Admin.pm | 9 +++++++++ 1 file changed, 9 insertions(+) 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'); } -- 2.20.1