Merge branch 'master' of git@lx-office.linet-services.de:lx-office-erp
authorSven Schöling <s.schoeling@linet-services.de>
Fri, 15 Apr 2011 09:51:32 +0000 (11:51 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Fri, 15 Apr 2011 09:51:32 +0000 (11:51 +0200)
1  2 
SL/Auth.pm
SL/Form.pm

diff --combined SL/Auth.pm
@@@ -13,6 -13,7 +13,7 @@@ use SL::Auth::DB
  use SL::Auth::LDAP;
  
  use SL::User;
+ use SL::DBConnect;
  use SL::DBUpgrade2;
  use SL::DBUtils;
  
@@@ -38,7 -39,7 +39,7 @@@ sub new 
  sub get_user_dbh {
    my ($self, $login) = @_;
    my %user = $self->read_user($login);
-   my $dbh  = DBI->connect(
+   my $dbh  = SL::DBConnect->connect(
      $user{dbconnect},
      $user{dbuser},
      $user{dbpasswd},
@@@ -166,7 -167,7 +167,7 @@@ sub dbconnect 
  
    $main::lxdebug->message(LXDebug->DEBUG1, "Auth::dbconnect DSN: $dsn");
  
-   $self->{dbh} = DBI->connect($dsn, $cfg->{user}, $cfg->{password}, { pg_enable_utf8 => $::locale->is_utf8, AutoCommit => 1 });
+   $self->{dbh} = SL::DBConnect->connect($dsn, $cfg->{user}, $cfg->{password}, { pg_enable_utf8 => $::locale->is_utf8, AutoCommit => 1 });
  
    if (!$may_fail && !$self->{dbh}) {
      $main::form->error($main::locale->text('The connection to the authentication database failed:') . "\n" . $DBI::errstr);
@@@ -246,7 -247,7 +247,7 @@@ sub create_database 
    my $encoding   = $Common::charset_to_db_encoding{$charset};
    $encoding    ||= 'UNICODE';
  
-   my $dbh        = DBI->connect($dsn, $params{superuser}, $params{superuser_password}, { pg_enable_utf8 => $charset =~ m/^utf-?8$/i });
+   my $dbh        = SL::DBConnect->connect($dsn, $params{superuser}, $params{superuser_password}, { pg_enable_utf8 => $charset =~ m/^utf-?8$/i });
  
    if (!$dbh) {
      $main::form->error($main::locale->text('The connection to the template database failed:') . "\n" . $DBI::errstr);
@@@ -970,7 -971,7 +971,7 @@@ sub delete_group 
    my $self = shift;
    my $id   = shift;
  
 -  my $form = $main::from;
 +  my $form = $main::form;
  
    my $dbh  = $self->dbconnect();
    $dbh->begin_work;
diff --combined SL/Form.pm
@@@ -52,6 -52,7 +52,7 @@@ use SL::AM
  use SL::Common;
  use SL::CVar;
  use SL::DB;
+ use SL::DBConnect;
  use SL::DBUtils;
  use SL::DO;
  use SL::IC;
@@@ -745,7 -746,7 +746,7 @@@ sub redirect_header 
    my $base_uri = $self->_get_request_uri;
    my $new_uri  = URI->new_abs($new_url, $base_uri);
  
 -  die "Headers already sent" if $::self->{header};
 +  die "Headers already sent" if $self->{header};
    $self->{header} = 1;
  
    my $cgi = $main::cgi || CGI->new('');
@@@ -1582,7 -1583,7 +1583,7 @@@ sub dbconnect 
    my ($self, $myconfig) = @_;
  
    # connect to database
-   my $dbh = DBI->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options)
+   my $dbh = SL::DBConnect->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options)
      or $self->dberror;
  
    # set db options
@@@ -1601,7 -1602,7 +1602,7 @@@ sub dbconnect_noauto 
    my ($self, $myconfig) = @_;
  
    # connect to database
-   my $dbh = DBI->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options(AutoCommit => 0))
+   my $dbh = SL::DBConnect->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options(AutoCommit => 0))
      or $self->dberror;
  
    # set db options