Zeiterfassung: Mitarbeiter ändern können bei entspr. Recht
[kivitendo-erp.git] / SL / Controller / TimeRecording.pm
index b72b0d1..44d54ca 100644 (file)
@@ -121,9 +121,12 @@ sub init_time_recording {
     }
   }
 
-  $attributes{employee_id}     = SL::DB::Manager::Employee->current->id;
+  # do not overwright staff member if you do not have the right
+  delete $attributes{staff_member_id} if !$_[0]->can_edit_all;
   $attributes{staff_member_id} = SL::DB::Manager::Employee->current->id if $is_new;
 
+  $attributes{employee_id}     = SL::DB::Manager::Employee->current->id;
+
   $time_recording->assign_attributes(%attributes);
 
   return $time_recording;