Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 36c6b73d

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

  • ID 36c6b73da09070d1ae05a9d81f483a57cb699079
  • Vorgänger 5775d2c6
  • Nachfolger bf39d621

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

Und converted_from_... gefixt.

Unterschiede anzeigen:

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

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

  
863
  # no linked records to quotations from the same side (sales -> sales or purchase -> purchase)
864
  if (    (any { $destination_type eq $_ } (SALES_QUOTATION_TYPE(), REQUEST_QUOTATION_TYPE()))
865
       && $from_side eq $to_side) {
866
    delete $::form->{id};
867
    delete $::form->{$_} for qw(converted_from_oe_id converted_from_orderitems_ids);
868
  } else {
869
    $self->{converted_from_oe_id} = delete $::form->{id};
864
  $self->order(SL::Model::Record->new_from_workflow($self->order, $destination_type, no_linked_records => $no_linked_records));
865

  
866
  delete $::form->{id};
867

  
868
  if (!$no_linked_records) {
869
    $self->{converted_from_oe_id}         = $self->order->{ RECORD_ID()      };
870
    $_   ->{converted_from_orderitems_id} = $_          ->{ RECORD_ITEM_ID() } for @{ $self->order->items_sorted };
870 871
  }
871 872

  
872 873
  # set item ids to new fake id, to identify them as new items

Auch abrufbar als: Unified diff