# Now I can start looping
foreach my $customer (@customers)
{
+ my $paydate = $customer->getfield('paydate');
+ next if $paydate =~ /^\s*$/; #skip empty expiration dates
+
my $custnum = $customer->getfield('custnum');
my $first = $customer->getfield('first');
my $last = $customer->getfield('last');
my $company = $customer->getfield('company');
my $payby = $customer->getfield('payby');
my $payinfo = $customer->getfield('payinfo');
- my $paydate = $customer->getfield('paydate');
my $daytime = $customer->getfield('daytime');
my $night = $customer->getfield('night');
-
+
my ($payyear,$paymonth,$payday) = split (/-/,$paydate);
my $expire_time = timelocal(0,0,0,$payday,--$paymonth,$payyear);
#credit cards expire at the end of the month/year of their exp date
- if ($payby eq 'CARD') {
+ if ($payby eq 'CARD' || $payby eq 'DCRD') {
($paymonth < 11) ? $paymonth++ : ($paymonth=0, $payyear++);
$expire_time = timelocal(0,0,0,$payday,$paymonth,$payyear);
$expire_time--;
$FS::alerter::_template::first = $first;
$FS::alerter::_template::last = $last;
$FS::alerter::_template::company = $company;
- if ($payby eq 'CARD') {
+ if ($payby eq 'CARD' || $payby eq 'DCRD') {
$FS::alerter::_template::payby = "credit card (" .
substr($payinfo, 0, 2) . "xxxxxxxxxx" .
substr($payinfo, -4) . ")";
}
$FS::alerter::_template::expdate = $expire_time;
+ $FS::alerter::_template::company_name = $conf->config('company_name');
+ $FS::alerter::_template::company_address =
+ join("\n", $conf->config('company_address') ). "\n";
+
my $message = new Mail::Internet (
'Header' => $header,
'Body' => [ $alerter->fill_in( PACKAGE => 'FS::alerter::_template' ) ],
user: From the mapsecrets file - see config.html from the base documentation
-=head1 VERSION
-
-$Id: freeside-expiration-alerter,v 1.3 2002-04-16 09:38:19 ivan Exp $
-
=head1 BUGS
Yes..... Use at your own risk. No guarantees or warrantees of any