Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 53aad992

Von Moritz Bunkus vor fast 11 Jahren hinzugefügt

  • ID 53aad992851d0e653fe5d3f291d72ebe5b5ac1e5
  • Vorgänger c37da034
  • Nachfolger fff57e55

SL::DB::{DeliveryOrder,Invoice}->new_from: Option items für Übergabe der zu verwendenden Positionen

Gründe dafür können sein:

- eigene Sortierung
- gewisse Positionen herauslassen
- weitere Positionen hinzufügen

Unterschiede anzeigen:

SL/DB/DeliveryOrder.pm
133 133
  }
134 134

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

  
137 138
  my @items = map {
138 139
    my $source_item      = $_;
......
144 145
                                         )),
145 146
                                   custom_variables => \@custom_variables);
146 147

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

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

  
......
215 216

  
216 217
=over 2
217 218

  
219
=item C<items>
220

  
221
An optional array reference of RDBO instances for the items to use. If
222
missing then the method C<items_sorted> will be called on
223
C<$source>. This option can be used to override the sorting, to
224
exclude certain positions or to add additional ones.
225

  
218 226
=item C<skip_items_zero_qty>
219 227

  
220 228
If trueish then items with a quantity of 0 are skipped.
SL/DB/Invoice.pm
161 161
  }
162 162

  
163 163
  my $invoice = $class->new(%args, %{ $params{attributes} || {} });
164
  my $items   = delete($params{items}) || $source->items_sorted;
164 165

  
165 166
  my @items = map {
166 167
    my $source_item      = $_;
......
174 175
                             custom_variables => \@custom_variables,
175 176
                           );
176 177

  
177
  } @{ $source->items_sorted };
178
  } @{ $items };
178 179

  
179 180
  $invoice->invoiceitems(\@items);
180 181

  
......
327 328

  
328 329
=over 2
329 330

  
331
=item C<items>
332

  
333
An optional array reference of RDBO instances for the items to use. If
334
missing then the method C<items_sorted> will be called on
335
C<$source>. This option can be used to override the sorting, to
336
exclude certain positions or to add additional ones.
337

  
330 338
=item C<attributes>
331 339

  
332 340
An optional hash reference. If it exists then it is passed to C<new>

Auch abrufbar als: Unified diff