Overhaul ADSL traffic reporting/graphing

This commit is contained in:
Deon George
2013-11-14 22:50:35 +11:00
parent 158a4f9e47
commit e01d37244c
33 changed files with 891 additions and 471 deletions

View File

@@ -52,6 +52,9 @@ class Model_Service extends ORM_OSB {
protected $_form = array('id'=>'id','value'=>'service_name()');
// Cache our calls to our plugins
public static $plugin = array();
/**
* Get the additional charges associated with this service
*/
@@ -201,9 +204,10 @@ class Model_Service extends ORM_OSB {
if (! $this->product->prod_plugin_file)
return NULL;
$o = ORM::factory(Kohana::classname(sprintf('Service_Plugin_%s',$this->product->prod_plugin_file)),array('service_id'=>$this->id));
if (! isset(Model_Service::$plugin[$this->id]))
Model_Service::$plugin[$this->id] = ORM::factory(Kohana::classname(sprintf('Service_Plugin_%s',$this->product->prod_plugin_file)),array('service_id'=>$this->id));
return $type ? $o->$type : $o;
return $type ? Model_Service::$plugin[$this->id]->$type : Model_Service::$plugin[$this->id];
}
public function revenue($annual=FALSE) {
@@ -237,7 +241,7 @@ class Model_Service extends ORM_OSB {
if (! $original AND ! is_null($this->price_override))
$p = $this->price_override;
if ($tax)
$p = Tax::add($p);
@@ -266,10 +270,7 @@ class Model_Service extends ORM_OSB {
* Enable the plugin to store data
*/
public function admin_update() {
if (is_null($plugin = $this->plugin()))
return NULL;
else
return $plugin->admin_update();
return (is_null($plugin = $this->plugin())) ? NULL : $plugin->admin_update();
}
public function transactions() {