Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 78783ccc

Von Bernd Bleßmann vor etwa 1 Jahr hinzugefügt

  • ID 78783cccba96bd8a4e1787aca801af8e026a9851
  • Vorgänger e4bcffbd
  • Nachfolger 9cf6252d

Order-Controller: Workflow zu Angebot/Auftrag mit S:M:R->new_from_workflow

Und converted_from_... gefixt.

Unterschiede anzeigen:

SL/Controller/Order.pm
33 33
use SL::DB::Shipto;
34 34
use SL::DB::Translation;
35 35
use SL::DB::ValidityToken;
36
use SL::DB::Helper::RecordLink qw(set_record_link_conversions);
36
use SL::DB::Helper::RecordLink qw(set_record_link_conversions RECORD_ID RECORD_ITEM_ID);
37 37
use SL::DB::Helper::TypeDataProxy;
38 38
use SL::Model::Record;
39 39
use SL::DB::Order::TypeData qw(:types);
......
877 877
    $custom_shipto = $self->order->shipto->clone('SL::DB::Order');
878 878
  }
879 879

  
880
  $self->order(SL::DB::Order->new_from($self->order, destination_type => $destination_type));
880
  my $no_linked_records =    (any { $destination_type eq $_ } (SALES_QUOTATION_TYPE(), REQUEST_QUOTATION_TYPE()))
881
                          && $from_side eq $to_side;
881 882

  
882
  # no linked records to quotations from the same side (sales -> sales or purchase -> purchase)
883
  if (    (any { $destination_type eq $_ } (SALES_QUOTATION_TYPE(), REQUEST_QUOTATION_TYPE()))
884
       && $from_side eq $to_side) {
885
    delete $::form->{id};
886
    delete $::form->{$_} for qw(converted_from_oe_id converted_from_orderitems_ids);
887
  } else {
888
    $self->{converted_from_oe_id} = delete $::form->{id};
883
  $self->order(SL::Model::Record->new_from_workflow($self->order, $destination_type, no_linked_records => $no_linked_records));
884

  
885
  delete $::form->{id};
886

  
887
  if (!$no_linked_records) {
888
    $self->{converted_from_oe_id}         = $self->order->{ RECORD_ID()      };
889
    $_   ->{converted_from_orderitems_id} = $_          ->{ RECORD_ITEM_ID() } for @{ $self->order->items_sorted };
889 890
  }
890 891

  
891 892
  # set item ids to new fake id, to identify them as new items

Auch abrufbar als: Unified diff