From: Moritz Bunkus Date: Fri, 17 Mar 2017 10:53:45 +0000 (+0100) Subject: ReportGenerator: Action-Bar-Actions über Hook-Funktion ausgeben lassen können X-Git-Tag: release-3.5.4~1196 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=76a39ab4f52c7f25d18bb7dc714262ac8d400720;p=kivitendo-erp.git ReportGenerator: Action-Bar-Actions über Hook-Funktion ausgeben lassen können Damit ist es möglich, dass die Actions vom Report-Generator zwischen den Actions der Hauptmaske eingefügt werden. --- diff --git a/SL/ReportGenerator.pm b/SL/ReportGenerator.pm index a62f0e46a..3b03f5aa1 100644 --- a/SL/ReportGenerator.pm +++ b/SL/ReportGenerator.pm @@ -415,8 +415,8 @@ sub prepare_html_content { return $variables; } -sub setup_action_bar { - my ($self, $action_bar, $variables) = @_; +sub create_action_bar_actions { + my ($self, $variables) = @_; my @actions; foreach my $type (qw(pdf csv)) { @@ -441,8 +441,21 @@ sub setup_action_bar { ); } - $action_bar = ($::request->layout->get('actionbar'))[0] unless blessed($action_bar); - $action_bar->add(@actions) if @actions; + return @actions; +} + +sub setup_action_bar { + my ($self, $variables, %params) = @_; + + my @actions = $self->create_action_bar_actions($variables); + + if ($params{action_bar_setup_hook}) { + $params{action_bar_setup_hook}->(@actions); + + } elsif (@actions) { + my $action_bar = blessed($params{action_bar}) ? $params{action_bar} : ($::request->layout->get('actionbar'))[0]; + $action_bar->add(@actions); + } } sub generate_html_content { @@ -452,7 +465,7 @@ sub generate_html_content { my $variables = $self->prepare_html_content(%params); - $self->setup_action_bar($params{action_bar}, $variables) if $params{action_bar}; + $self->setup_action_bar($variables, %params) if $params{action_bar}; my $stuff = $self->{form}->parse_html_template($self->{options}->{html_template}, $variables); return $stuff;