Improvements to payment and other misc items
This commit is contained in:
@@ -65,7 +65,7 @@ class Config extends Kohana_Config {
|
||||
}
|
||||
|
||||
public static function date($date) {
|
||||
return is_null($date) ? ' ' : date(Company::instance()->date_format(),$date);
|
||||
return is_null($date) ? '' : date(Company::instance()->date_format(),$date);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -89,8 +89,8 @@ class Controller_Admin_Welcome extends Controller_Welcome {
|
||||
'account->accnum()'=>array('label'=>'Num'),
|
||||
'account->name()'=>array('label'=>'Account'),
|
||||
'account->display("status")'=>array('label'=>'Active'),
|
||||
'id'=>array('label'=>'ID','url'=>URL::link('admin','payment/view/')),
|
||||
'total_amt'=>array('label'=>'Total','class'=>'right'),
|
||||
'id'=>array('label'=>'ID','url'=>URL::link('admin','payment/edit/')),
|
||||
'total(TRUE)'=>array('label'=>'Total','class'=>'right'),
|
||||
'balance(TRUE)'=>array('label'=>'Balance','class'=>'right'),
|
||||
),
|
||||
array('show_other'=>'balance()')),
|
||||
|
@@ -29,7 +29,6 @@ class Controller_User_Search extends Controller_Search {
|
||||
$result = Arr::merge($result,ORM::factory($o)->list_autocomplete($_REQUEST['term'],'url','service_id',array('SVC %s: %s'=>array('service_id','service_name()')),array(),array('urlprefix'=>'u/service/view/')));
|
||||
}
|
||||
|
||||
$this->auto_render = FALSE;
|
||||
$this->response->headers('Content-Type','application/json');
|
||||
$this->response->body(json_encode(array_values($result)));
|
||||
}
|
||||
|
@@ -34,13 +34,14 @@ abstract class Kohana extends Kohana_Core {
|
||||
if (! in_array($dir,$dirs) OR PHP_SAPI === 'cli')
|
||||
return parent::find_file($dir,$file,$ext,$array);
|
||||
|
||||
$prefixes = array('');
|
||||
|
||||
// Our search order.
|
||||
$prefixes = array(
|
||||
sprintf('site/%s/%s/',Config::siteid(),Config::theme()),
|
||||
sprintf('site/%s/',Config::siteid()),
|
||||
Config::theme().'/',
|
||||
'',
|
||||
);
|
||||
if (! preg_match('/^theme\//',$file)) {
|
||||
array_unshift($prefixes,Config::theme().'/');
|
||||
array_unshift($prefixes,sprintf('site/%s/',Config::siteid()));
|
||||
array_unshift($prefixes,sprintf('site/%s/%s/',Config::siteid(),Config::theme()));
|
||||
}
|
||||
|
||||
foreach ($prefixes as $p)
|
||||
if ($x = parent::find_file($dir,$p.$file,$ext,$array))
|
||||
|
@@ -13,6 +13,7 @@ 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'),
|
||||
@@ -132,10 +133,7 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
* Return an account name
|
||||
*/
|
||||
public function name($withcompany=FALSE) {
|
||||
if ($withcompany)
|
||||
return sprintf('%s %s%s',$this->first_name,$this->last_name,$this->company ? sprintf(' (%s)',$this->company) : '');
|
||||
else
|
||||
return sprintf('%s %s',$this->first_name,$this->last_name);
|
||||
return trim(sprintf('%s %s',$this->first_name,$this->last_name).(($withcompany AND $this->company) ? sprintf(' (%s)',$this->company) : ''));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -31,6 +31,17 @@ abstract class ORM extends Kohana_ORM {
|
||||
if (! in_array($this->_table_name,ORM::$no_site_id_tables))
|
||||
$this->where($this->_object_name.'.site_id','=',Company::instance()->site());
|
||||
|
||||
// Ensure we Cache our queries
|
||||
$caching = FALSE;
|
||||
foreach ($this->_db_pending as $method)
|
||||
if ($method['name'] == 'cached') {
|
||||
$caching = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (! $caching)
|
||||
$this->cached(Kohana::$config->load('cache.orm.'.$this->_table_name));
|
||||
|
||||
return parent::_build($type);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user