From: Moritz Bunkus Date: Fri, 1 Apr 2016 09:13:16 +0000 (+0200) Subject: QuickSearch: nicht anzeigen, wenn Datenbankupgrades eingespielt werden müssen X-Git-Tag: release-3.4.1~267 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=83de52f1124a71c6688a04e0c0acd841f6188d0f;p=kivitendo-erp.git QuickSearch: nicht anzeigen, wenn Datenbankupgrades eingespielt werden müssen QuickSearch hat seine Konfiguration in gewissen Spalten in der Datenbank. Um auf diese zugreifen zu können, müssen die dazugehörigen Datenbankupgrades bereits eingespielt worden sein. Da das Menü und damit die QuickSearch-Items auch während des Einspielens der Upgrades angezeigt werden, kann es also dazu führen, dass die Spalten noch nicht existieren. Daher wird QuickSearch nun komplett deaktiviert, solange ausstehende Datenbankupgrades existieren. --- diff --git a/SL/Layout/Top.pm b/SL/Layout/Top.pm index 2ae61cb05..05c0046e1 100644 --- a/SL/Layout/Top.pm +++ b/SL/Layout/Top.pm @@ -8,11 +8,17 @@ use SL::Controller::TopQuickSearch; sub pre_content { my ($self) = @_; + my @options; + # Only enable the quick search functionality if all database + # upgrades have already been applied as quick search requires + # certain columns that are only created by said database upgrades. + push @options, (quick_search => SL::Controller::TopQuickSearch->new) unless $::request->applying_database_upgrades; + $self->presenter->render('menu/header', now => DateTime->now_local, is_fastcgi => $::dispatcher ? scalar($::dispatcher->interface_type =~ /fastcgi/i) : 0, is_links => scalar($ENV{HTTP_USER_AGENT} =~ /links/i), - quick_search => SL::Controller::TopQuickSearch->new, + @options, ); } diff --git a/SL/Request.pm b/SL/Request.pm index f72694d1c..8d62f17d0 100644 --- a/SL/Request.pm +++ b/SL/Request.pm @@ -18,6 +18,7 @@ our @EXPORT_OK = qw(flatten unflatten read_cgi_input); use Rose::Object::MakeMethods::Generic ( + scalar => [ qw(applying_database_upgrades) ], 'scalar --get_set_init' => [ qw(cgi layout presenter is_ajax type) ], ); diff --git a/SL/User.pm b/SL/User.pm index fe2152ece..37e1a9b5f 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -133,6 +133,11 @@ sub login { return LOGIN_OK(); } + # Store the fact that we're applying database upgrades at the + # moment. That way functions called from the layout modules that may + # require updated tables can chose only to use basic features. + $::request->applying_database_upgrades(1); + $form->{$_} = $::auth->client->{$_} for qw(dbname dbhost dbport dbuser dbpasswd); $form->{$_} = $myconfig{$_} for qw(datestyle);