Optimised Company() Setup() Config() and changed method_directory into URL
This commit is contained in:
@@ -46,7 +46,7 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
}
|
||||
|
||||
public function accnum() {
|
||||
return sprintf('%s-%04s',Config::siteid(TRUE),$this->id);
|
||||
return sprintf('%s-%04s',Company::instance()->site(TRUE),$this->id);
|
||||
}
|
||||
|
||||
public function sortkey($withcompany=FALSE) {
|
||||
@@ -115,10 +115,6 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
foreach ($this->invoices_due($date) as $io)
|
||||
$result += $io->due();
|
||||
|
||||
// @todo This shouldnt really be required
|
||||
if ($result < 0)
|
||||
throw new Kohana_Exception($result);
|
||||
|
||||
return $format ? Currency::display($result) : $result;
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,7 @@ class Model_Record_Id extends ORM_OSB {
|
||||
|
||||
$max = DB::select(array('MAX(id)','id'))
|
||||
->from($mo->name)
|
||||
->where('site_id','=',Config::siteid());
|
||||
->where('site_id','=',Company::instance()->site());
|
||||
|
||||
$this->id = $max->execute()->get('id');
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ class Model_Setup extends ORM_OSB {
|
||||
protected $_updated_column = FALSE;
|
||||
|
||||
protected $_has_one = array(
|
||||
'account'=>array('foreign_key'=>'id','far_key'=>'admin_id'),
|
||||
'country'=>array('foreign_key'=>'id','far_key'=>'country_id'),
|
||||
'language'=>array('foreign_key'=>'id','far_key'=>'language_id'),
|
||||
);
|
||||
|
Reference in New Issue
Block a user