Allow no email address when adding supporter.

This commit is contained in:
Bradley M. Kuhn 2016-02-29 16:30:14 -08:00
parent f8d145c3a7
commit 475f8a8a1d
2 changed files with 15 additions and 4 deletions

View file

@ -70,8 +70,16 @@ while (my $line = <STDIN>) {
my $sp = new Supporters($dbh, [ "none" ]);
my $donorId = $sp->addSupporter({ ledger_entity_id => $entityId, email_address => $email, email_address_type => $emailType,
display_name => $displayName, public_ack => $publicAck} );
my $args = {};
$args->{ledger_entity_id} = $entityId;
$args->{display_name} = $displayName;
$args->{public_ack} = $publicAck;
if (defined $email and email !~ /^\s*$/) {
$args->{email_address} = $email;
$args->{email_address_type} = $emailType;
}
my $donorId = $sp->addSupporter($args);
if ($tshirt) {
my $requestParamaters = { donorId => $donorId, requestConfiguration => $tshirtSize, requestType => 't-shirt-0' };
$sp->addRequest($requestParamaters);

View file

@ -33,11 +33,14 @@ foreach my $supporterId (@supporterIds) {
my $isLapsed = ( (not defined $expiresOn) or $expiresOn lt $TODAY);
next unless $isLapsed;
print "$supporterId (", $sp->getLedgerEntityId($supporterId), ") lapsed on $expiresOn\n" if $isLapsed;
my $lapsedStr = (defined $expiresOn) ? "lapsed on $expiresOn" : "never gave enough to be a supporter";
print "$supporterId (", $sp->getLedgerEntityId($supporterId), ") $lapsedStr\n" if $isLapsed;
$lapsedCount++;
}
my $per = ( ($lapsedCount / scalar(@supporterIds)) * 100.00);
print "\n\nWe have ", scalar(@supporterIds), " supporters and $lapsedCount are lapsed. That's ",
sprintf("%.2f", $per), "%.\n";
sprintf("%.2f", $per), "%.\nActive supporter count: ", scalar(@supporterIds) - $lapsedCount, "\n";