Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 459b3c8d

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

  • ID 459b3c8dd86d8aa35e5b2cdff0e3e8c42216a7e3
  • Vorgänger 27c7723d
  • Nachfolger 662df9d7

Zeiterfassung: Konvertierung: POD-Update und Kosmetik

Unterschiede anzeigen:

SL/BackgroundJob/ConvertTimeRecordings.pm
38 38
  my %customer_where;
39 39
  %customer_where = ('customer_id' => $self->params->{customer_ids}) if scalar @{ $self->params->{customer_ids} };
40 40

  
41
  my $time_recordings = SL::DB::Manager::TimeRecording->get_all(where        => [date => { ge_lt => [ $self->params->{from_date}, $self->params->{to_date} ]},
42
                                                                                 or   => [booked => 0, booked => undef],
43
                                                                                 '!duration' => 0,
44
                                                                                 '!duration' => undef,
45
                                                                                 %customer_where]);
41
  my $time_recordings = SL::DB::Manager::TimeRecording->get_all(where => [date        => { ge_lt => [ $self->params->{from_date}, $self->params->{to_date} ]},
42
                                                                          or          => [booked => 0, booked => undef],
43
                                                                          '!duration' => 0,
44
                                                                          '!duration' => undef,
45
                                                                          %customer_where]);
46 46

  
47 47
  return t8('No time recordings to convert') if scalar @$time_recordings == 0;
48 48

  
......
257 257
  if (!$tr->order_id) {
258 258
    # check project
259 259
    my $project_id;
260
    #$project_id   = $self->overide_project_id;
260
    #$project_id   = $self->override_project_id;
261 261
    $project_id   = $self->params->{project_id};
262 262
    $project_id ||= $tr->project_id;
263 263
    #$project_id ||= $self->default_project_id;
......
300 300

  
301 301
  # check part
302 302
  my $part_id;
303
  #$part_id   = $self->overide_part_id;
303
  #$part_id   = $self->override_part_id;
304 304
  $part_id ||= $tr->part_id;
305 305
  #$part_id ||= $self->default_part_id;
306 306
  $part_id ||= $self->params->{part_id};
......
358 358

  
359 359
1;
360 360

  
361
# possible data
362
# from_date: 01.12.2020
363
# to_date: 15.12.2020
364
# customernumbers: [1,2,3]
365 361
__END__
366 362

  
367 363
=pod
......
383 379

  
384 380
Some data can be provided to configure this backgroung job.
385 381
If there is user data and it cannot be validated the background job
386
returns a error messages.
382
fails.
383

  
384
Example:
385

  
386
  from_date: 01.12.2020
387
  to_date: 15.12.2020
388
  customernumbers: [1,2,3]
387 389

  
388 390
=over 4
389 391

  
......
408 410
=item C<customernumbers>
409 411

  
410 412
An array with the customer numbers for which time recordings should
411
be collected. If not given, time recordings for customers are
412
collected. This is the default.
413
be collected. If not given, time recordings for all customers are
414
collected.
413 415

  
414 416
customernumbers: [c1,22332,334343]
415 417

  
416 418
=item C<part_id>
417 419

  
418 420
The part id of a time based service which should be used to
419
book the times. If not set the clients config defaults is used.
421
book the times if no part is set in the time recording entry.
420 422

  
421 423
=item C<rounding>
422 424

  
423 425
If set the 0 no rounding of the times will be done otherwise
424
the times will be rounded up to th full quarters of an hour,
426
the times will be rounded up to the full quarters of an hour,
425 427
ie. 0.25h 0.5h 0.75h 1.25h ...
426 428
Defaults to rounding true (1).
427 429

  
428 430
=item C<link_order>
429 431

  
430
If set the job links the created delivery order with with the order
432
If set the job links the created delivery order with the order
431 433
given in the time recording entry. If there is no order given, then
432
it tries to find an order with with the current customer and project
433
number and tries to do as much automatic workflow processing as the
434
it tries to find an order with the current customer and project
435
number. It tries to do as much automatic workflow processing as the
434 436
UI.
435 437
Defaults to off. If set to true (1) the job will fail if there
436 438
is no sales order which qualifies as a predecessor.
......
450 452
Hint: take a look or extend the job CloseProjectsBelongingToClosedSalesOrder for
451 453
further automatisation of your organisational needs.
452 454

  
453

  
454 455
=item C<project_id>
455 456

  
456 457
Use this project_id instead of the project_id in the time recordings.
457 458

  
459
=back
460

  
461
=head1 TODO
462

  
463
=over 4
464

  
465
=item * part and project parameters as numbers
466

  
467
Add parameters to give part and project not with their ids, but with their
468
numbers. E.g. (default_/override_)part_number,
469
(default_/override_)project_number.
470

  
471
=item * part and project parameters override and default
472

  
473
In the moment, the part id given as parameter is used as the default value.
474
This means, it will be used if there is no part in the time recvording entry.
475

  
476
The project id given is used as override parameter. It overrides the project
477
given in the time recording entry.
478

  
479
To solve this, there should be parameters named override_part_id,
480
default_part_id, override_project_id and default_project_id.
481

  
482

  
458 483
=back
459 484

  
460 485
=head1 AUTHOR
SL/DB/DeliveryOrder.pm
191 191
  #  - ordered and summed by date
192 192
  #  - each description goes to an ordered list
193 193
  #  - (as time recording descriptions are formatted text by now, use stripped text)
194
  #  - merge same descriptions (todo)
194
  #  - merge same descriptions
195 195
  #
196 196

  
197 197
  my $default_part_id = $params{default_part_id}    ? $params{default_part_id}
......
434 434
given as C<$sources>. All time recording entries must belong to the same
435 435
customer. Time recordings are sorted by article and date. For each article
436 436
a new delivery order item is created. If no article is associated with an
437
entry, a default article will be used (hard coded).
437
entry, a default article will be used.
438 438
Entries of the same date (for each article) are summed together and form a
439 439
list entry in the long description of the item.
440 440

  
......
451 451
An optional hash reference. If it exists then it is used to set
452 452
attributes of the newly created delivery order object.
453 453

  
454
=item C<related_order>
455

  
456
An optional C<SL::DB::Order> object. If it exists then it is used to
457
generate the delivery order from that via C<new_from>.
458
The generated items are created from a suitable item of the related
459
order. If no suitable item is found, an exception is thrown.
460

  
461
=item C<rounding>
462

  
463
An optional boolean value. If truish, then the durations of the time entries
464
are rounded up to the full quarters of an hour.
465

  
454 466
=back
455 467

  
456 468
=item C<sales_order>

Auch abrufbar als: Unified diff