Revision 649a23d5
Von Jan Büren vor mehr als 3 Jahren hinzugefügt
SL/BackgroundJob/ConvertTimeRecordings.pm | ||
---|---|---|
30 | 30 |
my $data; |
31 | 31 |
$data = $db_obj->data_as_hash if $db_obj; |
32 | 32 |
|
33 |
$self->{$_} = [] for qw(job_errors); |
|
33 | 34 |
# from/to date from data. Defaults to begining and end of last month. |
34 | 35 |
my $from_date; |
35 | 36 |
my $to_date; |
... | ... | |
56 | 57 |
push @{ $time_recordings_by_customer_id{$_->customer_id} }, $_ for @$time_recordings; |
57 | 58 |
|
58 | 59 |
my @donumbers; |
59 |
my $has_warnings; |
|
60 | 60 |
foreach my $customer_id (keys %time_recordings_by_customer_id) { |
61 | 61 |
my $do; |
62 | 62 |
if (!eval { |
... | ... | |
65 | 65 |
}) { |
66 | 66 |
$::lxdebug->message(LXDebug->WARN(), |
67 | 67 |
"ConvertTimeRecordings: creating delivery order failed ($@) for time recording ids " . join ', ', map { $_->id } @{$time_recordings_by_customer_id{$customer_id}}); |
68 |
$has_warnings = 1; |
|
68 |
push @{ $self->{job_errors} }, "ConvertTimeRecordings: creating delivery order failed ($@) for time recording ids " . join ', ', map { $_->id } @{$time_recordings_by_customer_id{$customer_id}}; |
|
69 |
|
|
69 | 70 |
} |
70 | 71 |
|
71 | 72 |
if ($do) { |
... | ... | |
76 | 77 |
})) { |
77 | 78 |
$::lxdebug->message(LXDebug->WARN(), |
78 | 79 |
"ConvertTimeRecordings: saving delivery order failed for time recording ids " . join ', ', map { $_->id } @{$time_recordings_by_customer_id{$customer_id}}); |
79 |
$has_warnings = 1;
|
|
80 |
push @{ $self->{job_errors} }, "ConvertTimeRecordings: saving delivery order failed for time recording ids " . join ', ', map { $_->id } @{$time_recordings_by_customer_id{$customer_id}};
|
|
80 | 81 |
} else { |
81 | 82 |
push @donumbers, $do->donumber; |
82 | 83 |
} |
83 | 84 |
} |
84 | 85 |
} |
85 | 86 |
|
86 |
my $msg = t8('Number of deliveryorders created:'); |
|
87 |
my $msg = t8('Number of delivery orders created:');
|
|
87 | 88 |
$msg .= ' '; |
88 | 89 |
$msg .= scalar @donumbers; |
89 | 90 |
$msg .= ' ('; |
90 | 91 |
$msg .= join ', ', @donumbers; |
91 | 92 |
$msg .= ').'; |
92 |
$msg .= ' ' . t8('There are Warnings.') if $has_warnings; |
|
93 |
# die if errors exists |
|
94 |
if (@{ $self->{job_errors} }) { |
|
95 |
$msg .= ' ' . t8('The following errors occurred:'); |
|
96 |
$msg .= join "\n", @{ $self->{job_errors} }; |
|
97 |
return $msg; |
|
98 |
} |
|
93 | 99 |
return $msg; |
94 | 100 |
} |
95 | 101 |
|
Auch abrufbar als: Unified diff
CTR: Warnungen zu Fehlern hochgestuft - Variablenbenennung wie in CPI