X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fadmin.pl;h=160d303660a90694fef462ac456d7bc395f2add6;hb=e74c2ab4728dfdc932cd290db005ce2250e9d61b;hp=6af37b3de5f39a2c8ea0c8c02775002a99d5784c;hpb=db1ee56f0601a775332dfce59ad9273a8149c391;p=kivitendo-erp.git diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index 6af37b3de..160d30366 100644 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -176,6 +176,18 @@ sub create_auth_tables { $auth->set_session_value('rpw', $form->{rpw}); $auth->create_or_refresh_session(); + if (!-f $memberfile) { + # New installation -- create a standard group with full access + my $group = { + 'name' => $locale->text('Full Access'), + 'description' => $locale->text('Full access to all functions'), + 'rights' => { map { $_ => 1 } SL::Auth::all_rights() }, + 'members' => [ map { $_->{id} } values %members ], + }; + + $auth->save_group($group); + } + login(); } @@ -628,12 +640,29 @@ sub dbselect_source { $form->{title} = "Lx-Office ERP / " . $locale->text('Database Administration'); - $form->{ALLOW_DBBACKUP} = "$pg_dump_exe" ne "DISABLED"; + # Intentionnaly disabled unless fixed to work with the authentication DB. + $form->{ALLOW_DBBACKUP} = 0; # "$pg_dump_exe" ne "DISABLED"; $form->header(); print $form->parse_html_template("admin/dbadmin"); } +sub test_db_connection { + $form->{dbdriver} = 'Pg'; + User::dbconnect_vars($form, $form->{dbname}); + + my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}); + + $form->{connection_ok} = $dbh ? 1 : 0; + $form->{errstr} = $DBI::errstr; + + $dbh->disconnect() if ($dbh); + + $form->{title} = $locale->text('Database Connection Test'); + $form->header(); + print $form->parse_html_template("admin/test_db_connection"); +} + sub continue { call_sub($form->{"nextsub"}); } @@ -692,7 +721,7 @@ sub dbupdate { } sub create_dataset { - $form->{dbsources} = join " ", map { "[${_}]" } sort User->dbsources(\%$form); + $form->{dbsources} = join " ", map { "[${_}]" } sort User->dbsources($form); $form->{CHARTS} = []; @@ -708,12 +737,24 @@ sub create_dataset { my $default_charset = $dbcharset; $default_charset ||= Common::DEFAULT_CHARSET; - $form->{DBENCODINGS} = []; + my $cluster_encoding = User->dbclusterencoding($form); + if ($cluster_encoding && ($cluster_encoding =~ m/^(?:UTF-?8|UNICODE)$/i)) { + if ($dbcharset !~ m/^UTF-?8$/i) { + $form->show_generic_error($locale->text('The selected PostgreSQL installation uses UTF-8 as its encoding. ' . + 'Therefore you have to configure Lx-Office to use UTF-8 as well.'), + 'back_button' => 1); + } - foreach my $encoding (@Common::db_encodings) { - push @{ $form->{DBENCODINGS} }, { "dbencoding" => $encoding->{dbencoding}, - "label" => $encoding->{label}, - "selected" => $encoding->{charset} eq $default_charset }; + $form->{FORCE_DBENCODING} = 'UNICODE'; + + } else { + $form->{DBENCODINGS} = []; + + foreach my $encoding (@Common::db_encodings) { + push @{ $form->{DBENCODINGS} }, { "dbencoding" => $encoding->{dbencoding}, + "label" => $encoding->{label}, + "selected" => $encoding->{charset} eq $default_charset }; + } } $form->{title} =