From 5c399b8268285b0561c07e7deb6506de040c2aa4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 28 Dec 2020 17:33:11 +0100 Subject: [PATCH] =?utf8?q?Zeiterfassung:=20Mitarbeiter=20=C3=A4ndern=20k?= =?utf8?q?=C3=B6nnen=20bei=20entspr.=20Recht?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/TimeRecording.pm | 5 ++++- templates/webpages/time_recording/form.html | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/SL/Controller/TimeRecording.pm b/SL/Controller/TimeRecording.pm index b72b0d15d..44d54ca99 100644 --- a/SL/Controller/TimeRecording.pm +++ b/SL/Controller/TimeRecording.pm @@ -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; diff --git a/templates/webpages/time_recording/form.html b/templates/webpages/time_recording/form.html index 119de5cc7..f0d4c1ebb 100644 --- a/templates/webpages/time_recording/form.html +++ b/templates/webpages/time_recording/form.html @@ -2,6 +2,7 @@ [% USE P %] [% USE T8 %] [% USE LxERP %] +[% USE HTML %]

[% title %]

@@ -19,6 +20,7 @@ [% 'Type' | $T8 %] [% 'Project' | $T8 %] [% 'Description' | $T8 %] + [% 'Mitarbeiter' | $T8 %] @@ -35,6 +37,17 @@ [% P.select_tag('time_recording.type_id', SELF.all_time_recording_types, default=SELF.time_recording.type.id, with_empty=1, title_key='abbreviation') %] [% P.project.picker('time_recording.project_id', SELF.time_recording.project_id, style='width: 300px') %] [% 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')) %] + + [%- 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 -%] + -- 2.20.1