From eabfa79517bccb2dd56220ffd7f381605944bc7f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 13 Sep 2021 14:01:10 +0200 Subject: [PATCH] Employee::current statt manuell an weiteren Stellen --- SL/AM.pm | 2 +- SL/Controller/CsvImport/Helper/Consistency.pm | 2 +- SL/Controller/CsvImport/Inventory.pm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SL/AM.pm b/SL/AM.pm index 57e6b445a..9780078f5 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -556,7 +556,7 @@ sub save_preferences { my ($self, $form) = @_; - my $employee = SL::DB::Manager::Employee->find_by(login => $::myconfig{login}); + my $employee = SL::DB::Manager::Employee->current; $employee->update_attributes(name => $form->{name}); my $user = SL::DB::Manager::AuthUser->find_by(login => $::myconfig{login}); diff --git a/SL/Controller/CsvImport/Helper/Consistency.pm b/SL/Controller/CsvImport/Helper/Consistency.pm index d1ce92bb1..5538a738c 100644 --- a/SL/Controller/CsvImport/Helper/Consistency.pm +++ b/SL/Controller/CsvImport/Helper/Consistency.pm @@ -208,7 +208,7 @@ sub handle_salesman { if ($vc_obj && $vc_obj->salesman_id) { $object->salesman(SL::DB::Manager::Employee->find_by(id => $vc_obj->salesman_id)); } else { - $object->salesman(SL::DB::Manager::Employee->find_by(login => $::myconfig{login})); + $object->salesman(SL::DB::Manager::Employee->current); } } } diff --git a/SL/Controller/CsvImport/Inventory.pm b/SL/Controller/CsvImport/Inventory.pm index c724fb8fc..7dbe364d8 100644 --- a/SL/Controller/CsvImport/Inventory.pm +++ b/SL/Controller/CsvImport/Inventory.pm @@ -370,7 +370,7 @@ sub handle_employee { # employee from login if not given if (!$object->employee_id) { - $object->employee_id(SL::DB::Manager::Employee->find_by(login => $::myconfig{login})->id); + $object->employee_id(SL::DB::Manager::Employee->current->id) if SL::DB::Manager::Employee->current; } if ($object->employee_id) { -- 2.20.1