More updates to ADSL module

This commit is contained in:
Deon George
2013-11-15 16:25:45 +11:00
parent f80fcdc4c1
commit c66f2f14c4
12 changed files with 203 additions and 193 deletions

View File

@@ -12,6 +12,7 @@
class Model_Charge extends ORM_OSB {
protected $_belongs_to = array(
'account'=>array(),
'service'=>array(),
);
protected $_has_one = array(
'invoice_item'=>array('far_key'=>'id'),
@@ -46,6 +47,36 @@ class Model_Charge extends ORM_OSB {
),
);
/**
* Temporarily override our parent call to reformat old data
*/
public function __get($column) {
switch ($column) {
case 'attributes':
$x = parent::__get($column);
if (is_string($this->_object[$column]) AND preg_match('/==/',$this->_object[$column])) {
$x = explode("\n",$this->_object[$column]);
foreach ($x as $k=>$v) {
if (preg_match('/==/',$x[$k]))
$x[$k] = preg_replace('/==\s*/',':',$v);
if (preg_replace('/^ADSL Service:/',"",$x[$k]) == $this->service->plugin()->service_number)
unset($x[$k]);
}
sort($x);
}
$this->{$column} = $x;
return $x;
default: return parent::__get($column);
}
}
/**
* Render some details for specific calls, eg: invoice
*/