array(), ); protected $_has_one = array( 'invoice_item'=>array('far_key'=>'id'), ); protected $_nullifempty = array( 'attributes', ); protected $_serialize_column = array( 'attributes', ); protected $_display_filters = array( 'amount'=>array( array('Currency::display',array(':value')), ), 'date_orig'=>array( array('Config::date',array(':value')), ), 'date_charge'=>array( array('Config::date',array(':value')), ), 'processed'=>array( array('StaticList_YesNo::get',array(':value')), ), 'sweep_type'=>array( array('StaticList_SweepType::get',array(':value')), ), 'void'=>array( array('StaticList_YesNo::get',array(':value')), ), ); /** * Render some details for specific calls, eg: invoice */ public function details($type) { switch ($type) { case 'invoice_detail_items': return array('Other Charge'=>sprintf('%s (%s@%s)',$this->description,$this->quantity,Currency::display($this->amount))); default: throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type)); } } public function processed($render=FALSE) { return $this->label_bool('processed',$render); } public function total($format=FALSE) { $result = $this->quantity * $this->amount; if ($this->taxable) $result = Tax::add($result); return $format ? Currency::display($result) : $result; } } ?>