Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision cfb00178

Von Sven Schöling vor etwa 1 Jahr hinzugefügt

  • ID cfb00178861ca67f5ff2cf601127ebaafa9d5034
  • Vorgänger 561da2be
  • Nachfolger 6ec94844

RecordLink: in controller vor dem Speichern und ausserhalb der TX behandeln

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
1646 1646
    return [t8('The action you\'ve chosen has not been executed because the document does not contain any item yet.')];
1647 1647
  }
1648 1648

  
1649
  # link records
1650
  if ($::form->{converted_from_oe_id}) {
1651
    my @converted_from_oe_ids = split ' ', $::form->{converted_from_oe_id};
1652
    set_record_link_conversions(
1653
      $self->order,
1654
      'SL::DB::Order'     => \@converted_from_oe_ids,
1655
      'SL::DB::OrderItem' => $::form->{converted_from_orderitems_ids},
1656
    );
1657
  }
1658
  if ($::form->{converted_from_reclamation_id}) {
1659
    my @converted_from_reclamation_ids = split ' ', $::form->{converted_from_reclamation_id};
1660
    set_record_link_conversions(
1661
      $self->order,
1662
      'SL::DB::Reclamation'     => \@converted_from_reclamation_ids,
1663
      'SL::DB::ReclamationItem' => $::form->{converted_from_reclamation_items_ids},
1664
    );
1665
  }
1666

  
1649 1667
  $db->with_transaction(sub {
1650 1668
    my $validity_token;
1651 1669
    if (!$self->order->id) {
......
1666 1684
    SL::DB::DeliveryOrderItem->new(id => $_)->delete for @{$self->item_ids_to_delete || []};
1667 1685
    $self->order->save(cascade => 1);
1668 1686

  
1669
    # link records
1670
    if ($::form->{converted_from_oe_id}) {
1671
      my @converted_from_oe_ids = split ' ', $::form->{converted_from_oe_id};
1672
      set_record_link_conversions(
1673
        $self->order,
1674
        'SL::DB::Order'     => \@converted_from_oe_ids,
1675
        'SL::DB::OrderItem' => $::form->{converted_from_orderitems_ids},
1676
      );
1677
    }
1678
    if ($::form->{converted_from_reclamation_id}) {
1679
      my @converted_from_reclamation_ids = split ' ', $::form->{converted_from_reclamation_id};
1680
      set_record_link_conversions(
1681
        $self->order,
1682
        'SL::DB::Reclamation'     => \@converted_from_reclamation_ids,
1683
        'SL::DB::ReclamationItem' => $::form->{converted_from_reclamation_items_ids},
1684
      );
1685
    }
1686

  
1687 1687
    $self->save_history('SAVED');
1688 1688

  
1689 1689
    $validity_token->delete if $validity_token;
SL/Controller/Order.pm
2197 2197
    $self->order->add_phone_notes($phone_note) if $is_new;
2198 2198
  }
2199 2199

  
2200
  my @converted_from_oe_ids;
2201
  if ($::form->{converted_from_oe_id}) {
2202
    @converted_from_oe_ids = split ' ', $::form->{converted_from_oe_id};
2203
    set_record_link_conversions(
2204
      $self->order,
2205
      'SL::DB::Order'     => \@converted_from_oe_ids,
2206
      'SL::DB::OrderItem' => $::form->{converted_from_orderitems_ids},
2207
    );
2208
  }
2209
  if ($::form->{converted_from_reclamation_id}) {
2210
    my @converted_from_reclamation_ids = split ' ', $::form->{converted_from_reclamation_id};
2211
    set_record_links_conversions(
2212
      $self->order,
2213
      'SL::DB::Reclamation'     => \@converted_from_reclamation_ids,
2214
      'SL::DB::ReclamationItem' => $::form->{converted_from_reclamation_items_ids},
2215
    );
2216
  }
2217

  
2200 2218
  my $is_new = !$self->order->id;
2201 2219
  $db->with_transaction(sub {
2202 2220
    my $validity_token;
......
2221 2239
    SL::DB::OrderVersion->new(oe_id => $self->order->id, version => 1)->save unless scalar @{ $self->order->order_version };
2222 2240

  
2223 2241
    # link records
2224
    if ($::form->{converted_from_oe_id}) {
2225
      my @converted_from_oe_ids = split ' ', $::form->{converted_from_oe_id};
2226
      set_record_link_conversions(
2227
        $self->order,
2228
        'SL::DB::Order'     => \@converted_from_oe_ids,
2229
        'SL::DB::OrderItem' => $::form->{converted_from_orderitems_ids},
2230
      );
2231

  
2242
    if (@converted_from_oe_ids) {
2232 2243
      $self->link_requirement_specs_linking_to_created_from_objects(@converted_from_oe_ids);
2233 2244
    }
2234
    if ($::form->{converted_from_reclamation_id}) {
2235
      my @converted_from_reclamation_ids = split ' ', $::form->{converted_from_reclamation_id};
2236
      set_record_links_conversions(
2237
        $self->order,
2238
        'SL::DB::Reclamation'     => \@converted_from_reclamation_ids,
2239
        'SL::DB::ReclamationItem' => $::form->{converted_from_reclamation_items_ids},
2240
      );
2241
    }
2242 2245

  
2243 2246
    $self->set_project_in_linked_requirement_specs if $self->order->globalproject_id;
2244 2247

  

Auch abrufbar als: Unified diff