Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 28a7a539

Von Bernd Bleßmann vor mehr als 7 Jahren hinzugefügt

  • ID 28a7a5397bb2363fe72f9f43759d429535e29391
  • Vorgänger 76592c8a
  • Nachfolger 9eb765a5

Auftrags-Controller: zweite Zeile (im Moment Cvars) nur bei Bedarf laden.

Unterschiede anzeigen:

SL/Controller/Order.pm
594 594
  $_[0]->render(\ $longdescription, { type => 'text' });
595 595
}
596 596

  
597
# load the second row for an item (cvars only for now)
598
#
599
# This action gets the html code for the items second row by rendering a template for
600
# the second row and calls a javascript function with this html code via client js.
601
sub action_load_second_row {
602
  my ($self) = @_;
603

  
604
  my $idx  = first_index { $_ eq $::form->{item_id} } @{ $::form->{orderitem_ids} };
605
  my $item = $self->order->items_sorted->[$idx];
606

  
607
  # Parse values from form (they are formated while rendering (template)).
608
  # Workaround to pre-parse number-cvars (parse_custom_variable_values does not parse number values).
609
  # This parsing is not necessary at all, if we assure that the second row/cvars are only loaded once.
610
  #foreach my $var (@{ $item->cvars_by_config }) {
611
  #  $var->unparsed_value($::form->parse_amount(\%::myconfig, $var->{__unparsed_value})) if ($var->config->type eq 'number' && exists($var->{__unparsed_value}));
612
  #}
613
  #$item->parse_custom_variable_values;
614

  
615
  my $row_as_html = $self->p->render('order/tabs/_second_row', ITEM => $item);
616

  
617
  $self->js
618
    ->html('.row_entry:has(#item_' . $::form->{item_id} . ') [name = "second_row"]', $row_as_html)
619
    ->data('.row_entry:has(#item_' . $::form->{item_id} . ') [name = "second_row"]', 'loaded', 1)
620
    ->render();
621
}
622

  
597 623
sub _js_redisplay_linetotals {
598 624
  my ($self) = @_;
599 625

  
......
1289 1315
C<show_multi_items_dialog> does not use the currently inserted string for
1290 1316
filtering.
1291 1317

  
1292
=item * Performance
1293

  
1294
Rendering a 50 items order takes twice as long as the old code.
1295

  
1296
90% of that is rendering the (hidden) second rows, and 50% of those again are
1297
checks for is_valid and C<INCLUDE> on the cvar input template.
1298

  
1299
Suggestion: fetch second rows when asked for.
1300

  
1301 1318
=back
1302 1319

  
1303 1320
=head1 AUTHOR

Auch abrufbar als: Unified diff