summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
Diffstat (limited to 'LedgerSMB')
-rwxr-xr-xLedgerSMB/User.pm13
1 files changed, 8 insertions, 5 deletions
diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm
index d0ccfc61..e0f2bc6b 100755
--- a/LedgerSMB/User.pm
+++ b/LedgerSMB/User.pm
@@ -306,10 +306,18 @@ sub dbcreate {
$form->{sid} = $form->{dbdefault};
&dbconnect_vars($form, $form->{dbdefault});
+ # The below line connects to Template1 or another template file in order
+ # to create the db. One must disconnect and reconnect later.
my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror;
my $query = qq|$dbcreate{$form->{dbdriver}}|;
$dbh->do($query) || $form->dberror($query);
+ $dbh->disconnect;
+ #Reassign for the work below
+
+ &dbconnect_vars($form, $form->{db});
+
+ my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror;
# JD: We need to check for plpgsql, if it isn't there create it, if we can't error
# Good chance I will have to do this twice as I get used to the way the code is
# structured
@@ -318,11 +326,6 @@ sub dbcreate {
my $query = qq|$langcreate{$form->{dbdriver}}|;
$dbh->do($query) || $form->dberror($query);
- #Reassign for the work below
-
- &dbconnect_vars($form, $form->{db});
-
-
# create the tables
my $dbdriver = ($form->{dbdriver} =~ /Pg/) ? 'Pg' : $form->{dbdriver};