projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kein use von DB-Objekten in DB-Objekten
[kivitendo-erp.git]
/
SL
/
DB
/
AuthUser.pm
diff --git
a/SL/DB/AuthUser.pm
b/SL/DB/AuthUser.pm
index
c1b46b4
..
ae05aec
100644
(file)
--- a/
SL/DB/AuthUser.pm
+++ b/
SL/DB/AuthUser.pm
@@
-1,6
+1,3
@@
-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::AuthUser;
use strict;
package SL::DB::AuthUser;
use strict;
@@
-8,12
+5,11
@@
use strict;
use List::Util qw(first);
use SL::DB::MetaSetup::AuthUser;
use List::Util qw(first);
use SL::DB::MetaSetup::AuthUser;
-use SL::DB::AuthUserGroup;
-
-# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
-__PACKAGE__->meta->make_manager_class;
+use SL::DB::Manager::AuthUser;
+use SL::DB::Helper::Util;
-__PACKAGE__->meta->schema('auth');
+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 => {
__PACKAGE__->meta->add_relationship(
groups => {
@@
-29,7
+25,7
@@
__PACKAGE__->meta->add_relationship(
},
clients => {
type => 'many to many',
},
clients => {
type => 'many to many',
- map_class => 'SL::DB::AuthClient',
+ map_class => 'SL::DB::AuthClient
User
',
map_from => 'user',
map_to => 'client',
},
map_from => 'user',
map_to => 'client',
},
@@
-37,11
+33,32
@@
__PACKAGE__->meta->add_relationship(
__PACKAGE__->meta->initialize;
__PACKAGE__->meta->initialize;
+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');
+
+ return @errors;
+}
+
sub get_config_value {
my ($self, $key) = @_;
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;
}
return $cfg ? $cfg->cfg_value : undef;
}
+sub config_values {
+ my $self = shift;
+
+ if (0 != scalar(@_)) {
+ my %settings = (ref($_[0]) || '') eq 'HASH' ? %{ $_[0] } : @_;
+ $self->configs([ map { SL::DB::AuthUserConfig->new(cfg_key => $_, cfg_value => $settings{$_}) } keys %settings ]);
+ }
+
+ return { map { ($_->cfg_key => $_->cfg_value) } @{ $self->configs || [] } };
+}
+
1;
1;