X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FAuthUser.pm;h=ae05aec71276ddc1335a57cbb51902b6911f18b7;hb=e8d91442a904758a2c15d5d22a05790fac120d23;hp=a11248ec6acda07ffb238bfdec12220f77734c5b;hpb=3568f2f8cb1f21031ee5255f054c0431544c5607;p=kivitendo-erp.git diff --git a/SL/DB/AuthUser.pm b/SL/DB/AuthUser.pm index a11248ec6..ae05aec71 100644 --- a/SL/DB/AuthUser.pm +++ b/SL/DB/AuthUser.pm @@ -6,10 +6,11 @@ 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 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 vclimit); + __PACKAGE__->meta->add_relationship( groups => { type => 'many to many', @@ -24,7 +25,7 @@ __PACKAGE__->meta->add_relationship( }, clients => { type => 'many to many', - map_class => 'SL::DB::AuthUserClient', + map_class => 'SL::DB::AuthClientUser', map_from => 'user', map_to => 'client', }, @@ -36,9 +37,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 +46,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 +58,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;