From: Moritz Bunkus Date: Tue, 30 Nov 2010 09:53:47 +0000 (+0100) Subject: Auth-DB auch bei Benutzerlogins aktualisieren, sofern notwendig X-Git-Tag: release-2.6.2beta1~17^2~11^2~1 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=2da6fbfbbb3c708bd7a33057026e369b1be61bc3;p=kivitendo-erp.git Auth-DB auch bei Benutzerlogins aktualisieren, sofern notwendig --- diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index cbb8b9fb9..f30859963 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -347,20 +347,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; $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 +373,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 { diff --git a/SL/User.pm b/SL/User.pm index 6edcbc603..024a683db 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -161,6 +161,7 @@ sub login { $self->dbupdate($form); $self->dbupdate2($form, $dbupdater); + SL::DBUpgrade2->new(form => $::form, dbdriver => 'Pg', auth => 1)->apply_admin_dbupgrade_scripts(0); close(FH); @@ -177,7 +178,6 @@ sub login { print $form->parse_html_template("dbupgrade/footer", { "menufile" => $menufile }); $rc = -2; - } } diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index 11d61e8a4..2819da00e 100755 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -1167,7 +1167,7 @@ sub dispatcher { } sub _apply_dbupgrade_scripts { - SL::DBUpgrade2->new(form => $::form, dbdriver => 'Pg', auth => 1)->parse_dbupdate_controls->apply_admin_dbupgrade_scripts(1); + ::end_of_request() if SL::DBUpgrade2->new(form => $::form, dbdriver => 'Pg', auth => 1)->apply_admin_dbupgrade_scripts(1); } 1;