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});
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);
}
}
}
# 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) {