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);
|
||||
}
|
||||
|
||||
|
34
application/config/cache.php
Normal file
34
application/config/cache.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* OSB Caching
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage System
|
||||
* @category Configuration
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
|
||||
return array(
|
||||
'orm'=>array(
|
||||
'account'=>10,
|
||||
'account_log'=>86400,
|
||||
'account_group'=>60,
|
||||
'country'=>86400,
|
||||
'currency'=>86400,
|
||||
'invoice'=>60,
|
||||
'invoice_item'=>60,
|
||||
'invoice_item_tax'=>60,
|
||||
'service'=>60,
|
||||
'group'=>86400,
|
||||
'language'=>86400,
|
||||
'payment'=>60,
|
||||
'payment_item'=>60,
|
||||
'module'=>86400,
|
||||
'module_method'=>86400,
|
||||
'setup'=>86400,
|
||||
),
|
||||
);
|
||||
?>
|
@@ -0,0 +1,16 @@
|
||||
var search = _.debounce(function(url,query,process){
|
||||
$.get(site_url+url,{term: query},function(data) {
|
||||
users = {};
|
||||
userLabels = [];
|
||||
|
||||
_.each(data,function(item,ix,list) {
|
||||
if (_.contains(users,item.label))
|
||||
item.label = item.label + ' #' + item.value;
|
||||
|
||||
userLabels.push(item.label);
|
||||
users[item.label] = item.value;
|
||||
});
|
||||
|
||||
process(userLabels);
|
||||
})
|
||||
}, 300);
|
||||
|
@@ -2,7 +2,7 @@ $(document).ready(function() {
|
||||
$("input[name=search-query]").typeahead({
|
||||
minLength: 2,
|
||||
source: function (query,process) {
|
||||
search (query,process);
|
||||
search('u/search/ajaxlist',query,process);
|
||||
},
|
||||
|
||||
matcher: function () { return true; },
|
||||
@@ -12,21 +12,3 @@ $(document).ready(function() {
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
var search = _.debounce(function( query, process ){
|
||||
$.get(site_url+"/u/search/ajaxlist", {term: query}, function (data) {
|
||||
users = {};
|
||||
userLabels = [];
|
||||
|
||||
_.each( data, function( item, ix, list ){
|
||||
if ( _.contains( users, item.label ) ){
|
||||
item.label = item.label + ' #' + item.value;
|
||||
}
|
||||
|
||||
userLabels.push( item.label );
|
||||
users[ item.label ] = item.value;
|
||||
});
|
||||
|
||||
process( userLabels );
|
||||
})
|
||||
}, 300);
|
||||
|
Reference in New Issue
Block a user