Improvements to taxing

This commit is contained in:
Deon George
2013-12-05 16:22:23 +11:00
parent 8ba487a4a6
commit 778eada7f0
13 changed files with 253 additions and 212 deletions

View File

@@ -168,4 +168,8 @@ if (file_exists(APPPATH.'cache/CLEAR_APC_CACHE') AND function_exists('apc_clear_
if (! apc_clear_cache() OR ! unlink(APPPATH.'cache/CLEAR_APC_CACHE'))
throw new Kohana_Exception('Unable to clear the APC cache.');
}
// If we are a CLI, set our session dir
if (PHP_SAPI === 'cli')
session_save_path('tmp/');
?>

View File

@@ -17,8 +17,8 @@ class Currency {
return Num::format($amount,Company::instance()->decimals(),TRUE);
}
public static function round($amount) {
return Num::round($amount,Company::instance()->decimals());
public static function round($amount,$decimals=0) {
return Num::round($amount,Company::instance()->decimals()+$decimals);
}
}
?>

View File

@@ -12,13 +12,13 @@
class Model_Account extends Model_Auth_UserDefault {
// Relationships
protected $_has_many = array(
'user_tokens' => array('model' => 'user_token'),
'service_billing' => array('far_key'=>'id'),
'email_log' => array('far_key'=>'id'),
'group' => array('through' => 'account_group'),
'invoice' => array('far_key'=>'id'),
'user_tokens'=>array('model'=>'user_token'),
'service_billing'=>array('far_key'=>'id'),
'email_log'=>array('far_key'=>'id'),
'group'=>array('through'=>'account_group'),
'invoice'=>array('far_key'=>'id'),
'payment'=>array('far_key'=>'id'),
'service' => array('far_key'=>'id'),
'service'=>array('far_key'=>'id'),
);
protected $_has_one = array(

View File

@@ -14,6 +14,10 @@ class Model_Country extends ORM_OSB {
'currency'=>array('far_key'=>'id'),
);
protected $_has_many = array(
'tax'=>array('far_key'=>'id'),
);
protected $_sorting = array(
'name'=>'ASC',
);

View File

@@ -163,6 +163,17 @@ abstract class ORM_OSB extends ORM {
return empty($mc[$key]) ? '' : $mc[$key];
}
public function dump() {
$result = array();
$result['this'] = $this->object();
foreach ($this->_sub_items as $o)
$result['sub'][] = $o->dump();
return $result;
}
/**
* Get Next record id
*
@@ -240,6 +251,10 @@ abstract class ORM_OSB extends ORM {
return TRUE;
}
public function subitems() {
return $this->_sub_items;
}
/**
* Override the Kohana processing so we can null values if required.
*/