From: Joey Schulze Date: Wed, 3 May 2017 23:40:39 +0000 (+0200) Subject: Support category from commandline on all actions X-Git-Url: https://git.infodrom.org/?p=infodrom.org%2Fservice.infodrom.org;a=commitdiff_plain;h=fe537774127f9c55a4fa7152da10c349335495e3 Support category from commandline on all actions --- diff --git a/src/InfoCon/buch/infocon b/src/InfoCon/buch/infocon index b0d6961..843b378 100755 --- a/src/InfoCon/buch/infocon +++ b/src/InfoCon/buch/infocon @@ -168,6 +168,11 @@ sub sales_list $where .= sprintf("year = %d", $opt_year); } + if (defined $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" @@ -587,9 +592,9 @@ my %options = ( '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'}, ); @@ -624,12 +629,6 @@ if (defined $data{category}) { sales_list; } 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}) {