Revision 8a286496
Von Bernd Bleßmann vor mehr als 3 Jahren hinzugefügt
SL/BackgroundJob/ConvertTimeRecordings.pm | ||
---|---|---|
13 | 13 |
|
14 | 14 |
use DateTime; |
15 | 15 |
use List::Util qw(any); |
16 |
use Try::Tiny; |
|
17 | 16 |
|
18 | 17 |
sub create_job { |
19 | 18 |
$_[0]->create_standard_job('7 3 1 * *'); # every first day of month at 03:07 |
... | ... | |
62 | 61 |
# TODO get/set see above |
63 | 62 |
my $from_date; |
64 | 63 |
my $to_date; |
65 |
# handle errors with a catch handler |
|
66 |
try { |
|
67 |
$from_date = DateTime->from_kivitendo($self->data->{from_date}) if $self->data->{from_date}; |
|
68 |
$to_date = DateTime->from_kivitendo($self->data->{to_date}) if $self->data->{to_date}; |
|
69 |
} catch { |
|
70 |
die "Cannot convert date from string $self->data->{from_date} $self->data->{to_date}\n Details :\n $_"; # not $@ |
|
71 |
}; |
|
64 |
$from_date = DateTime->from_kivitendo($self->data->{from_date}) if $self->data->{from_date}; |
|
65 |
$to_date = DateTime->from_kivitendo($self->data->{to_date}) if $self->data->{to_date}; |
|
72 | 66 |
$from_date ||= DateTime->new( day => 1, month => DateTime->today_local->month, year => DateTime->today_local->year)->subtract(months => 1); |
73 | 67 |
$to_date ||= DateTime->last_day_of_month(month => DateTime->today_local->month, year => DateTime->today_local->year)->subtract(months => 1); |
74 | 68 |
|
SL/InstallationCheck.pm | ||
---|---|---|
63 | 63 |
{ name => "Text::CSV_XS", version => '0.23', url => "http://search.cpan.org/~hmbrand/", debian => 'libtext-csv-xs-perl' }, |
64 | 64 |
{ name => "Text::Iconv", version => '1.2', url => "http://search.cpan.org/~mpiotr/", debian => 'libtext-iconv-perl' }, |
65 | 65 |
{ name => "Text::Unidecode", url => "http://search.cpan.org/~sburke/", debian => 'libtext-unidecode-perl' }, |
66 |
{ name => "Try::Tiny", url => "https://metacpan.org/release/Try-Tiny", debian => 'libtry-tiny-perl' }, |
|
67 | 66 |
{ name => "URI", version => '1.35', url => "http://search.cpan.org/~gaas/", debian => 'liburi-perl' }, |
68 | 67 |
{ name => "XML::LibXML", url => "https://metacpan.org/pod/XML::LibXML", debian => 'libxml-libxml-perl' }, |
69 | 68 |
{ name => "XML::Writer", version => '0.602', url => "http://search.cpan.org/~josephw/", debian => 'libxml-writer-perl' }, |
Auch abrufbar als: Unified diff
Revert "CTR: Benutzereingabe in data mit Try::Tiny auffangen"
DateTime->from_kivitindeo wirft keine Ausnahme, daher ist hier try/catch
ohne Funktion.
This reverts commit a6291ceb5b16c6faf4e24c6d1a5516f06df58e22.