Revision bb8c0275
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/DB/DeliveryOrder.pm | ||
---|---|---|
20 | 20 |
use SL::DB::Reclamation::TypeData qw(:types); |
21 | 21 |
|
22 | 22 |
use SL::Helper::Number qw(_format_total _round_total); |
23 |
use SL::Helper::ShippedQty; |
|
23 | 24 |
|
24 | 25 |
use List::Util qw(first); |
25 | 26 |
use List::MoreUtils qw(any pairwise); |
... | ... | |
45 | 46 |
|
46 | 47 |
__PACKAGE__->before_save('_before_save_set_donumber'); |
47 | 48 |
__PACKAGE__->after_save('_after_save_link_records'); |
49 |
__PACKAGE__->after_save('_mark_orders_if_delivered'); |
|
48 | 50 |
|
49 | 51 |
# hooks |
50 | 52 |
|
... | ... | |
69 | 71 |
); |
70 | 72 |
} |
71 | 73 |
|
74 |
sub _mark_orders_if_delivered { |
|
75 |
my ($self) = @_; |
|
76 |
my $orders = $self->linked_records(from => 'Order'); |
|
77 |
SL::Helper::ShippedQty->new->calculate($orders)->write_to_objects; |
|
78 |
foreach my $order (@$orders) { |
|
79 |
next if $order->is_sales != $self->is_sales; |
|
80 |
$order->update_attributes(delivered => $order->{delivered}); |
|
81 |
} |
|
82 |
return 1; |
|
83 |
} |
|
84 |
|
|
72 | 85 |
# methods |
73 | 86 |
|
74 | 87 |
sub items { goto &orderitems; } |
Auch abrufbar als: Unified diff
FIX: DeliveryOrder: Setze Aufträge auf geliefert