X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=scripts%2Ftask_server.pl;h=9330cc2fafa6707e531a7236cd795814e4bc3471;hb=c3fa430edf27cefc8d45597e8784d0e847a72ff4;hp=cb332ec07ef0dfac39cc131410337d588e1400f3;hpb=29458987fb3e3f2027990a55c7c6e51c68683905;p=kivitendo-erp.git diff --git a/scripts/task_server.pl b/scripts/task_server.pl index cb332ec07..9330cc2fa 100755 --- a/scripts/task_server.pl +++ b/scripts/task_server.pl @@ -75,6 +75,21 @@ sub lxinit { die "cannot find locale for user $login" unless $::locale = Locale->new('de'); } +sub per_job_initialization { + $::locale = Locale->new($::myconfig{countrycode} || $::lx_office_conf{system}->{language}); + $::form = Form->new; + $::instance_conf = SL::InstanceConfiguration->new; + $::request = SL::Request->new( + cgi => CGI->new({}), + layout => SL::Layout::None->new, + ); + + $::auth->restore_session; + + $::form->{login} = $lx_office_conf{task_server}->{login}; + $::instance_conf->init; +} + sub drop_privileges { my $user = $lx_office_conf{task_server}->{run_as}; return unless $user; @@ -174,8 +189,7 @@ sub gd_run { foreach my $job (@{ $jobs }) { # Provide fresh global variables in case legacy code modifies # them somehow. - $::locale = Locale->new($::lx_office_conf{system}->{language}); - $::form = Form->new; + per_job_initialization(); chdir $exe_dir;