From c2b696438dc7c9e4b0bc7644f73604ccfdb22ee7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Mon, 9 Sep 2013 18:10:47 +0200 Subject: [PATCH] SellPriceInformation: Layout nicht mit generieren. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Spart 10 Requests und umgeht einen interessanten Browserbug - Javascripte die aus ajax Request html eingelesen werden, werden vom Broweser mit einer zufälligen Nummer versehen um ein 304 zu vermeiden. Das hat gerade bei schwachen Leitungen zu massiv unnötigen Requests geführt. --- SL/Controller/Helper/ReportGenerator.pm | 8 +++++++- SL/Controller/SellPriceInformation.pm | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/SL/Controller/Helper/ReportGenerator.pm b/SL/Controller/Helper/ReportGenerator.pm index 3cf2622a7..0cf376df4 100644 --- a/SL/Controller/Helper/ReportGenerator.pm +++ b/SL/Controller/Helper/ReportGenerator.pm @@ -89,6 +89,7 @@ sub report_generator_list_objects { croak "Parameter 'objects' must exist and be an array reference" if ref($params{objects}) ne 'ARRAY'; croak "Parameter 'report' must exist and be an instance of SL::ReportGenerator" if ref($params{report}) ne 'SL::ReportGenerator'; croak "Parameter 'options', if exists, must be a hash reference" if $params{options} && (ref($params{options}) ne 'HASH'); + $params{layout} //= 1; my $column_defs = $params{report}->{columns}; my @columns = $params{report}->get_visible_columns; @@ -110,7 +111,12 @@ sub report_generator_list_objects { $params{report}->add_data(\%data); } - return $params{report}->generate_with_headers(%{ $params{options} || {}}); + if ($params{layout}) { + return $params{report}->generate_with_headers(%{ $params{options} || {}}); + } else { + my $html = $params{report}->generate_html_content(%{ $params{options} || {}}); + $self->render(\$html , { layout => 0, process => 0 }); + } } 1; diff --git a/SL/Controller/SellPriceInformation.pm b/SL/Controller/SellPriceInformation.pm index 8e0c52d86..ddaf76549 100644 --- a/SL/Controller/SellPriceInformation.pm +++ b/SL/Controller/SellPriceInformation.pm @@ -20,7 +20,7 @@ sub action_list { ); my $db_args = $self->setup_for_list(%list_params); - $self->{pages} = SL::DB::Manager::OrderItem->paginate(%list_params, args => $db_args, per_page => 10); + $self->{pages} = SL::DB::Manager::OrderItem->paginate(%list_params, args => $db_args, per_page => 5); my $bottom = $::form->parse_html_template('price_information/report_bottom', { SELF => $self }); @@ -34,7 +34,7 @@ sub action_list { my $orderitems = SL::DB::Manager::OrderItem->get_all(%$db_args); - $self->report_generator_list_objects(report => $self->{report}, objects => $orderitems, options => { no_layout => 1 }); + $self->report_generator_list_objects(report => $self->{report}, objects => $orderitems, layout => 0, header => 0); } # private functions -- 2.20.1