Revision 38c08c2f
Von Tamino Steinert vor 12 Monaten hinzugefügt
SL/Controller/DeliveryOrder.pm | ||
---|---|---|
16 | 16 |
use SL::YAML; |
17 | 17 |
use SL::DBUtils qw(selectall_hashref_query); |
18 | 18 |
use SL::DB::History; |
19 |
use SL::DB::Order; |
|
20 | 19 |
use SL::DB::Default; |
21 | 20 |
use SL::DB::Unit; |
22 | 21 |
use SL::DB::Order; |
22 |
use SL::DB::Order::TypeData qw(:types); |
|
23 | 23 |
use SL::DB::Part; |
24 | 24 |
use SL::DB::PartClassification; |
25 | 25 |
use SL::DB::PartsGroup; |
... | ... | |
38 | 38 |
use SL::DB::Helper::Record qw(get_object_name_from_type get_class_from_type); |
39 | 39 |
use SL::DB::DeliveryOrder; |
40 | 40 |
use SL::DB::DeliveryOrder::TypeData qw(:types); |
41 |
use SL::DB::Order::TypeData qw(:types); |
|
42 | 41 |
use SL::DB::Manager::DeliveryOrderItem; |
43 | 42 |
use SL::DB::DeliveryOrderItemsStock; |
44 | 43 |
use SL::Model::Record; |
... | ... | |
130 | 129 |
} |
131 | 130 |
|
132 | 131 |
my $record = SL::Model::Record->get_record($from_type, $from_id); |
132 |
if (ref $record eq 'SL::DB::Order') { |
|
133 |
# Calculate shipped qtys here to prevent calling calculate for every item |
|
134 |
# via the items method. |
|
135 |
SL::Helper::ShippedQty->new->calculate($record)->write_to(\@{$record->items}); |
|
136 |
my @items_with_not_delivered_qty = |
|
137 |
grep {$_->qty > 0} |
|
138 |
map {$_->qty($_->qty - $_->shipped_qty); $_} |
|
139 |
@{$record->items}; |
|
140 |
$flags{items} = \@items_with_not_delivered_qty; |
|
141 |
} |
|
133 | 142 |
my $delivery_order = SL::Model::Record->new_from_workflow($record, $self->type, %flags); |
134 | 143 |
$self->order($delivery_order); |
135 | 144 |
|
Auch abrufbar als: Unified diff
FIX: Workflow DeliveryOrder → Order: Nur nicht gelieferte Mengen nehmen