Multi enhancements, including auto serialization, product editing
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
@@ -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'),
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user