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
|
Zeiterfassung: Konvertierung: POD-Update und Kosmetik