From c5998b8a4cd70cbd06e0800ea4e7a128900a1f3f Mon Sep 17 00:00:00 2001 From: bernhard Date: Thu, 2 Dec 2021 11:44:23 +0100 Subject: [PATCH 1/3] Issue #1470: enhance POD, about old headers being discarded --- Kernel/Output/HTML/Layout.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Kernel/Output/HTML/Layout.pm b/Kernel/Output/HTML/Layout.pm index 961370f3a7..95860075b6 100644 --- a/Kernel/Output/HTML/Layout.pm +++ b/Kernel/Output/HTML/Layout.pm @@ -1623,6 +1623,7 @@ basically the same thing as executing the formerly used template HTTPHeaders.tt ); The cookies are also added here. +The previously set headers are discarded. =cut From 727e2c2a22995938b9db6a33737557bada12ba2d Mon Sep 17 00:00:00 2001 From: bernhard Date: Thu, 2 Dec 2021 11:45:46 +0100 Subject: [PATCH 2/3] Issue #1470: tidying Using "join '', ..." for concatenting the output snippets --- Kernel/Modules/AgentStatistics.pm | 159 +++++++++++++++--------------- 1 file changed, 78 insertions(+), 81 deletions(-) diff --git a/Kernel/Modules/AgentStatistics.pm b/Kernel/Modules/AgentStatistics.pm index 85771e1551..e719b16a24 100644 --- a/Kernel/Modules/AgentStatistics.pm +++ b/Kernel/Modules/AgentStatistics.pm @@ -193,23 +193,22 @@ sub OverviewScreen { } # build output - my $Output = $LayoutObject->Header( - Title => Translatable('Overview'), - Area => 'Statistics', - ); - $Output .= $LayoutObject->NavigationBar(); - - $Output .= $LayoutObject->Output( - Data => { - %Pagination, - %Param, - AccessRw => $Self->{AccessRw}, - BreadcrumbPath => $Self->{BreadcrumbPath}, - }, - TemplateFile => 'AgentStatisticsOverview', - ); - $Output .= $LayoutObject->Footer(); - return $Output; + return join '', + $LayoutObject->Header( + Title => Translatable('Overview'), + Area => 'Statistics', + ), + $LayoutObject->NavigationBar(), + $LayoutObject->Output( + Data => { + %Pagination, + %Param, + AccessRw => $Self->{AccessRw}, + BreadcrumbPath => $Self->{BreadcrumbPath}, + }, + TemplateFile => 'AgentStatisticsOverview', + ), + $LayoutObject->Footer(); } sub ImportScreen { @@ -219,20 +218,20 @@ sub ImportScreen { my %Errors = %{ $Param{Errors} // {} }; - my $Output = $LayoutObject->Header( - Title => Translatable('Import'), - Area => 'Statistics', - ); - $Output .= $LayoutObject->NavigationBar(); - $Output .= $LayoutObject->Output( - TemplateFile => 'AgentStatisticsImport', - Data => { - %Errors, - BreadcrumbPath => $Self->{BreadcrumbPath}, - }, - ); - $Output .= $LayoutObject->Footer(); - return $Output; + return join '', + $LayoutObject->Header( + Title => Translatable('Import'), + Area => 'Statistics', + ), + $LayoutObject->NavigationBar(), + $LayoutObject->Output( + TemplateFile => 'AgentStatisticsImport', + Data => { + %Errors, + BreadcrumbPath => $Self->{BreadcrumbPath}, + }, + ), + $LayoutObject->Footer(); } sub ImportAction { @@ -375,22 +374,21 @@ sub EditScreen { ); } - my $Output = $LayoutObject->Header( - Title => Translatable('Edit'), - Area => 'Statistics', - ); - $Output .= $LayoutObject->NavigationBar(); - - $Output .= $LayoutObject->Output( - TemplateFile => 'AgentStatisticsEdit', - Data => { - %Frontend, - %{$Stat}, - BreadcrumbPath => $Self->{BreadcrumbPath}, - }, - ); - $Output .= $LayoutObject->Footer(); - return $Output; + return join '', + $LayoutObject->Header( + Title => Translatable('Edit'), + Area => 'Statistics', + ), + $LayoutObject->NavigationBar(), + $LayoutObject->Output( + TemplateFile => 'AgentStatisticsEdit', + Data => { + %Frontend, + %{$Stat}, + BreadcrumbPath => $Self->{BreadcrumbPath}, + }, + ), + $LayoutObject->Footer(); } sub EditAction { @@ -757,24 +755,23 @@ sub ViewScreen { UserID => $Self->{UserID}, ); - my $Output = $LayoutObject->Header( - Title => Translatable('View'), - Area => 'Statistics', - ); - $Output .= $LayoutObject->NavigationBar(); - - $Output .= $LayoutObject->Output( - TemplateFile => 'AgentStatisticsView', - Data => { - AccessRw => $Self->{AccessRw}, - Errors => \@Errors, - %Frontend, - %{$Stat}, - BreadcrumbPath => $Self->{BreadcrumbPath}, - }, - ); - $Output .= $LayoutObject->Footer(); - return $Output; + return join '', + $LayoutObject->Header( + Title => Translatable('View'), + Area => 'Statistics', + ), + $LayoutObject->NavigationBar(), + $LayoutObject->Output( + TemplateFile => 'AgentStatisticsView', + Data => { + AccessRw => $Self->{AccessRw}, + Errors => \@Errors, + %Frontend, + %{$Stat}, + BreadcrumbPath => $Self->{BreadcrumbPath}, + }, + ), + $LayoutObject->Footer(); } sub AddScreen { @@ -830,22 +827,22 @@ sub AddScreen { $ManualVersion = $1; # build output - my $Output = $LayoutObject->Header( - Title => Translatable('Add New Statistic'), - Area => 'Statistics', - ); - $Output .= $LayoutObject->NavigationBar(); - $Output .= $LayoutObject->Output( - TemplateFile => 'AgentStatisticsAdd', - Data => { - %Frontend, - %Errors, - ManualVersion => $ManualVersion, - BreadcrumbPath => $Self->{BreadcrumbPath}, - }, - ); - $Output .= $LayoutObject->Footer(); - return $Output; + return join '', + $LayoutObject->Header( + Title => Translatable('Add New Statistic'), + Area => 'Statistics', + ), + $LayoutObject->NavigationBar(), + $LayoutObject->Output( + TemplateFile => 'AgentStatisticsAdd', + Data => { + %Frontend, + %Errors, + ManualVersion => $ManualVersion, + BreadcrumbPath => $Self->{BreadcrumbPath}, + }, + ), + $LayoutObject->Footer(); } sub AddAction { From 32119fa1512df9624de7a5da7650bbe7f9874fee Mon Sep 17 00:00:00 2001 From: bernhard Date: Thu, 2 Dec 2021 11:46:50 +0100 Subject: [PATCH 3/3] Issue #1470: declare the HTML snippet as UTF-8 --- Kernel/Modules/AgentStatistics.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Kernel/Modules/AgentStatistics.pm b/Kernel/Modules/AgentStatistics.pm index e719b16a24..9e86209c08 100644 --- a/Kernel/Modules/AgentStatistics.pm +++ b/Kernel/Modules/AgentStatistics.pm @@ -1056,8 +1056,10 @@ sub GeneralSpecificationsWidgetAJAX { my ( $Self, %Param ) = @_; my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout'); + return $LayoutObject->Attachment( ContentType => 'text/html', + Charset => 'utf-8', Content => $Kernel::OM->Get('Kernel::Output::HTML::Statistics::View')->GeneralSpecificationsWidget( UserID => $Self->{UserID} ), Type => 'inline', NoCache => 1,