projects
/
infodrom.org
/
service.infodrom.org
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve work without category
[infodrom.org/service.infodrom.org]
/
src
/
InfoCon
/
buch
/
infocon
diff --git
a/src/InfoCon/buch/infocon
b/src/InfoCon/buch/infocon
index
08e7f4f
..
c10413b
100755
(executable)
--- a/
src/InfoCon/buch/infocon
+++ b/
src/InfoCon/buch/infocon
@@
-100,6
+100,12
@@
sub valid_isodate
} else {
$date = sprintf('%04d-%02d-%02d', $year+1900, $2, $1);
}
} else {
$date = sprintf('%04d-%02d-%02d', $year+1900, $2, $1);
}
+ } elsif ($date =~ /^(\d+)\.(\d+)\.(\d+)?$/) {
+ if (length $3 == 2) {
+ $date = sprintf('20%02d-%02d-%02d', $3, $2, $1);
+ } else {
+ $date = sprintf('%04d-%02d-%02d', $3, $2, $1);
+ }
} elsif ($date !~ /^(\d+)-(\d+)-(\d+)$/) {
return undef;
}
} elsif ($date !~ /^(\d+)-(\d+)-(\d+)$/) {
return undef;
}
@@
-162,6
+168,11
@@
sub sales_list
$where .= sprintf("year = %d", $opt_year);
}
$where .= sprintf("year = %d", $opt_year);
}
+ if (defined $data{category} && length $data{category}) {
+ $where .= " AND " if $where;
+ $where .= sprintf("category = %s", $dbh->quote($data{category}));
+ }
+
if ($opt_direction) {
if ($opt_direction eq "in") {
$d = "price >= 0"
if ($opt_direction) {
if ($opt_direction eq "in") {
$d = "price >= 0"
@@
-459,6
+470,10
@@
sub buchung_input
'title' => 'bezahlt',
'type' => 'boolean',
'default' => 0},
'title' => 'bezahlt',
'type' => 'boolean',
'default' => 0},
+ 'billing_date' => {
+ 'title' => 'wann',
+ 'type' => 'date',
+ 'validate' => \&validate_date},
'weiter' => {
'title' => 'Weiter',
'type' => 'boolean',
'weiter' => {
'title' => 'Weiter',
'type' => 'boolean',
@@
-480,16
+495,19
@@
sub buchung_input
if ($f eq 'tax_assigned' && $answers->{'tax_percent'} == 0) {
$answers->{$f} = 0;
next;
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}) {
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;
}
}
} else {
$answers->{billing_date} = undef;
}
}
- $ans = read_input($f, $fields->{$f});
- $answers->{$f} = $ans;
}
$sth->execute(get_next_nr(),
}
$sth->execute(get_next_nr(),
@@
-501,7
+519,7
@@
sub buchung_input
$answers->{tax_percent},
$answers->{tax_assigned},
$answers->{price},
$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};
$answers->{paid});
$weiter = $answers->{weiter};
@@
-574,9
+592,9
@@
my %options = (
'verbose' => \$opt_verbose,
'help' => \&usage,
'dm' => sub {$table = "sales_dm"},
'verbose' => \$opt_verbose,
'help' => \&usage,
'dm' => sub {$table = "sales_dm"},
- 'buchung-input|bi' => \
$data{'buchung-input'}
,
- 'buchung-unpaid|bu' => \
$data{'buchung-unpaid'}
,
- 'buchung-hidden|bh' => \
$data{'buchung-hidden'}
,
+ 'buchung-input|bi' => \
&buchung_input
,
+ 'buchung-unpaid|bu' => \
&buchung_unpaid
,
+ 'buchung-hidden|bh' => \
&buchung_hidden
,
'list-categories|lc' => \$data{'list-categories'},
);
'list-categories|lc' => \$data{'list-categories'},
);
@@
-605,18
+623,8
@@
if (defined $data{mailto}) {
}
if (defined $data{category}) {
}
if (defined $data{category}) {
- if (length($data{category})) {
- sales_list("category = '".$data{category}."'");
- } else {
- sales_list;
- }
+ sales_list;
exit;
exit;
-} elsif (defined $data{'buchung-input'}) {
- buchung_input;
-} elsif (defined $data{'buchung-unpaid'}) {
- buchung_unpaid;
-} elsif (defined $data{'buchung-hidden'}) {
- buchung_hidden;
} elsif (defined $data{'list-categories'}) {
list_categories;
} elsif (defined $data{pay}) {
} elsif (defined $data{'list-categories'}) {
list_categories;
} elsif (defined $data{pay}) {