X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/68dbf4a4cb26b9554a23f076438109d7fc2d861c..0b34e29fb04ad9ac9912f67b767f9f401700ca97:/SL/Controller/Admin.pm diff --git a/SL/Controller/Admin.pm b/SL/Controller/Admin.pm index c2d9f29e7..d48262e75 100644 --- a/SL/Controller/Admin.pm +++ b/SL/Controller/Admin.pm @@ -20,7 +20,7 @@ use SL::Layout::AdminLogin; use Rose::Object::MakeMethods::Generic ( 'scalar --get_set_init' => [ qw(client user group printer db_cfg is_locked - all_dateformats all_numberformats all_countrycodes all_stylesheets all_menustyles all_clients all_groups all_users all_rights all_printers + all_dateformats all_numberformats all_countrycodes all_countrymodes all_stylesheets all_menustyles all_clients all_groups all_users all_rights all_printers all_dbsources all_used_dbsources all_accounting_methods all_inventory_systems all_profit_determinations all_charts) ], ); @@ -39,7 +39,6 @@ sub keep_auth_vars { sub action_login { my ($self) = @_; - return $self->login_form if !$::form->{do_login}; return if !$self->authenticate_root; return if !$self->check_auth_db_and_tables; @@ -81,18 +80,18 @@ sub action_create_auth_tables { $::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; } # @@ -110,13 +109,13 @@ sub action_show { 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", }, @@ -497,8 +496,8 @@ sub init_all_users { SL::DB::Manager::AuthUser ->get_all_sorted 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_stylesheets { [ qw(lx-office-erp.css kivitendo.css) ] } +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 } } } sub init_all_accounting_methods { [ { id => 'accrual', name => t8('Accrual accounting') }, { id => 'cash', name => t8('Cash accounting') } ] } @@ -528,13 +527,13 @@ sub init_all_rights { 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 { @@ -550,19 +549,25 @@ sub init_all_countrycodes { return [ map { id => $_, title => $cc{$_} }, sort { $cc{$a} cmp $cc{$b} } keys %cc ]; } +sub init_all_countrymodes { + my %cm = SL::DefaultManager->country_modes; + return [ map { id => $_, title => "$_ ($cm{$_})" }, sort keys %cm ]; +} + # # filters # 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; } @@ -627,6 +632,17 @@ sub database_administration_login_form { sub create_dataset_form { my ($self, %params) = @_; + my $defaults = SL::DefaultManager->new($::lx_office_conf{system}->{default_manager}); + + $::request->layout(SL::Layout::Dispatcher->new(style => 'admin')); + $::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' ); $self->render('admin/create_dataset', title => (t8('Database Administration') . " / " . t8('Create Dataset'))); }