Multi enhancements, including auto serialization, product editing

This commit is contained in:
Deon George
2012-03-30 15:13:01 +11:00
parent d9c3394b0f
commit 6807b6ab52
30 changed files with 445 additions and 115 deletions

View File

@@ -44,10 +44,6 @@ class Model_Service extends ORMOSB {
'recur_schedule'=>array(
array('StaticList_RecurSchedule::display',array(':value')),
),
'price'=>array(
array('Tax::add',array(':value')),
array('Currency::display',array(':value')),
),
);
/**
@@ -77,6 +73,21 @@ class Model_Service extends ORMOSB {
return is_null($plugin=$this->plugin()) ? $this->product->name() : $plugin->name();
}
/**
* Return the service charge
*/
public function price($tax=FALSE,$format=FALSE) {
$x = $this->product->keyget('price_group',$this->recur_schedule);
// @todo This index shouldnt be hard coded.
$p = $this->price ? $this->price : $x[$this->price_group]['price_base'];
if ($tax)
$p = Tax::add($p);
return $format ? Currency::display($p) : $p;
}
public function service_name() {
return is_null($plugin=$this->plugin()) ? $this->name() : $plugin->service_name();
}

View File

@@ -12,5 +12,10 @@
*/
class Model_Service_Billing extends ORMOSB {
protected $_table_name = 'account_billing';
// Relationships
protected $_has_one = array(
'checkout'=>array('far_key'=>'checkout_plugin_id','foreign_key'=>'id'),
);
}
?>