From: Bernd Bleßmann Date: Mon, 28 Dec 2020 15:33:12 +0000 (+0100) Subject: Zeiterfassung: Beim Bearbeiten fremder Einträge, Mitarbeiter behalten X-Git-Tag: kivitendo-mebil_0.1-0~9^2~329 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=404521c296db1a111009e774d6519f0565512bef;p=kivitendo-erp.git Zeiterfassung: Beim Bearbeiten fremder Einträge, Mitarbeiter behalten --- 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);