Revision 404521c2
Von Bernd Bleßmann vor mehr als 3 Jahren hinzugefügt
SL/Controller/TimeRecording.pm | ||
---|---|---|
102 | 102 |
} |
103 | 103 |
|
104 | 104 |
sub init_time_recording { |
105 |
my $time_recording = ($::form->{id}) ? SL::DB::TimeRecording->new(id => $::form->{id})->load |
|
106 |
: SL::DB::TimeRecording->new(start_time => DateTime->now_local); |
|
105 |
my $is_new = !$::form->{id}; |
|
106 |
my $time_recording = $is_new ? SL::DB::TimeRecording->new(start_time => DateTime->now_local) |
|
107 |
: SL::DB::TimeRecording->new(id => $::form->{id})->load; |
|
107 | 108 |
|
108 | 109 |
my %attributes = %{ $::form->{time_recording} || {} }; |
109 | 110 |
|
... | ... | |
119 | 120 |
} |
120 | 121 |
} |
121 | 122 |
|
122 |
$attributes{staff_member_id} = $attributes{employee_id} = SL::DB::Manager::Employee->current->id; |
|
123 |
$attributes{employee_id} = SL::DB::Manager::Employee->current->id; |
|
124 |
$attributes{staff_member_id} = SL::DB::Manager::Employee->current->id if $is_new; |
|
123 | 125 |
|
124 | 126 |
$time_recording->assign_attributes(%attributes); |
125 | 127 |
|
Auch abrufbar als: Unified diff
Zeiterfassung: Beim Bearbeiten fremder Einträge, Mitarbeiter behalten