Employee::current statt manuell an weiteren Stellen
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 13 Sep 2021 12:01:10 +0000 (14:01 +0200)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Wed, 15 Sep 2021 11:17:34 +0000 (13:17 +0200)
SL/AM.pm
SL/Controller/CsvImport/Helper/Consistency.pm
SL/Controller/CsvImport/Inventory.pm

index 57e6b44..9780078 100644 (file)
--- 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});
index d1ce92b..5538a73 100644 (file)
@@ -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);
     }
   }
 }
index c724fb8..7dbe364 100644 (file)
@@ -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) {