Auftrags-Controller: auch bei geladenen Positionen die ID übergeben.
[kivitendo-erp.git] / SL / Dispatcher.pm
index 56791ed..77074cc 100644 (file)
@@ -25,7 +25,6 @@ use English qw(-no_match_vars);
 use File::Basename;
 use List::MoreUtils qw(all);
 use List::Util qw(first);
-use POSIX;
 use SL::ArchiveZipFixes;
 use SL::Auth;
 use SL::Dispatcher::AuthHandler;
@@ -38,6 +37,7 @@ use SL::Form;
 use SL::Helper::DateTime;
 use SL::InstanceConfiguration;
 use SL::Template::Plugin::HTMLFixes;
+use SL::User;
 
 # Trailing new line is added so that Perl will not add the line
 # number 'die' was called in.
@@ -105,8 +105,6 @@ sub pre_request_initialization {
       die "cannot find locale for user " . $params{login} unless $::locale   = Locale->new($::myconfig{countrycode});
 
       $::form->{login} = $params{login}; # normaly implicit at login
-
-      $::instance_conf->init;
     }
   }
 
@@ -159,8 +157,8 @@ sub pre_startup_setup {
     $::lxdebug     = LXDebug->new;
     $::auth        = SL::Auth->new;
     $::form        = undef;
-    %::myconfig    = ();
     $::request     = undef;
+    %::myconfig    = User->get_default_myconfig;
   }
 
   $SIG{__WARN__} = sub {
@@ -320,6 +318,14 @@ sub handle_request {
 
   $::form->footer;
 
+  if ($self->_interface_is_fcgi) {
+    # fcgi? send send reponse on its way before cleanup.
+    $self->{request}->Flush;
+    $self->{request}->Finish;
+  }
+
+  $::lxdebug->end_request;
+
   # cleanup
   $::auth->save_session;
   $::auth->expire_sessions;
@@ -329,9 +335,9 @@ sub handle_request {
   $::form     = undef;
   $::myconfig = ();
   $::request  = undef;
-  Form::disconnect_standard_dbh;
 
-  $::lxdebug->end_request;
+  SL::DBConnect::Cache->reset_all;
+  Form::disconnect_standard_dbh;
 
   $self->_watch_for_changed_files;