'title' => 'bezahlt',
'type' => 'boolean',
'default' => 0},
+ 'billing_date' => {
+ 'title' => 'wann',
+ 'type' => 'date',
+ 'validate' => \&validate_date},
'weiter' => {
'title' => 'Weiter',
'type' => 'boolean',
if ($f eq 'tax_assigned' && $answers->{'tax_percent'} == 0) {
$answers->{$f} = 0;
next;
- } elsif ($f eq 'paid') {
+ }
+ $ans = read_input($f, $fields->{$f});
+ $answers->{$f} = $ans;
+
+ if ($f eq 'paid') {
if ($answers->{paid}) {
- my @now = localtime(time);
- $answers->{billing_date} = sprintf('%04d-%02d-%02d', $now[5]+1900, $now[4]+1, $now[3]);
+ $fields->{'billing_date'}{'default'} = $answers->{'date'};
+ $ans = read_input('billing_date', $fields->{'billing_date'});
+ $answers->{billing_date} = $ans;
} else {
$answers->{billing_date} = undef;
}
}
- $ans = read_input($f, $fields->{$f});
- $answers->{$f} = $ans;
}
$sth->execute(get_next_nr(),
$answers->{tax_percent},
$answers->{tax_assigned},
$answers->{price},
- $answers->{billing_date},
+ defined $answers->{billing_date} ? date_to_string($answers->{billing_date}) : undef,
$answers->{paid});
$weiter = $answers->{weiter};