projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Leeren String in undef für anständige DB-Abfrage umwandeln
[kivitendo-erp.git]
/
SL
/
User.pm
diff --git
a/SL/User.pm
b/SL/User.pm
index
6edcbc6
..
d6b8705
100644
(file)
--- a/
SL/User.pm
+++ b/
SL/User.pm
@@
-38,6
+38,7
@@
use IO::File;
use Fcntl qw(:seek);
#use SL::Auth;
use Fcntl qw(:seek);
#use SL::Auth;
+use SL::DBConnect;
use SL::DBUpgrade2;
use SL::DBUtils;
use SL::Iconv;
use SL::DBUpgrade2;
use SL::DBUtils;
use SL::Iconv;
@@
-104,9
+105,7
@@
sub login {
my %myconfig = $main::auth->read_user($self->{login});
# check if database is down
my %myconfig = $main::auth->read_user($self->{login});
# check if database is down
- my $dbh =
- DBI->connect($myconfig{dbconnect}, $myconfig{dbuser},
- $myconfig{dbpasswd})
+ my $dbh = SL::DBConnect->connect($myconfig{dbconnect}, $myconfig{dbuser}, $myconfig{dbpasswd})
or $self->error($DBI::errstr);
# we got a connection, check the version
or $self->error($DBI::errstr);
# we got a connection, check the version
@@
-145,10
+144,10
@@
sub login {
}
# update the tables
}
# 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.',
$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);
}
'back_button' => 1);
}
@@
-161,11
+160,12
@@
sub login {
$self->dbupdate($form);
$self->dbupdate2($form, $dbupdater);
$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
close(FH);
# remove lock file
- unlink(
"$main::userspath
/nologin");
+ unlink(
$::lx_office_conf{paths}->{userspath} . "
/nologin");
my $menufile =
$self->{"menustyle"} eq "v3" ? "menuv3.pl" :
my $menufile =
$self->{"menustyle"} eq "v3" ? "menuv3.pl" :
@@
-177,7
+177,6
@@
sub login {
print $form->parse_html_template("dbupgrade/footer", { "menufile" => $menufile });
$rc = -2;
print $form->parse_html_template("dbupgrade/footer", { "menufile" => $menufile });
$rc = -2;
-
}
}
}
}
@@
-252,8
+251,7
@@
sub dbsources {
$form->{sid} = $form->{dbdefault};
&dbconnect_vars($form, $form->{dbdefault});
$form->{sid} = $form->{dbdefault};
&dbconnect_vars($form, $form->{dbdefault});
- my $dbh =
- DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
+ my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
or $form->dberror;
if ($form->{dbdriver} eq 'Pg') {
or $form->dberror;
if ($form->{dbdriver} eq 'Pg') {
@@
-270,8
+268,7
@@
sub dbsources {
next if ($db =~ /^template/);
&dbconnect_vars($form, $db);
next if ($db =~ /^template/);
&dbconnect_vars($form, $db);
- my $dbh =
- DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
+ my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
or $form->dberror;
$query =
or $form->dberror;
$query =
@@
-326,7
+323,7
@@
sub dbclusterencoding {
dbconnect_vars($form, $form->{dbdefault});
dbconnect_vars($form, $form->{dbdefault});
- my $dbh =
DBI
->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) || $form->dberror();
+ my $dbh =
SL::DBConnect
->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) || $form->dberror();
my $query = qq|SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = 'template0'|;
my ($cluster_encoding) = $dbh->selectrow_array($query);
$dbh->disconnect();
my $query = qq|SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = 'template0'|;
my ($cluster_encoding) = $dbh->selectrow_array($query);
$dbh->disconnect();
@@
-344,7
+341,7
@@
sub dbcreate {
$form->{sid} = $form->{dbdefault};
&dbconnect_vars($form, $form->{dbdefault});
my $dbh =
$form->{sid} = $form->{dbdefault};
&dbconnect_vars($form, $form->{dbdefault});
my $dbh =
-
DBI
->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
+
SL::DBConnect
->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
or $form->dberror;
$form->{db} =~ s/\"//g;
my %dbcreate = (
or $form->dberror;
$form->{db} =~ s/\"//g;
my %dbcreate = (
@@
-386,7
+383,7
@@
sub dbcreate {
&dbconnect_vars($form, $form->{db});
&dbconnect_vars($form, $form->{db});
- $dbh =
DBI
->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
+ $dbh =
SL::DBConnect
->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
or $form->dberror;
my $db_charset = $Common::db_encoding_to_charset{$form->{encoding}};
or $form->dberror;
my $db_charset = $Common::db_encoding_to_charset{$form->{encoding}};
@@
-417,8
+414,7
@@
sub dbdelete {
$form->{sid} = $form->{dbdefault};
&dbconnect_vars($form, $form->{dbdefault});
$form->{sid} = $form->{dbdefault};
&dbconnect_vars($form, $form->{dbdefault});
- my $dbh =
- DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
+ my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
or $form->dberror;
my $query = $dbdelete{$form->{dbdriver}};
do_query($form, $dbh, $query);
or $form->dberror;
my $query = $dbdelete{$form->{dbdriver}};
do_query($form, $dbh, $query);
@@
-464,7
+460,7
@@
sub dbneedsupdate {
map { $form->{$_} = $member->{$_} } qw(dbname dbuser dbpasswd dbhost dbport);
dbconnect_vars($form, $form->{dbname});
map { $form->{$_} = $member->{$_} } qw(dbname dbuser dbpasswd dbhost dbport);
dbconnect_vars($form, $form->{dbname});
- my $dbh =
DBI
->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd});
+ my $dbh =
SL::DBConnect
->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd});
next unless $dbh;
next unless $dbh;
@@
-581,7
+577,7
@@
sub dbupdate {
closedir(SQLDIR);
}
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});
$db_charset ||= Common::DEFAULT_CHARSET;
my $dbupdater = SL::DBUpgrade2->new(form => $form, dbdriver => $form->{dbdriver});
@@
-594,8
+590,7
@@
sub dbupdate {
$db =~ s/^db//;
&dbconnect_vars($form, $db);
$db =~ s/^db//;
&dbconnect_vars($form, $db);
- my $dbh =
- DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
+ my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
or $form->dberror;
$dbh->do($form->{dboptions}) if ($form->{dboptions});
or $form->dberror;
$dbh->do($form->{dboptions}) if ($form->{dboptions});
@@
-648,7
+643,7
@@
sub dbupdate2 {
$form->{sid} = $form->{dbdefault};
my $rc = -2;
$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} };
map { $_->{description} = SL::Iconv::convert($_->{charset}, $db_charset, $_->{description}) } values %{ $dbupdater->{all_controls} };
@@
-659,7
+654,7
@@
sub dbupdate2 {
$db =~ s/^db//;
&dbconnect_vars($form, $db);
$db =~ s/^db//;
&dbconnect_vars($form, $db);
- my $dbh =
DBI
->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror;
+ my $dbh =
SL::DBConnect
->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror;
$dbh->do($form->{dboptions}) if ($form->{dboptions});
$dbh->do($form->{dboptions}) if ($form->{dboptions});
@@
-700,7
+695,7
@@
sub save_member {
$main::auth->save_user($self->{login}, map { $_, $self->{$_} } config_vars());
$main::auth->save_user($self->{login}, map { $_, $self->{$_} } config_vars());
- my $dbh =
DBI
->connect($self->{dbconnect}, $self->{dbuser}, $self->{dbpasswd});
+ my $dbh =
SL::DBConnect
->connect($self->{dbconnect}, $self->{dbuser}, $self->{dbpasswd});
if ($dbh) {
$self->create_employee_entry($form, $dbh, $self, 1);
$dbh->disconnect();
if ($dbh) {
$self->create_employee_entry($form, $dbh, $self, 1);
$dbh->disconnect();