More updates to ADSL module
This commit is contained in:
@@ -9,14 +9,35 @@
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Task_Adsl_Trafficalert extends Task_Adsl_Trafficget {
|
||||
protected function _execute(array $params) {
|
||||
foreach ($this->_traffic_suppliers(TRUE) as $aso) {
|
||||
if ($params['verbose'])
|
||||
echo $aso->name."\n";
|
||||
class Task_Adsl_Trafficalert extends Minion_Task {
|
||||
protected $_options = array(
|
||||
'verbose'=>FALSE,
|
||||
);
|
||||
|
||||
Service_Traffic_Adsl::instance($aso->name)->alert_traffic();
|
||||
protected function _execute(array $params) {
|
||||
$date = strtotime('last month');
|
||||
$c = array();
|
||||
|
||||
// @todo Pick up services that are no longer active, but were inactive < 30 days ago.
|
||||
foreach (ORM::factory('Service')->list_byplugin('ADSL') as $so) {
|
||||
if ($params['verbose'])
|
||||
echo $so->service_name()."\n";
|
||||
|
||||
if (! $data=$so->plugin()->traffic_report())
|
||||
continue;
|
||||
|
||||
$et = Email_Template::instance('adsl_traffic_notice');
|
||||
|
||||
// Get our variable data
|
||||
$et->to = array('account'=>array($so->account_id));
|
||||
$et->variables = $so->plugin()->template_variables($et->variables(),$data);
|
||||
|
||||
$et->send();
|
||||
|
||||
array_push($c,$so->id);
|
||||
}
|
||||
|
||||
return sprintf('%s alerts sent (%s)',count($c),join('|',$c));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user