Handle complexities of lapsing soon
This commit is contained in:
		
							parent
							
								
									265f64b2c0
								
							
						
					
					
						commit
						b479a6d68d
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		|  | @ -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); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Bradley M. Kuhn
						Bradley M. Kuhn