Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9eb765a5

Von Bernd Bleßmann vor fast 8 Jahren hinzugefügt

  • ID 9eb765a5e78cea60962849c8bf0879da85adeff1
  • Vorgänger 28a7a539
  • Nachfolger 93a613de

Auftrags-Controller: zweite Zeile laden mit Icons und alle zweiten Zeilen 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)
597
# load the second row for one or more items (cvars only for now)
598 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 {
599
# This action gets the html code for all items second rows by rendering a template for
600
# the second row and sets the html code via client js.
601
sub action_load_second_rows {
602 602
  my ($self) = @_;
603 603

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

  
608
    $self->_js_load_second_row($item, $item_id, 0);
609
  }
610

  
611
  $self->js->render();
612
}
606 613

  
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
sub _js_load_second_row {
615
  my ($self, $item, $item_id, $do_parse) = @_;
616

  
617
  if ($do_parse) {
618
    # Parse values from form (they are formated while rendering (template)).
619
    # Workaround to pre-parse number-cvars (parse_custom_variable_values does not parse number values).
620
    # This parsing is not necessary at all, if we assure that the second row/cvars are only loaded once.
621
    foreach my $var (@{ $item->cvars_by_config }) {
622
      $var->unparsed_value($::form->parse_amount(\%::myconfig, $var->{__unparsed_value})) if ($var->config->type eq 'number' && exists($var->{__unparsed_value}));
623
    }
624
    $item->parse_custom_variable_values;
625
  }
614 626

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

  
617 629
  $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();
630
    ->html('.row_entry:has(#item_' . $item_id . ') [name = "second_row"]', $row_as_html)
631
    ->data('.row_entry:has(#item_' . $item_id . ') [name = "second_row"]', 'loaded', 1);
621 632
}
622 633

  
623 634
sub _js_redisplay_linetotals {

Auch abrufbar als: Unified diff