Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / SL / DB / AuthUser.pm
index bd2670b..2565d06 100644 (file)
@@ -6,10 +6,13 @@ use List::Util qw(first);
 
 use SL::DB::MetaSetup::AuthUser;
 use SL::DB::Manager::AuthUser;
-use SL::DB::AuthClient;
-use SL::DB::AuthUserGroup;
 use SL::DB::Helper::Util;
 
+use constant CONFIG_VARS => qw(copies countrycode dateformat timeformat default_media default_printer_id
+                               email favorites fax hide_cvar_search_options mandatory_departments menustyle name
+                               numberformat show_form_details signature stylesheet taxincluded_checked tel
+                               template_format focus_position form_cvars_nr_cols item_multiselect);
+
 __PACKAGE__->meta->add_relationship(
   groups => {
     type      => 'many to many',
@@ -36,9 +39,8 @@ sub validate {
   my ($self) = @_;
 
   my @errors;
-  push @errors, $::locale->text('The login is missing.')          if !$self->login;
-  push @errors, $::locale->text('The login is not unique.')          if !SL::DB::Helper::Util::is_unique($self, 'login');
-  push @errors, "chunky bacon";
+  push @errors, $::locale->text('The login is missing.')    if !$self->login;
+  push @errors, $::locale->text('The login is not unique.') if !SL::DB::Helper::Util::is_unique($self, 'login');
 
   return @errors;
 }
@@ -46,7 +48,7 @@ sub validate {
 sub get_config_value {
   my ($self, $key) = @_;
 
-  my $cfg = first { $_->cfg_key eq $key } @{ $self->configs };
+  my $cfg = first { $_->cfg_key eq $key } @{ $self->configs || [] };
   return $cfg ? $cfg->cfg_value : undef;
 }
 
@@ -58,7 +60,7 @@ sub config_values {
     $self->configs([ map { SL::DB::AuthUserConfig->new(cfg_key => $_, cfg_value => $settings{$_}) } keys %settings ]);
   }
 
-  return { map { ($_->cfg_key => $_->cfg_value) } @{ $self->configs } };
+  return { map { ($_->cfg_key => $_->cfg_value) } @{ $self->configs || [] } };
 }
 
 1;