Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ed04f337

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

  • ID ed04f337a0e565a3d0621a10bd273298e33c7fa1
  • Vorgänger e8889e47
  • Nachfolger 46d3bb6e

Auftrags-Controller: longdescription

Unterschiede anzeigen:

SL/Controller/Order.pm
481 481
  $self->render_price_dialog($item);
482 482
}
483 483

  
484
sub action_get_item_longdescription {
485
  my $longdescription;
486

  
487
  if ($::form->{item_id}) {
488
    $longdescription = SL::DB::OrderItem->new(id => $::form->{item_id})->load->longdescription;
489
  } elsif ($::form->{parts_id}) {
490
    $longdescription = SL::DB::Part->new(id => $::form->{parts_id})->load->notes;
491
  }
492
  $_[0]->render(\ $longdescription, { type => 'text' });
493
}
494

  
495

  
484 496
sub _js_redisplay_linetotals {
485 497
  my ($self) = @_;
486 498

  
......
684 696
  my $item;
685 697
  $item = first { $_->id == $attr->{id} } @{$record->items} if $attr->{id};
686 698

  
699
  my $is_new = !$item;
700

  
687 701
  # add_custom_variables adds cvars to an orderitem with no cvars for saving, but
688 702
  # they cannot be retrieved via custom_variables until the order/orderitem is
689 703
  # saved. Adding empty custom_variables to new orderitem here solves this problem.
690 704
  $item ||= SL::DB::OrderItem->new(custom_variables => []);
705

  
691 706
  $item->assign_attributes(%$attr);
707
  $item->longdescription($item->part->notes) if $is_new && !defined $attr->{longdescription};
692 708

  
693 709
  return $item;
694 710
}
......
735 751
  $new_attr{active_price_source}    = $price_src;
736 752
  $new_attr{active_discount_source} = $discount_src;
737 753

  
754
  $new_attr{longdescription}        = $part->notes if ! defined $attr->{longdescription};
755

  
738 756
  # add_custom_variables adds cvars to an orderitem with no cvars for saving, but
739 757
  # they cannot be retrieved via custom_variables until the order/orderitem is
740 758
  # saved. Adding empty custom_variables to new orderitem here solves this problem.
......
770 788
  my ($self) = @_;
771 789

  
772 790
  foreach my $item (@{ $self->order->items }) {
773
    if ($item->id) {
774
      # load data from orderitems (db)
775
      my $db_item = SL::DB::OrderItem->new(id => $item->id)->load;
776
      $item->$_($db_item->$_) for qw(longdescription);
777
    } else {
778
      # set data from part (or other sources)
779
      $item->longdescription($item->part->notes);
780
    }
781

  
782 791
    # autovivify all cvars that are not in the form (cvars_by_config can do it).
783 792
    # workaround to pre-parse number-cvars (parse_custom_variable_values does not parse number values).
784 793
    foreach my $var (@{ $item->cvars_by_config }) {
......
863 872
                                                } } @all_objects;
864 873
  }
865 874

  
866
  $::request->{layout}->use_javascript("${_}.js")  for qw(ckeditor/ckeditor ckeditor/adapters/jquery);
875
  $::request->{layout}->use_javascript("${_}.js")  for qw(kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery);
867 876
}
868 877

  
869 878
sub _create_pdf {

Auch abrufbar als: Unified diff