use IO::Dir;
use List::Util qw(first);
+use List::UtilsBy qw(sort_by);
use SL::Common ();
use SL::DB::AuthUser;
use SL::Locale::String qw(t8);
use SL::System::InstallationLock;
use SL::User;
+use SL::Layout::AdminLogin;
use Rose::Object::MakeMethods::Generic
(
$::auth->set_session_value('admin_password', $::lx_office_conf{authentication}->{admin_password});
$::auth->create_or_refresh_session;
+ return if $self->apply_dbupgrade_scripts;
+
my $group = (SL::DB::Manager::AuthGroup->get_all(limit => 1))[0];
if (!$group) {
SL::DB::AuthGroup->new(
name => t8('Full Access'),
description => t8('Full access to all functions'),
- rights => [ map { SL::DB::AuthGroupRight->new(right => $_, granted => 1) } SL::Auth::all_rights() ],
+ rights => [ map { SL::DB::AuthGroupRight->new(right => $_, granted => 1) } $::auth->all_rights ],
)->save;
}
- if (!$self->apply_dbupgrade_scripts) {
- $self->action_login;
- }
+ $self->action_login;
}
#
sub action_new_user {
my ($self) = @_;
+ my $defaults = SL::DefaultManager->new($::lx_office_conf{system}->{default_manager});
$self->user(SL::DB::AuthUser->new(
config_values => {
vclimit => 200,
- countrycode => "de",
- numberformat => "1.000,00",
- dateformat => "dd.mm.yy",
+ countrycode => $defaults->language('de'),
+ numberformat => $defaults->numberformat('1.000,00'),
+ dateformat => $defaults->dateformat('dd.mm.yy'),
stylesheet => "kivitendo.css",
menustyle => "neu",
},
$self->edit_user_form(title => t8('Edit User'));
}
-sub action_save_newuser {
- my ($self) = @_;
- $::form->{user}{clients} = 0;
- $self->action_save_user();
-}
-
sub action_save_user {
my ($self) = @_;
my $params = delete($::form->{user}) || { };
sub init_db_cfg { $::lx_office_conf{'authentication/database'} }
sub init_is_locked { SL::System::InstallationLock->is_locked }
-sub init_client { SL::DB::Manager::AuthClient->find_by(id => ($::form->{id} || ($::form->{client} || {})->{id})) }
+sub init_client { SL::DB::Manager::AuthClient->find_by(id => (($::form->{client} || {})->{id} || $::form->{id})) }
sub init_user { SL::DB::AuthUser ->new(id => ($::form->{id} || ($::form->{user} || {})->{id}))->load }
sub init_group { SL::DB::AuthGroup ->new(id => ($::form->{id} || ($::form->{group} || {})->{id}))->load }
sub init_printer { SL::DB::Printer ->new(id => ($::form->{id} || ($::form->{printer} || {})->{id}))->load }
sub init_all_groups { SL::DB::Manager::AuthGroup ->get_all_sorted }
sub init_all_printers { SL::DB::Manager::Printer ->get_all_sorted }
sub init_all_dateformats { [ qw(mm/dd/yy dd/mm/yy dd.mm.yy yyyy-mm-dd) ] }
-sub init_all_numberformats { [ '1,000.00', '1000.00', '1.000,00', '1000,00' ] }
+sub init_all_numberformats { [ '1,000.00', '1000.00', '1.000,00', '1000,00', "1'000.00" ] }
sub init_all_stylesheets { [ qw(lx-office-erp.css Mobile.css kivitendo.css) ] }
sub init_all_dbsources { [ sort User->dbsources($::form) ] }
sub init_all_used_dbsources { { map { (join(':', $_->dbhost || 'localhost', $_->dbport || 5432, $_->dbname) => $_->name) } @{ $_[0]->all_clients } } }
my (@sections, $current_section);
foreach my $entry ($::auth->all_rights_full) {
- if ($entry->[0] =~ m/^--/) {
- push @sections, { description => $entry->[1], rights => [] };
+ if ($entry->[2]) {
+ push @sections, { description => t8($entry->[1]), rights => [] };
} elsif (@sections) {
push @{ $sections[-1]->{rights} }, {
name => $entry->[0],
- description => $entry->[1],
+ description => t8($entry->[1]),
};
} else {
sub setup_layout {
my ($self, $action) = @_;
+ my $defaults = SL::DefaultManager->new($::lx_office_conf{system}->{default_manager});
$::request->layout(SL::Layout::Dispatcher->new(style => 'admin'));
$::form->{favicon} = "favicon.ico";
%::myconfig = (
- countrycode => 'de',
- numberformat => '1.000,00',
- dateformat => 'dd.mm.yy',
+ countrycode => $defaults->language('de'),
+ numberformat => $defaults->numberformat('1.000,00'),
+ dateformat => $defaults->dateformat('dd.mm.yy'),
) if !%::myconfig;
}
sub login_form {
my ($self, %params) = @_;
+ $::request->layout(SL::Layout::AdminLogin->new);
my $version = $::form->read_version;
- $::request->layout->no_menu(1);
$self->render('admin/adminlogin', title => t8('kivitendo v#1 administration', $version), %params, version => $version);
}
sub create_dataset_form {
my ($self, %params) = @_;
+
+ my $defaults = SL::DefaultManager->new($::lx_office_conf{system}->{default_manager});
+ $::form->{favicon} = "favicon.ico";
+ $::form->{countrymode} = $defaults->country('DE');
+ $::form->{chart} = $defaults->chart_of_accounts('Germany-DATEV-SKR03EU');
+ $::form->{defaultcurrency} = $defaults->currency('EUR');
+ $::form->{precision} = $defaults->precision(0.01);
+ $::form->{accounting_method} = $defaults->accounting_method('cash');
+ $::form->{inventory_system} = $defaults->inventory_system('periodic');
+ $::form->{profit_determination} = $defaults->profit_determination('balance');
+ $::form->{feature_balance} = $defaults->feature_balance(1);
+ $::form->{feature_datev} = $defaults->feature_datev(1);
+ $::form->{feature_erfolgsrechnung} = $defaults->feature_erfolgsrechnung(0);
+ $::form->{feature_eurechnung} = $defaults->feature_eurechnung(1);
+ $::form->{feature_ustva} = $defaults->feature_ustva(1);
+
$self->render('admin/create_dataset', title => (t8('Database Administration') . " / " . t8('Create Dataset')));
}
return undef;
}
+sub is_user_used_for_task_server {
+ my ($self, $user) = @_;
+
+ return undef if !$user;
+ return join ', ', sort_by { lc } map { $_->name } @{ SL::DB::Manager::AuthClient->get_all(where => [ task_server_user_id => $user->id ]) };
+}
+
+
1;