X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDBUpgrade2.pm;h=af5037acc4be9527311234738856abc375c29121;hb=89c9ff022d3f13e27ba6bda085df15707fcfb0eb;hp=cbb8b9fb9e2daae2168fc04dad66de7225e83a42;hpb=486fe464fc69883e89ce37518473bfb688354d6f;p=kivitendo-erp.git diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index cbb8b9fb9..af5037acc 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -4,6 +4,7 @@ use IO::File; use List::MoreUtils qw(any); use SL::Common; +use SL::DBUtils; use SL::Iconv; use strict; @@ -329,8 +330,6 @@ sub update2_available { sub unapplied_upgrade_scripts { my ($self, $dbh) = @_; - $::lxdebug->dump(0, "self", $self); - my @all_scripts = map { $_->{applied} = 0; $_ } $self->sort_dbupdate_controls; my $query = qq|SELECT tag FROM | . $self->{schema} . qq|schema_info|; @@ -347,20 +346,23 @@ sub unapplied_upgrade_scripts { sub apply_admin_dbupgrade_scripts { my ($self, $called_from_admin) = @_; - return if !$self->{auth}; + return 0 if !$self->{auth}; my $dbh = $::auth->dbconnect; my @unapplied_scripts = $self->unapplied_upgrade_scripts($dbh); - return if !@unapplied_scripts; + return 0 if !@unapplied_scripts; - my $db_charset = $main::dbcharset || Common::DEFAULT_CHARSET; + my $db_charset = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET; $self->{form}->{login} ||= 'admin'; map { $_->{description} = SL::Iconv::convert($_->{charset}, $db_charset, $_->{description}) } values %{ $self->{all_controls} }; - $self->{form}->{title} = $::locale->text('Dataset upgrade'); - $self->{form}->header; + if ($called_from_admin) { + $self->{form}->{title} = $::locale->text('Dataset upgrade'); + $self->{form}->header; + } + print $self->{form}->parse_html_template("dbupgrade/header", { dbname => $::auth->{DB_config}->{db} }); foreach my $control (@unapplied_scripts) { @@ -370,8 +372,9 @@ sub apply_admin_dbupgrade_scripts { $self->process_file($dbh, "sql/$self->{dbdriver}-upgrade2-auth/$control->{file}", $control, $db_charset); } - print $self->{form}->parse_html_template("dbupgrade/footer", { is_admin => $called_from_admin }); - ::end_of_request(); + print $self->{form}->parse_html_template("dbupgrade/footer", { is_admin => 1 }) if $called_from_admin; + + return 1; } sub _check_for_loops {