Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c37da034

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID c37da034c649ac67a2235fd0527f6fef5e26ec5a
  • Vorgänger 074e54e7
  • Nachfolger 53aad992

SL::DB::DeliveryOrder->new_from: Optionen zum Weglassen von Positionen mit Menge 0

Unterschiede anzeigen:

SL/DB/DeliveryOrder.pm
132 132
    $args{shipto_id} = $source->shipto_id;
133 133
  }
134 134

  
135
  my $delivery_order = $class->new(%args, %params);
135
  my $delivery_order = $class->new(%args, %{ $params{attributes} || {} });
136 136

  
137 137
  my @items = map {
138 138
    my $source_item      = $_;
......
146 146

  
147 147
  } @{ $source->items_sorted };
148 148

  
149
  @items = grep { $_->qty * 1 } @items if $params{skip_items_zero_qty};
150

  
149 151
  $delivery_order->items(\@items);
150 152

  
151 153
  return ($delivery_order, $custom_shipto);
......
186 188
Returns the delivery order items sorted by their ID (same order they
187 189
appear in the frontend delivery order masks).
188 190

  
189
=item C<new_from $source>
191
=item C<new_from $source, %params>
190 192

  
191 193
Creates a new C<SL::DB::DeliveryOrder> instance and copies as much
192 194
information from C<$source> as possible. At the moment only instances
......
209 211

  
210 212
The objects returned are not saved.
211 213

  
214
C<%params> can include the following options:
215

  
216
=over 2
217

  
218
=item C<skip_items_zero_qty>
219

  
220
If trueish then items with a quantity of 0 are skipped.
221

  
222
=item C<attributes>
223

  
224
An optional hash reference. If it exists then it is passed to C<new>
225
allowing the caller to set certain attributes for the new delivery
226
order.
227

  
228
=back
229

  
212 230
=item C<sales_order>
213 231

  
214 232
TODO: Describe sales_order

Auch abrufbar als: Unified diff