X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Fconsole;h=e183ac83a516b5fb2bf85b7aa881e1ac6c03e83b;hb=2f189aa225f9730ce5e95c415b3a50afd5866aa4;hp=dcaaabc115349eada45afdb5fa2c9d3b4523fbc4;hpb=f942a47abc0f2d930bc97002fd0cbefe8df58b83;p=kivitendo-erp.git diff --git a/scripts/console b/scripts/console index dcaaabc11..e183ac83a 100755 --- a/scripts/console +++ b/scripts/console @@ -9,16 +9,17 @@ BEGIN { push @INC, "modules/fallback"; # Only use our own versions of modules if there's no system version. } -use Config::Std; use Data::Dumper; use Devel::REPL 1.002001; use Term::ReadLine::Perl::Bind; # use sane key binding for rxvt users -read_config 'config/console.conf' => my %config;# if -f 'config/console.conf'; +use SL::LxOfficeConf; +SL::LxOfficeConf->read; -my $login = shift || $config{Console}{login} || 'demo'; -my $history_file = $config{Console}{history_file} || '/tmp/lxoffice_console_history.log'; # fallback if users is not writable -my $autorun = $config{Console}{autorun}; +my $login = shift || $::lx_office_conf{console}{login} || 'demo'; +my $history_file = $::lx_office_conf{console}{history_file} || '/tmp/lxoffice_console_history.log'; # fallback if users is not writable +my $debug_file = $::lx_office_conf{console}{log_file} || '/tmp/lxoffice_console_debug.log'; +my $autorun = $::lx_office_conf{console}{autorun}; # will be configed eventually my @plugins = qw(History LexEnv Colors MultiLine::PPI FancyPrompt PermanentHistory AutoloadModules); @@ -39,8 +40,11 @@ package Devel::REPL; use utf8; use CGI qw( -no_xhtml); +use DateTime; use SL::Auth; use SL::Form; +use SL::Helper::DateTime; +use SL::InstanceConfiguration; use SL::Locale; use SL::LXDebug; use Data::Dumper; @@ -56,20 +60,12 @@ sub lxinit { package main; - { no warnings 'once'; - $::userspath = "users"; - $::templates = "templates"; - $::sendmail = "| /usr/sbin/sendmail -t"; - } - - eval { require "config/lx-erp.conf"; }; - eval { require "config/lx-erp-local.conf"; } if -f "config/lx-erp-local.conf"; - - $::lxdebug = LXDebug->new; - $::locale = Locale->new($::language); - $::cgi = CGI->new qw(); - $::form = Form->new; - $::auth = SL::Auth->new; + $::lxdebug = LXDebug->new(file => $debug_file); + $::locale = Locale->new($::lx_office_conf{system}->{language}); + $::form = Form->new; + $::auth = SL::Auth->new; + $::instance_conf = SL::InstanceConfiguration->new; + $::request = { cgi => CGI->new({}) }; die 'cannot reach auth db' unless $::auth->session_tables_present; @@ -77,9 +73,14 @@ sub lxinit { require "bin/mozilla/common.pl"; - die "cannot find user $login" unless %::myconfig = $::auth->read_user($login); + die "cannot find user $login" unless %::myconfig = $::auth->read_user(login => $login); + + $::form->{login} = $login; # normaly implicit at login + die "cannot find locale for user $login" unless $::locale = Locale->new($::myconfig{countrycode}); + $::instance_conf->init; + return "logged in as $login"; } @@ -124,6 +125,7 @@ EOL sub pp { local $Data::Dumper::Indent = 2; local $Data::Dumper::Maxdepth = 2; + local $Data::Dumper::Sortkeys = 1; Data::Dumper::Dumper(@_); } @@ -133,7 +135,7 @@ __END__ =head1 NAME -scripts/console - Lx Office Console +scripts/console - Lx-Office console =head1 SYNOPSIS @@ -186,8 +188,8 @@ of the classes they were created with. Configuration of this script is located in: - config/console.conf - config/console.conf.default + config/kivitendo.conf + config/kivitendo.conf.default See there for interesting options.