X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/ae906113e922e784aadaadf1681eede43d7967c2..7bc44f0f59f35d7d3b555e98ff9bb61c8ffbea0b:/SL/DB/DeliveryOrder.pm diff --git a/SL/DB/DeliveryOrder.pm b/SL/DB/DeliveryOrder.pm index 824689353..f5fb2d54e 100644 --- a/SL/DB/DeliveryOrder.pm +++ b/SL/DB/DeliveryOrder.pm @@ -49,7 +49,7 @@ sub add_items { goto &add_orderitems; } sub items_sorted { my ($self) = @_; - return [ sort {$a->id <=> $b->id } @{ $self->items } ]; + return [ sort {$a->position <=> $b->position } @{ $self->items } ]; } sub sales_order { @@ -164,12 +164,17 @@ sub new_from { } @{ $items }; @items = grep { $_->qty * 1 } @items if $params{skip_items_zero_qty}; + @items = grep { $_->qty >=0 } @items if $params{skip_items_negative_qty}; $delivery_order->items(\@items); return ($delivery_order, $custom_shipto); } +sub customervendor { + $_[0]->is_sales ? $_[0]->customer : $_[0]->vendor; +} + 1; __END__ @@ -239,6 +244,11 @@ missing then the method C will be called on C<$source>. This option can be used to override the sorting, to exclude certain positions or to add additional ones. +=item C + +If trueish then items with a negative quantity are skipped. Items with +a quantity of 0 are not affected by this option. + =item C If trueish then items with a quantity of 0 are skipped.