Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a7fcc393

Von Tamino Steinert vor fast 2 Jahren hinzugefügt

  • ID a7fcc393f21103af23c7cee58e817965213aac4e
  • Vorgänger 324e040e
  • Nachfolger ca076e26

Reclamation: don't save order after converting

Unterschiede anzeigen:

SL/Controller/Order.pm
97 97

  
98 98
  require SL::DB::Reclamation;
99 99
  my $reclamation = SL::DB::Reclamation->new(id => $::form->{from_id})->load;
100
  my $order = $reclamation->convert_to_order();
100
  my %params;
101
  $params{destination_type} = $reclamation->is_sales ? 'sales_order'
102
                                              : 'purchase_order';
103
  my $order = SL::DB::Order->new_from($reclamation, %params);
104
  $self->{converted_from_reclamation_id} = $::form->{from_id};
101 105

  
102 106
  $self->order($order);
103 107

  
......
1609 1613
  $self->js
1610 1614
    ->val('#id', $self->order->id)
1611 1615
    ->val('#converted_from_oe_id', '')
1616
    ->val('#converted_from_reclamation_id', '')
1612 1617
    ->val('#order_' . $self->nr_key(), $self->order->number);
1613 1618

  
1614 1619
  my $idx = 0;
......
1623 1628
    $idx++;
1624 1629
  }
1625 1630
  $self->js->val('[name="converted_from_orderitems_ids[+]"]', '');
1631
  $self->js->val('[name="converted_from_reclamation_items_ids[+]"]', '');
1626 1632
}
1627 1633

  
1628 1634
#
......
2157 2163

  
2158 2164
      $self->link_requirement_specs_linking_to_created_from_objects(@converted_from_oe_ids);
2159 2165
    }
2166
    if ($::form->{converted_from_reclamation_id}) {
2167
      my @converted_from_reclamation_ids = split ' ', $::form->{converted_from_reclamation_id};
2168

  
2169
      foreach my $converted_from_reclamation_id (@converted_from_reclamation_ids) {
2170
        my $src = SL::DB::Reclamation->new(id => $converted_from_reclamation_id)->load;
2171
        $src->link_to_record($self->order);
2172
      }
2173
      if (scalar @{ $::form->{converted_from_reclamation_items_ids} || [] }) {
2174
        my $idx = 0;
2175
        foreach (@{ $self->order->items_sorted }) {
2176
          my $from_id = $::form->{converted_from_reclamation_items_ids}->[$idx];
2177
          next if !$from_id;
2178
          SL::DB::RecordLink->new(from_table => 'reclamation_items',
2179
                                  from_id    => $from_id,
2180
                                  to_table   => 'orderitems',
2181
                                  to_id      => $_->id
2182
          )->save;
2183
          $idx++;
2184
        }
2185
      }
2186
    }
2160 2187

  
2161 2188
    $self->set_project_in_linked_requirement_specs if $self->order->globalproject_id;
2162 2189

  

Auch abrufbar als: Unified diff