Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 08704bc4

Von Bernd Bleßmann vor mehr als 3 Jahren hinzugefügt

  • ID 08704bc49080b1f74c90fc49adf2958d491a059e
  • Vorgänger c968d1f7
  • Nachfolger 9c2d09b8

Zeiterfassung: Parameter f. Konvertierung mit link_project/related order

Unterschiede anzeigen:

SL/DB/DeliveryOrder.pm
185 185
  croak("Unsupported object type in sources")                                      if any { ref($_) ne 'SL::DB::TimeRecording' }            @$sources;
186 186
  croak("Cannot create delivery order from source records of different customers") if any { $_->customer_id != $sources->[0]->customer_id } @$sources;
187 187

  
188
  my %args = (
189
    is_sales    => 1,
190
    delivered   => 0,
191
    customer_id => $sources->[0]->customer_id,
192
    taxzone_id  => $sources->[0]->customer->taxzone_id,
193
    currency_id => $sources->[0]->customer->currency_id,
194
    employee_id => SL::DB::Manager::Employee->current->id,
195
    salesman_id => SL::DB::Manager::Employee->current->id,
196
    items       => [],
197
  );
198
  my $delivery_order = $class->new(%args);
199
  $delivery_order->assign_attributes(%{ $params{attributes} }) if $params{attributes};
200

  
201 188
  # - one item per part (article)
202 189
  # - qty is sum of duration
203 190
  # - description goes to item longdescription
......
239 226
    $entries->{$part_id}->{$date}->{date_obj}  = $source->start_time; # for sorting
240 227
  }
241 228

  
229
  my @items;
230

  
242 231
  my $h_unit = SL::DB::Manager::Unit->find_h_unit;
243 232

  
244 233
  my @keys = sort { $part_by_part_id{$a}->partnumber cmp $part_by_part_id{$b}->partnumber } keys %$entries;
......
267 256
      longdescription => $longdescription,
268 257
    );
269 258

  
270
    $delivery_order->add_items($item);
259
    push @items, $item;
260
  }
261

  
262
  my $delivery_order;
263

  
264
  if ($params{related_order}) {
265
    $delivery_order = SL::DB::DeliveryOrder->new_from($params{related_order}, items => \@items, %params);
266

  
267
  } else {
268
    my %args = (
269
      is_sales    => 1,
270
      delivered   => 0,
271
      customer_id => $sources->[0]->customer_id,
272
      taxzone_id  => $sources->[0]->customer->taxzone_id,
273
      currency_id => $sources->[0]->customer->currency_id,
274
      employee_id => SL::DB::Manager::Employee->current->id,
275
      salesman_id => SL::DB::Manager::Employee->current->id,
276
      items       => \@items,
277
    );
278
    $delivery_order = $class->new(%args);
279
    $delivery_order->assign_attributes(%{ $params{attributes} }) if $params{attributes};
271 280
  }
272 281

  
273 282
  return $delivery_order;

Auch abrufbar als: Unified diff