X-Git-Url: http://wagnertech.de/git?p=kivitendo-erp.git;a=blobdiff_plain;f=scripts%2Fconsole;fp=scripts%2Fconsole;h=bf4ffaa6c8fb05b16c2e47b77e6cbdb07c51377a;hp=1d9758138d647090d8458ed46fa7af125ef8dfab;hb=53593baa211863fbf66540cf1bcc36c8fb37257f;hpb=deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44 diff --git a/scripts/console b/scripts/console index 1d9758138..bf4ffaa6c 100755 --- a/scripts/console +++ b/scripts/console @@ -2,11 +2,16 @@ use warnings; use strict; +use utf8; +use open qw(:std :utf8); use 5.008; # too much magic in here to include perl 5.6 BEGIN { - unshift @INC, "modules/override"; # Use our own versions of various modules (e.g. YAML). - push @INC, "modules/fallback"; # Only use our own versions of modules if there's no system version. + use FindBin; + + unshift(@INC, $FindBin::Bin . '/../modules/override'); # Use our own versions of various modules (e.g. YAML). + push (@INC, $FindBin::Bin . '/..'); + push (@INC, $FindBin::Bin . '/../modules/fallback'); # Only use our own versions of modules if there's no system version. } use Data::Dumper; @@ -61,6 +66,10 @@ sub execute_code { my $repl = Devel::REPL->new; $repl->load_plugin($_) for @plugins; $repl->load_history($history_file); + +binmode($repl->out_fh, 'utf8'); + +$repl->eval('use utf8;'); $repl->eval('help'); $repl->print("trying to auto login into client '$client' with login '$login'...\n"); execute_code($repl, "lxinit '$client', '$login'"); @@ -118,6 +127,7 @@ sub lxinit { die "cannot find user $login" unless %::myconfig = $::auth->read_user(login => $login); die "cannot find locale for user $login" unless $::locale = Locale->new($::myconfig{countrycode}); + $::myconfig{login} = $login; # so SL::DB::Manager::Employee->current works in test database $::instance_conf->init; @@ -287,6 +297,12 @@ Print the manual page and exit. Log in as C. The default is to use the value from the configuration file and C if none is set there. +=item B<-c>, B<--client>=C + +Use the database for client C. C can be a client's +database ID or its name. The default is to use the value from the +configuration file. + =item B<-o>, B<--log-file>=C Use C as the log file. The default is to use the value from