WebshopApi: falsche sql update Abhängigkeit
[kivitendo-erp.git] / SL / User.pm
index 2c62855..f324e36 100644 (file)
@@ -25,7 +25,8 @@
 # GNU General Public License for more details.
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1335, USA.
 #=====================================================================
 #
 # user related functions
@@ -37,6 +38,7 @@ package User;
 use IO::File;
 use Fcntl qw(:seek);
 
+use SL::DB;
 #use SL::Auth;
 use SL::DB::AuthClient;
 use SL::DB::Employee;
@@ -113,7 +115,7 @@ sub login {
   return LOGIN_AUTH_DBUPDATE_AVAILABLE() if $dbupdater_auth->unapplied_upgrade_scripts($::auth->dbconnect);
 
   # check if database is down
-  my $dbh = $form->dbconnect_noauto;
+  my $dbh = SL::DB->client->dbh;
 
   # we got a connection, check the version
   my ($dbversion) = $dbh->selectrow_array(qq|SELECT version FROM defaults|);
@@ -126,7 +128,7 @@ sub login {
 
   my $dbupdater        = SL::DBUpgrade2->new(form => $form)->parse_dbupdate_controls;
   my @unapplied_scripts = $dbupdater->unapplied_upgrade_scripts($dbh);
-  $dbh->disconnect;
+  $dbh->disconnect;
 
   if (!@unapplied_scripts) {
     SL::DB::Manager::Employee->update_entries_for_authorized_users;
@@ -441,6 +443,8 @@ sub dbupdate2 {
 
   my @upgradescripts = $dbupdater->unapplied_upgrade_scripts($dbh);
 
+  $::lxdebug->log_time("DB upgrades commencing");
+
   foreach my $control (@upgradescripts) {
     # Apply upgrade. Control will only return to us if the upgrade has
     # been applied correctly and if the update has not requested user
@@ -451,6 +455,8 @@ sub dbupdate2 {
     $dbupdater->process_file($dbh, "sql/Pg-upgrade2/$control->{file}", $control);
   }
 
+  $::lxdebug->log_time("DB upgrades finished");
+
   $dbh->disconnect;
 }