t-shirts: control by type when we send.
Allow for controlled sending of t-shirts by type.
This commit is contained in:
parent
434f2de875
commit
96c04d988e
2 changed files with 15 additions and 6 deletions
|
@ -11,8 +11,8 @@ use Supporters;
|
|||
|
||||
my $LEDGER_CMD = "/usr/local/bin/ledger";
|
||||
|
||||
if (@ARGV != 4 and @ARGV != 5) {
|
||||
print STDERR "usage: $0 <SUPPORTERS_SQLITE_DB_FILE> <WHO> <HOW> <SUPPORTER_CHECKLIST_TEX_FILE> <VERBOSITY_LEVEL>\n";
|
||||
if (@ARGV != 5 and @ARGV != 6) {
|
||||
print STDERR "usage: $0 <SUPPORTERS_SQLITE_DB_FILE> <T_SHIRT_TYPE> <WHO> <HOW> <SUPPORTER_CHECKLIST_TEX_FILE> <VERBOSITY_LEVEL>\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ foreach my $id (sort keys %idsSent) {
|
|||
my $sizesSent;
|
||||
my $foundRequestCount = 0;
|
||||
foreach my $type (@requestTypes) {
|
||||
next unless ($type =~ /shirt/);
|
||||
next unless ($type =~ /shirt/ and $type =~ /$T_SHIRT_TYPE/);
|
||||
my $request = $sp->getRequest({ donorId => $id, requestType => $type,
|
||||
ignoreHeldRequests => 1, ignoreFulfilledRequests => 1 });
|
||||
if (defined $request and defined $request->{requestId} and defined $request->{requestType}) {
|
||||
|
|
|
@ -13,12 +13,12 @@ use Supporters;
|
|||
|
||||
my $LEDGER_CMD = "/usr/local/bin/ledger";
|
||||
|
||||
if (@ARGV < 8) {
|
||||
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";
|
||||
if (@ARGV < 9) {
|
||||
print STDERR "usage: $0 <SUPPORTERS_SQLITE_DB_FILE> <GIVING_LIMIT> <T-SHIRT-STYLE> <SIZE_COUNTS> <OUTPUT_DIRECTORY > <MONTHLY_SEARCH_REGEX> <ANNUAL_SEARCH_REGEX> <VERBOSE> <LEDGER_CMD_LINE>\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my($SUPPORTERS_SQLITE_DB_FILE, $GIVING_LIMIT, $SIZE_COUNTS, $OUTPUT_DIRECTORY, $MONTHLY_SEARCH_REGEX, $ANNUAL_SEARCH_REGEX, $VERBOSE, @LEDGER_CMD_LINE) = @ARGV;
|
||||
my($SUPPORTERS_SQLITE_DB_FILE, $GIVING_LIMIT, $T_SHIRT_STYLE, $SIZE_COUNTS, $OUTPUT_DIRECTORY, $MONTHLY_SEARCH_REGEX, $ANNUAL_SEARCH_REGEX, $VERBOSE, @LEDGER_CMD_LINE) = @ARGV;
|
||||
$VERBOSE = 0 if not defined $VERBOSE;
|
||||
|
||||
open(SIZE_COUNTS, "<", $SIZE_COUNTS);
|
||||
|
@ -78,6 +78,15 @@ sub sortFunction($$) {
|
|||
return ($lastGaveDate0 cmp $lastGaveDate1);
|
||||
}
|
||||
}
|
||||
my @typeList;
|
||||
if ($T_SHIRT_STYLE == 0) {
|
||||
@typeList = qw/t-shirt-0 t-shirt-extra-0/;
|
||||
} elsif ($T_SHIRT_STYLE == 1) {
|
||||
@typeList = qw/t-shirt-1 t-shirt-extra-1/;
|
||||
} else {
|
||||
die "Unknown t-shirt style given: $T_SHIRT_STYLE";
|
||||
}
|
||||
|
||||
foreach my $id (sort { sortFunction($a, $b); } @supporterIds) {
|
||||
my $sizeNeeded;
|
||||
foreach my $type (qw/t-shirt-0 t-shirt-1/) {
|
||||
|
|
Loading…
Reference in a new issue