diff options
-rwxr-xr-x | LedgerSMB.pm | 24 | ||||
-rw-r--r-- | sql/Pg-database.sql | 7 |
2 files changed, 19 insertions, 12 deletions
diff --git a/LedgerSMB.pm b/LedgerSMB.pm index 7980d0b4..2be20f6d 100755 --- a/LedgerSMB.pm +++ b/LedgerSMB.pm @@ -646,6 +646,7 @@ sub _db_init { $auth =~ s/Basic //i; # strip out basic authentication preface $auth = MIME::Base64::decode($auth); my ($login, $password) = split(/:/, $auth); + print STDERR "$auth\n"; $self->{login} = $login; $self->{company} ||= 'lsmb13'; my $dbname = $self->{company}; @@ -659,16 +660,6 @@ sub _db_init { ); my $dbh = $self->{dbh}; - # This is the general version check - my $sth = $dbh->prepare(" - SELECT value FROM defaults - WHERE setting_key = 'version'"); - $sth->execute; - - my ($dbversion) = $sth->fetchrow_array; - if ($dbversion ne $self->{dbversion}){ - $self->error("Database is not the expected version."); - } if (($self->{script} eq 'login.pl') && ($self->{action} eq @@ -679,10 +670,21 @@ sub _db_init { elsif (!$dbh){ $self->_get_password; } - $dbh->{pg_server_prepare} = 0; $dbh->{pg_enable_utf8} = 1; + # This is the general version check + my $sth = $dbh->prepare(" + SELECT value FROM defaults + WHERE setting_key = 'version'"); + $sth->execute; + my ($dbversion) = $sth->fetchrow_array; + if ($dbversion ne $self->{dbversion}){ + $self->error("Database is not the expected version."); + } + + + # TODO: Add date handling settings and the like. diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql index 76b22079..dc22e135 100644 --- a/sql/Pg-database.sql +++ b/sql/Pg-database.sql @@ -53,7 +53,12 @@ COMMENT ON TABLE entity_class_to_entity IS $$ Relation builder for classes to en CREATE TABLE users ( id serial UNIQUE, username varchar(30) primary key, - entity_id int not null references entity(id) on delete cascade + entity_id int not null references employee(entity_id) on delete cascade, + language text references country(short_name), + stylesheet text default 'ledgersmb.css' not null, + printer text, + dateformat text default 'yyyy-mm-dd' not null, + numberformat text default '1000.00' not null ); COMMENT ON TABLE users IS $$username is the actual primary key here because we do not want duplicate users$$; |