Handle complexities of lapsing soon

This commit is contained in:
Bradley M. Kuhn 2024-11-03 15:50:51 -08:00
parent 265f64b2c0
commit b479a6d68d

View file

@ -35,7 +35,19 @@ my $yearTot = 0.00;
my %specialContributions;
foreach my $supporterId (@supporterIds) {
my $expiresOn = $sp->supporterExpirationDate($supporterId);
my $type = $sp->getType($supporterId);
# Lapses soon calculation is complicated. Annuals can use the how far in
# advance setting, but we really can't with monthlies. For all we know, a
# monthly donation is about to come in for them, so until they reach their
# 60-day expired mark, which is already included in the expiration date by
# the library, we have to assume they're donation is coming in.
my $isLapsed = ( (not defined $expiresOn) or $expiresOn lt $TODAY);
my $lapsesSoon;
if (defined $expiresOn) {
$lapsesSoon = ($expiresOn le $HOW_FAR_IN_ADVANCE) if ($type =~ /ann/i);
$lapsesSoon = ($expiresOn lt $TODAY) if ($type =~ /month/i);
}
$expiresOn = "NO-FULL-SIGNUP" if not defined $expiresOn;
if (not $isLapsed) {
my $lastYearGave = $sp->donorTotalGaveInPeriod(donorId => $supporterId,
startDate => $ONE_YEAR_AGO, endDate => $TODAY);