From 404521c296db1a111009e774d6519f0565512bef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 28 Dec 2020 16:33:12 +0100 Subject: [PATCH] =?utf8?q?Zeiterfassung:=20Beim=20Bearbeiten=20fremder=20E?= =?utf8?q?intr=C3=A4ge,=20Mitarbeiter=20behalten?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/TimeRecording.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SL/Controller/TimeRecording.pm b/SL/Controller/TimeRecording.pm index 9ed3c7237..28cd68bfd 100644 --- a/SL/Controller/TimeRecording.pm +++ b/SL/Controller/TimeRecording.pm @@ -102,8 +102,9 @@ sub action_delete { } sub init_time_recording { - my $time_recording = ($::form->{id}) ? SL::DB::TimeRecording->new(id => $::form->{id})->load - : SL::DB::TimeRecording->new(start_time => DateTime->now_local); + my $is_new = !$::form->{id}; + my $time_recording = $is_new ? SL::DB::TimeRecording->new(start_time => DateTime->now_local) + : SL::DB::TimeRecording->new(id => $::form->{id})->load; my %attributes = %{ $::form->{time_recording} || {} }; @@ -119,7 +120,8 @@ sub init_time_recording { } } - $attributes{staff_member_id} = $attributes{employee_id} = SL::DB::Manager::Employee->current->id; + $attributes{employee_id} = SL::DB::Manager::Employee->current->id; + $attributes{staff_member_id} = SL::DB::Manager::Employee->current->id if $is_new; $time_recording->assign_attributes(%attributes); -- 2.20.1