Fixes for ADSL traffic collection and other ADSL items

This commit is contained in:
Deon George
2013-01-11 21:51:37 +11:00
parent 94b7b4bcd4
commit 7819a05515
16 changed files with 38 additions and 36 deletions

View File

@@ -33,7 +33,7 @@ class ADSL {
if (preg_match('/^a:/',$data))
throw new Kohana_Exception('Data shouldnt be a serialized array');
$ao = ORM::factory('ADSL_Plan',$data);
$ao = ORM::factory('Adsl_Plan',$data);
$output = View::factory('adsl/contract_view')
->set('record',$ao)
->set('price_base',$price_base)

View File

@@ -10,7 +10,7 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_ADSL_Plan extends ORM_OSB {
class Model_Adsl_Plan extends ORM_OSB {
// Relationships
// @todo This model should probably be joined with product_plugin_adsl
protected $_belongs_to = array(

View File

@@ -10,10 +10,10 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_ADSL_Supplier extends ORM_OSB {
class Model_Adsl_Supplier extends ORM_OSB {
// Relationships
protected $_has_many = array(
'ADSL_supplier_plan'=>array('foreign_key'=>'supplier_id','far_key'=>'id'),
'adsl_supplier_plan'=>array('foreign_key'=>'supplier_id','far_key'=>'id'),
);
protected $_updated_column = FALSE;
@@ -22,7 +22,7 @@ class Model_ADSL_Supplier extends ORM_OSB {
* Return a list of plans that this supplier makes available
*/
public function plans($active=TRUE) {
$a = $this->ADSL_supplier_plan;
$a = $this->adsl_supplier_plan;
if ($active)
$a->where_active();
@@ -37,7 +37,7 @@ class Model_ADSL_Supplier extends ORM_OSB {
$return = array();
foreach ($this->plans($active)->find_all() as $po)
foreach ($po->ADSL_plan->find_all() as $apo)
foreach ($po->adsl_plan->find_all() as $apo)
$return[$apo->id] = $apo;
return $return;

View File

@@ -10,13 +10,13 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_ADSL_Supplier_Plan extends ORM_OSB {
class Model_Adsl_Supplier_Plan extends ORM_OSB {
// Relationships
protected $_has_many = array(
'ADSL_plan'=>array('far_key'=>'id'),
'adsl_plan'=>array('far_key'=>'id'),
);
protected $_belongs_to = array(
'ADSL_supplier'=>array('foreign_key'=>'supplier_id'),
'adsl_supplier'=>array('foreign_key'=>'supplier_id'),
);
/**

View File

@@ -10,7 +10,7 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Service_Plugin_ADSL_Traffic extends ORM_OSB {
class Model_Service_Plugin_Adsl_Traffic extends ORM_OSB {
protected $_table_name = 'service__adsl_traffic';
protected $_primary_key = 'service';
protected $_disable_wild_select = TRUE;
@@ -27,7 +27,7 @@ class Model_Service_Plugin_ADSL_Traffic extends ORM_OSB {
return $result;
}
public function traffic(Model_Product_Plugin_ADSL $plan) {
public function traffic(Model_Product_Plugin_Adsl $plan) {
// Roll up the charges according to the product plan configuration
return ADSL::allowance(array(
'base_down_peak'=>is_null($plan->base_down_peak) ? NULL : $this->down_peak,

View File

@@ -10,7 +10,7 @@
* @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Service_Traffic_ADSL {
class Service_Traffic_Adsl {
protected $so;
protected $today;
protected $fetchresult = NULL;
@@ -51,7 +51,7 @@ class Service_Traffic_ADSL {
* @return HeadImage
*/
public static function instance($supplier) {
$sc = sprintf('%s_%s',get_called_class(),$supplier);
$sc = sprintf('%s_%s',get_called_class(),ucwords(strtolower($supplier)));
if (! class_exists($sc))
throw new Kohana_Exception('Class doesnt exist for :supplier',array(':supplier'=>$supplier));

View File

@@ -1,7 +1,7 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is able to collect traffic information for Exetel HSPA
* This class is able to collect traffic information for Exetel hspa
*
* Traffic information is collected by each service, and cached,
* returning just the date in question.
@@ -13,7 +13,7 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Service_Traffic_ADSL_ExetelHSPA extends Service_Traffic_ADSL {
class Service_Traffic_Adsl_Exetelhspa extends Service_Traffic_Adsl {
private $login_user_field = 'login_name';
private $login_pass_field = 'password';
private $date_field = 'date';
@@ -21,7 +21,7 @@ class Service_Traffic_ADSL_ExetelHSPA extends Service_Traffic_ADSL {
static $return = array();
/**
* Get the data for Exetel HSPA services
* Get the data for Exetel hspa services
*
* @return array
*/
@@ -30,8 +30,8 @@ class Service_Traffic_ADSL_ExetelHSPA extends Service_Traffic_ADSL {
$this->fetchresult = TRUE;
// If we have already collected the date data, return it.
if (! empty(Service_Traffic_ADSL_ExetelHSPA::$return[$date]))
return Service_Traffic_ADSL_ExetelHSPA::$return[$date];
if (! empty(Service_Traffic_Adsl_Exetelhspa::$return[$date]))
return Service_Traffic_Adsl_Exetelhspa::$return[$date];
include_once 'includes/kohana/modules/simplehtmldom/classes/simple_html_dom.php';
@@ -174,14 +174,14 @@ class Service_Traffic_ADSL_ExetelHSPA extends Service_Traffic_ADSL {
// Reformat the data into date order.
foreach ($update as $service => $sdata)
foreach ($sdata as $sdate => $details)
Service_Traffic_ADSL_ExetelHSPA::$return[$sdate][$service] = $details;
Service_Traffic_Adsl_Exetelhspa::$return[$sdate][$service] = $details;
// If the date we want is empty, return an array
if (empty(Service_Traffic_ADSL_ExetelHSPA::$return[$date]))
if (empty(Service_Traffic_Adsl_Exetelhspa::$return[$date]))
return array();
// Return the date we asked for
return Service_Traffic_ADSL_ExetelHSPA::$return[$date];
return Service_Traffic_Adsl_Exetelhspa::$return[$date];
}
}
?>

View File

@@ -13,7 +13,7 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Service_Traffic_ADSL_ExetelPE extends Service_Traffic_ADSL {
class Service_Traffic_Adsl_Exetelpe extends Service_Traffic_Adsl {
private $login_user_field = 'login_name';
private $login_pass_field = 'password';
private $date_field = 'date';
@@ -30,8 +30,8 @@ class Service_Traffic_ADSL_ExetelPE extends Service_Traffic_ADSL {
$this->fetchresult = TRUE;
// If we have already collected the date data, return it.
if (! empty(Service_Traffic_ADSL_ExetelPE::$return[$date]))
return Service_Traffic_ADSL_ExetelPE::$return[$date];
if (! empty(Service_Traffic_Adsl_Exetelpe::$return[$date]))
return Service_Traffic_Adsl_Exetelpe::$return[$date];
include_once 'includes/kohana/modules/simplehtmldom/classes/simple_html_dom.php';
@@ -167,14 +167,14 @@ class Service_Traffic_ADSL_ExetelPE extends Service_Traffic_ADSL {
// Reformat the data into date order.
foreach ($update as $service => $sdata)
foreach ($sdata as $sdate => $details)
Service_Traffic_ADSL_ExetelPE::$return[$sdate][$service] = $details;
Service_Traffic_Adsl_Exetelpe::$return[$sdate][$service] = $details;
// If the date we want is empty, return an array
if (empty(Service_Traffic_ADSL_ExetelPE::$return[$date]))
if (empty(Service_Traffic_Adsl_Exetelpe::$return[$date]))
return array();
// Return the date we asked for
return Service_Traffic_ADSL_ExetelPE::$return[$date];
return Service_Traffic_Adsl_Exetelpe::$return[$date];
}
}
?>

View File

@@ -10,7 +10,7 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Service_Traffic_ADSL_ExetelVisp extends Service_Traffic_ADSL {
class Service_Traffic_Adsl_Exetelvisp extends Service_Traffic_Adsl {
private $login_user_field = 'username';
private $login_pass_field = 'password';
private $date_field = 'date';