Giving limit for donor to receive t-shirt.
Analysis of IRS rules indicate that sometimes, a thank-you gift can't be sent unless the percentage the gift is of the donation meets a certain threshold. This change allows the caller of this script to implement that sort of threshold.
This commit is contained in:
parent
e43b6e34ae
commit
cf8cc36045
1 changed files with 10 additions and 3 deletions
|
@ -13,12 +13,12 @@ use Supporters;
|
||||||
|
|
||||||
my $LEDGER_CMD = "/usr/local/bin/ledger";
|
my $LEDGER_CMD = "/usr/local/bin/ledger";
|
||||||
|
|
||||||
if (@ARGV != 3 and @ARGV != 4) {
|
if (@ARGV != 4 and @ARGV != 5) {
|
||||||
print STDERR "usage: $0 <SUPPORTERS_SQLITE_DB_FILE> <SIZE_COUNTS> <OUTPUT_DIRECTORY> <VERBOSE>\n";
|
print STDERR "usage: $0 <SUPPORTERS_SQLITE_DB_FILE> <GIVING_LIMIT> <SIZE_COUNTS> <OUTPUT_DIRECTORY> <VERBOSE>\n";
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
my($SUPPORTERS_SQLITE_DB_FILE, $SIZE_COUNTS, $OUTPUT_DIRECTORY, $VERBOSE) = @ARGV;
|
my($SUPPORTERS_SQLITE_DB_FILE, $GIVING_LIMIT, $SIZE_COUNTS, $OUTPUT_DIRECTORY, $VERBOSE) = @ARGV;
|
||||||
$VERBOSE = 0 if not defined $VERBOSE;
|
$VERBOSE = 0 if not defined $VERBOSE;
|
||||||
|
|
||||||
open(SIZE_COUNTS, "<", $SIZE_COUNTS);
|
open(SIZE_COUNTS, "<", $SIZE_COUNTS);
|
||||||
|
@ -75,6 +75,13 @@ foreach my $id (@supporterIds) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
next if not defined $sizeNeeded; # If we don't need a size, we don't have a request.
|
next if not defined $sizeNeeded; # If we don't need a size, we don't have a request.
|
||||||
|
|
||||||
|
my $amount = $sp->donorTotalGaveInPeriod(donorId => $id);
|
||||||
|
if ($amount < $GIVING_LIMIT) {
|
||||||
|
print "Skipping $id request for $sizeNeeded because donor only gave $amount and giving limit is $GIVING\n" if $VERBOSE;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
my(@postalAddresses) = $sp->getPostalAddresses($id);
|
my(@postalAddresses) = $sp->getPostalAddresses($id);
|
||||||
my $latexPostal = latex_encode($postalAddresses[0]);
|
my $latexPostal = latex_encode($postalAddresses[0]);
|
||||||
if ($latexPostal =~ /unmatched/) {
|
if ($latexPostal =~ /unmatched/) {
|
||||||
|
|
Loading…
Reference in a new issue