summaryrefslogtreecommitdiff
path: root/LedgerSMB/User.pm
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-09-18 05:40:51 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-09-18 05:40:51 +0000
commitcc201091119a448036c0710d121602fd72b83628 (patch)
treec1a7000feea86f4cbd92d8b73258f8e04e0647b7 /LedgerSMB/User.pm
parent6b4db289cc6af2b4588102bd02800d342a17ca52 (diff)
fixed broken db version. Also fixed bug of trying to add all relations to
template1. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@110 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/User.pm')
-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};