}
}
- $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;
[% USE P %]
[% USE T8 %]
[% USE LxERP %]
+[% USE HTML %]
<h1>[% title %]</h1>
<th>[% 'Type' | $T8 %]</th>
<th>[% 'Project' | $T8 %]</th>
<th>[% 'Description' | $T8 %]</th>
+ <th>[% 'Mitarbeiter' | $T8 %]</th>
</thead>
<tbody valign="top">
<td>
<td>[% P.select_tag('time_recording.type_id', SELF.all_time_recording_types, default=SELF.time_recording.type.id, with_empty=1, title_key='abbreviation') %]</td>
<td>[% P.project.picker('time_recording.project_id', SELF.time_recording.project_id, style='width: 300px') %]</td>
<td>[% L.textarea_tag('time_recording.description', SELF.time_recording.description, wrap="soft", style="width: 350px; height: 150px", class="texteditor", "data-validate"="required", "data-title"=LxERP.t8('Description')) %]</td>
+ <td>
+ [%- IF SELF.can_edit_all -%]
+ [% L.select_tag('time_recording.staff_member_id', SELF.all_employees,
+ default => SELF.time_recording.staff_member_id,
+ title_key => 'safe_name',
+ value_key => 'id',
+ style => 'width: 200px') %]
+ [%- ELSE -%]
+ [% SELF.time_recording.staff_member.safe_name | html %]
+ [%- END -%]
+ </td>
</tbody>
</table>