More updates to ADSL module
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user