Add additional parameters.

This commit is contained in:
Bradley M. Kuhn 2016-01-22 17:10:58 -08:00
parent 6986796a7d
commit 922e8f279e

View file

@ -13,12 +13,12 @@ use Supporters;
my $LEDGER_CMD = "/usr/local/bin/ledger"; my $LEDGER_CMD = "/usr/local/bin/ledger";
if (@ARGV != 4 and @ARGV != 5) { if (@ARGV < 8) {
print STDERR "usage: $0 <SUPPORTERS_SQLITE_DB_FILE> <GIVING_LIMIT> <SIZE_COUNTS> <OUTPUT_DIRECTORY> <VERBOSE>\n"; print STDERR "usage: $0 <SUPPORTERS_SQLITE_DB_FILE> <GIVING_LIMIT> <SIZE_COUNTS> <OUTPUT_DIRECTORY > <MONTHLY_SEARCH_REGEX> <ANNUAL_SEARCH_REGEX> <VERBOSE> <LEDGER_CMD_LINE>\n";
exit 1; exit 1;
} }
my($SUPPORTERS_SQLITE_DB_FILE, $GIVING_LIMIT, $SIZE_COUNTS, $OUTPUT_DIRECTORY, $VERBOSE) = @ARGV; my($SUPPORTERS_SQLITE_DB_FILE, $GIVING_LIMIT, $SIZE_COUNTS, $OUTPUT_DIRECTORY, $MONTHLY_SEARCH_REGEX, $ANNUAL_SEARCH_REGEX, $VERBOSE, @LEDGER_CMD_LINE) = @ARGV;
$VERBOSE = 0 if not defined $VERBOSE; $VERBOSE = 0 if not defined $VERBOSE;
open(SIZE_COUNTS, "<", $SIZE_COUNTS); open(SIZE_COUNTS, "<", $SIZE_COUNTS);
@ -57,9 +57,7 @@ my $dbh = DBI->connect("dbi:SQLite:dbname=$SUPPORTERS_SQLITE_DB_FILE", "", "",
{ RaiseError => 1, sqlite_unicode => 1 }) { RaiseError => 1, sqlite_unicode => 1 })
or die $DBI::errstr; or die $DBI::errstr;
my $sp = new Supporters($dbh, [ "none" ]); my $sp = new Supporters($dbh, \@LEDGER_CMD_LINE, { monthly => $MONTHLY_SEARCH_REGEX, annual => $ANNUAL_SEARCH_REGEX});
my(@supporterIds) = $sp->findDonor({}); my(@supporterIds) = $sp->findDonor({});
my $overallCount = 0; my $overallCount = 0;