Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision af81f05f

Von Bernd Bleßmann vor mehr als 3 Jahren hinzugefügt

  • ID af81f05f3519e304f29a28b7fe34cce3689c073f
  • Vorgänger 42c64631
  • Nachfolger 68f05425

Zeiterfassung: Konvertierung: geliefert/gelieferte Mengen in Auftrag anpassen

Unterschiede anzeigen:

SL/DB/DeliveryOrder.pm
20 20
use SL::Helper::Number qw(_format_total _round_total);
21 21

  
22 22
use List::Util qw(first);
23
use List::MoreUtils qw(any);
23
use List::MoreUtils qw(any pairwise);
24 24
use Math::Round qw(nhimult);
25 25

  
26 26
__PACKAGE__->meta->add_relationship(orderitems => { type         => 'one to many',
......
264 264
  if ($params{related_order}) {
265 265
    # collect suitable items in related order
266 266
    my @items_to_use;
267
    my @new_attributes;
267 268
    foreach my $item (@items) {
268 269
      my $item_to_use = first {$item->parts_id == $_->parts_id} @{ $params{related_order}->items_sorted };
269 270

  
270 271
      die "no suitable item found in related order" if !$item_to_use;
271 272

  
272 273
      my %new_attributes;
273
      $new_attributes{$_} = $item->$_ for qw(qty unit_obj longdescription);
274
      $item_to_use->assign_attributes(%new_attributes);
275
      push @items_to_use, $item_to_use;
274
      $new_attributes{$_} = $item->$_ for qw(qty base_qty unit_obj longdescription);
275
      push @items_to_use,   $item_to_use;
276
      push @new_attributes, \%new_attributes;
276 277
    }
277
    $delivery_order = SL::DB::DeliveryOrder->new_from($params{related_order}, items => \@items_to_use, %params);
278

  
279
    $delivery_order = $class->new_from($params{related_order}, items => \@items_to_use, %params);
280
    pairwise { $a->assign_attributes( %$b) } @{$delivery_order->items}, @new_attributes;
278 281

  
279 282
  } else {
280 283
    my %args = (

Auch abrufbar als: Unified diff