Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision fb4ea855

Von Tamino Steinert vor fast 2 Jahren hinzugefügt

  • ID fb4ea855566d76a4ea3f64579976713a68b2dcd3
  • Vorgänger bb77f8d0
  • Nachfolger e9f3d8ce

Reclamation: don't save delivery_order after converting

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
105 105

  
106 106
  require SL::DB::Reclamation;
107 107
  my $reclamation = SL::DB::Reclamation->new(id => $::form->{from_id})->load;
108
  my ($delivery_order, $error) = $reclamation->convert_to_delivery_order();
109
  if($error) {
110
    croak("Error while converting: " . $error);
111
  }
112

  
108
  my $delivery_order = SL::DB::DeliveryOrder->new_from($reclamation);
109
  $self->{converted_from_reclamation_id} = $::form->{from_id};
113 110
  $self->order($delivery_order);
114 111

  
115 112
  $self->action_add;
......
1173 1170
  $self->js
1174 1171
    ->val('#id', $self->order->id)
1175 1172
    ->val('#converted_from_oe_id', '')
1173
    ->val('#converted_from_reclamation_id', '')
1176 1174
    ->val('#order_' . $self->nr_key(), $self->order->number);
1177 1175

  
1178 1176
  my $idx = 0;
......
1187 1185
    $idx++;
1188 1186
  }
1189 1187
  $self->js->val('[name="converted_from_orderitems_ids[+]"]', '');
1188
  $self->js->val('[name="converted_from_reclamation_items_ids[+]"]', '');
1190 1189
}
1191 1190

  
1192 1191
#
......
1639 1638
        }
1640 1639
      }
1641 1640
    }
1641
    if ($::form->{converted_from_reclamation_id}) {
1642
      my @converted_from_reclamation_ids = split ' ', $::form->{converted_from_reclamation_id};
1643
      foreach my $converted_from_reclamation_id (@converted_from_reclamation_ids) {
1644
        my $src = SL::DB::Reclamation->new(id => $converted_from_reclamation_id)->load;
1645
        $src->link_to_record($self->order);
1646
      }
1647
      if (scalar @{ $::form->{converted_from_reclamation_items_ids} || [] }) {
1648
        my $idx = 0;
1649
        foreach (@{ $self->order->items_sorted }) {
1650
          my $from_id = $::form->{converted_from_reclamation_items_ids}->[$idx];
1651
          next if !$from_id;
1652
          SL::DB::RecordLink->new(from_table => 'reclamation_items',
1653
                                  from_id    => $from_id,
1654
                                  to_table   => 'orderitems',
1655
                                  to_id      => $_->id
1656
          )->save;
1657
          $idx++;
1658
        }
1659
      }
1660
    }
1642 1661

  
1643 1662
    $self->save_history('SAVED');
1644 1663

  
templates/webpages/delivery_order/form.html
20 20
  [% L.hidden_tag('type',                 FORM.type) %]
21 21
  [% L.hidden_tag('id',                   SELF.order.id) %]
22 22
  [% L.hidden_tag('converted_from_oe_id', SELF.converted_from_oe_id) %]
23
  [% L.hidden_tag('converted_from_reclamation_id', SELF.converted_from_reclamation_id) %]
23 24

  
24 25
  [%- INCLUDE 'common/flash.html' %]
25 26

  
templates/webpages/delivery_order/tabs/_row.html
16 16
      [%- END %]
17 17
      [% L.hidden_tag("orderitem_ids[+]", ID) %]
18 18
      [% L.hidden_tag("converted_from_orderitems_ids[+]", ITEM.converted_from_orderitems_id) %]
19
      [% L.hidden_tag("converted_from_reclamation_items_ids[+]", ITEM.converted_from_reclamation_items_id) %]
19 20
      [% L.hidden_tag("order.orderitems[+].id", ITEM.id, id='item_' _ ID) %]
20 21
      [% L.hidden_tag("order.orderitems[].stock_info", ITEM.stock_info, class="data-stock-info") %]
21 22
      [% L.hidden_tag("order.orderitems[].parts_id", ITEM.parts_id) %]

Auch abrufbar als: Unified diff