Merge branch 'master' of git@lx-office.linet-services.de:lx-office-erp
[kivitendo-erp.git] / SL / User.pm
index 6edcbc6..520bf42 100644 (file)
@@ -145,10 +145,10 @@ sub login {
       }
 
       # update the tables
-      if (!open(FH, ">$main::userspath/nologin")) {
+      if (!open(FH, ">" . $::lx_office_conf{paths}->{userspath} . "/nologin")) {
         $form->show_generic_error($main::locale->text('A temporary file could not be created. ' .
                                                       'Please verify that the directory "#1" is writeable by the webserver.',
-                                                      $main::userspath),
+                                                      $::lx_office_conf{paths}->{userspath}),
                                   'back_button' => 1);
       }
 
@@ -161,11 +161,12 @@ sub login {
 
       $self->dbupdate($form);
       $self->dbupdate2($form, $dbupdater);
+      SL::DBUpgrade2->new(form => $::form, dbdriver => 'Pg', auth => 1)->apply_admin_dbupgrade_scripts(0);
 
       close(FH);
 
       # remove lock file
-      unlink("$main::userspath/nologin");
+      unlink($::lx_office_conf{paths}->{userspath} . "/nologin");
 
       my $menufile =
         $self->{"menustyle"} eq "v3" ? "menuv3.pl" :
@@ -177,7 +178,6 @@ sub login {
       print $form->parse_html_template("dbupgrade/footer", { "menufile" => $menufile });
 
       $rc = -2;
-
     }
   }
 
@@ -581,7 +581,7 @@ sub dbupdate {
     closedir(SQLDIR);
   }
 
-  my $db_charset = $main::dbcharset;
+  my $db_charset = $::lx_office_conf{system}->{dbcharset};
   $db_charset ||= Common::DEFAULT_CHARSET;
 
   my $dbupdater = SL::DBUpgrade2->new(form => $form, dbdriver => $form->{dbdriver});
@@ -648,7 +648,7 @@ sub dbupdate2 {
   $form->{sid} = $form->{dbdefault};
 
   my $rc         = -2;
-  my $db_charset = $main::dbcharset || Common::DEFAULT_CHARSET;
+  my $db_charset = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET;
 
   map { $_->{description} = SL::Iconv::convert($_->{charset}, $db_charset, $_->{description}) } values %{ $dbupdater->{all_controls} };