Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision dbf2d709

Von Sven Schöling vor mehr als 1 Jahr hinzugefügt

  • ID dbf2d709b206dd1c0f43f0224524fe04e503476e
  • Vorgänger c1f1f681
  • Nachfolger 9452d6b8

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

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
1642 1642
  my $errors = [];
1643 1643
  my $db     = $self->order->db;
1644 1644

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

  
1645 1663
  $db->with_transaction(sub {
1646 1664
    my $validity_token;
1647 1665
    if (!$self->order->id) {
......
1662 1680
    SL::DB::DeliveryOrderItem->new(id => $_)->delete for @{$self->item_ids_to_delete || []};
1663 1681
    $self->order->save(cascade => 1);
1664 1682

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

  
1683 1683
    $self->save_history('SAVED');
1684 1684

  
1685 1685
    $validity_token->delete if $validity_token;

Auch abrufbar als: Unified diff