asterisk2billing.org
http://forum.asterisk2billing.org/

balance notification feature request
http://forum.asterisk2billing.org/viewtopic.php?f=35&t=7345
Page 1 of 1

Author:  sergiocesar [ Sun Mar 21, 2010 1:52 pm ]
Post subject:  balance notification feature request

It would be nice to be able to send out notifications that would apply to both prepaid and postpaid customers where
customers are alerted based on their available credit.
As is today a postpaid customer gets a warning that is erroneous if they have any credit.
ie: a postpaid customer that has a credit limit of 50 and the alert set to 10, they are alerted when the account balance is at 10 or below.
In actuality this customer should not be alerted until he has a negative balance of 40.

I have modified 2 query lines in a2billing_notify_account.php and got this to work.
old line: about line 105
$QUERY = "SELECT count(*) FROM cc_card WHERE notify_email = 1 AND status = 1 AND credit < credit_notification AND " . $Delay_Clause;
New line
$QUERY = "SELECT count(*) FROM cc_card WHERE notify_email = 1 AND status = 1 AND (credit - credit_notification) < (-creditlimit) AND " . $Delay_Clause;

and
old line: about line 133
$sql = "SELECT id, email_notification, email FROM cc_card WHERE notify_email = 1 AND status = 1 AND credit < credit_notification AND " . $Delay_Clause . " ORDER BY id ";
New line:
$sql = "SELECT id, email_notification, email FROM cc_card WHERE notify_email = 1 AND status = 1 AND (credit - credit_notification) < (-creditlimit) AND " . $Delay_Clause . " ORDER BY id ";

It looks like it is working great BUT it would be nice to be able to show the value of the "creditlimit" on the email alert. I just could not figure out how to add this variable to show in the email template.

and my template would look something like this:

Your Telephone Services Account number $cardnumber$ is running low on credit.
Your account balance is: $creditcurrency$ $currency$.
Your warning level defined as: ($credit_notification$) $currency$
Your credit limit is: $creditlimit$ $currency$.

Please make a payment to your account blah blah blah!!!!........ or your service will stop.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/