Revision fbc3a76f
Von Jan Büren vor etwa 5 Jahren hinzugefügt
SL/BackgroundJob/SetNumberRange.pm | ||
---|---|---|
17 | 17 |
my ($self, $db_obj) = @_; |
18 | 18 |
my $data = $db_obj->data_as_hash; |
19 | 19 |
|
20 |
if ($data->{digits_year} && !($data->{digits_year} == 2 || $data->{digits_year} == 4)) { |
|
21 |
die "No valid input for digits_year should be 2 or 4."; |
|
22 |
} |
|
23 |
if ($data->{multiplier} && !($data->{multiplier} % 10 == 0)) { |
|
24 |
die "No valid input for multiplier should be 10, 100, .., 1000000"; |
|
25 |
} |
|
20 | 26 |
my $next_year = DateTime->today_local->truncate(to => 'year')->add(years => 1)->year(); |
21 | 27 |
$next_year = ($data->{digits_year} == 2) ? substr($next_year, 2, 2) : $next_year; |
22 |
my $multiplier = $data->{multiplier} || 1; |
|
28 |
my $multiplier = $data->{multiplier} || 100;
|
|
23 | 29 |
|
24 | 30 |
my $defaults = SL::DB::Default->get; |
25 | 31 |
|
Auch abrufbar als: Unified diff
SetNumberRange: Validitätsprüfung auf Benutzereingabe (data) im Job