Removed the use of TemplateDefault::filter()

This commit is contained in:
Deon George
2013-06-10 21:48:06 +10:00
parent abddbd31a2
commit 0ba1177c87
7 changed files with 90 additions and 105 deletions

View File

@@ -47,7 +47,7 @@ class Controller_Reseller_Service_Adsl extends Controller_Service {
}
public function action_list() {
$svs = $this->filter(ORM::factory('Service')->list_byplugin('ADSL'),$this->ao->RTM->customers($this->ao->RTM),'account_id','name()');
$svs = ORM::factory('Service')->where('account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->list_byplugin('ADSL');
$data = $this->consoltraffic($svs,time());

View File

@@ -19,8 +19,8 @@ class Controller_Reseller_Service_Domain extends Controller_Service {
->title('Domain License Services')
->title_icon('icon-th-list')
->body(Table::factory()
->jssort('adsl')
->data($this->filter(ORM::factory('Service')->list_byplugin('DOMAIN'),$this->ao->RTM->customers($this->ao->RTM),'account_id','name()'))
->jssort('domain')
->data(ORM::factory('Service')->where('account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->list_byplugin('DOMAIN'))
->columns(array(
'id'=>'ID',
'name()'=>'Service',

View File

@@ -19,8 +19,8 @@ class Controller_Reseller_Service_Host extends Controller_Service {
->title('Hosting Services')
->title_icon('icon-th-list')
->body(Table::factory()
->jssort('adsl')
->data($this->filter(ORM::factory('Service')->list_byplugin('HOST'),$this->ao->RTM->customers($this->ao->RTM),'account_id','name()'))
->jssort('host')
->data(ORM::factory('Service')->where('account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->list_byplugin('HOST'))
->columns(array(
'id'=>'ID',
'name()'=>'Service',

View File

@@ -10,22 +10,31 @@
* @license http://dev.osbill.net/license.html
*/
class Controller_Reseller_Invoice extends Controller_Invoice {
protected $secure_actions = array(
'list'=>TRUE,
);
public function action_list() {
list($id,$output) = Table::page(__METHOD__);
$ao = ORM::factory('Account',$id);
if (! $ao->loaded() OR ! Auth::instance()->authorised($ao))
throw HTTP_Exception::factory(403,'Unauthorised or doesnt exist?');
Block::add(array(
'body'=>$output,
));
$this->ao = $ao;
// @todo Our pagination is broken if we select multiple accounts, and those accounts have multiple invoices.
return parent::action_list();
Block::factory()
->title('Customer Invoices')
->title_icon('icon-th-list')
->body(Table::factory()
->jssort('invoices')
->data(ORM::factory('Invoice')->where('account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->where_active()->find_all())
->page_items(25)
->columns(array(
'id'=>'ID',
'date_orig'=>'Date Created',
'due_date'=>'Date Due',
'total(TRUE)'=>'Total',
'due(TRUE)'=>'Due',
'account->accnum()'=>'Cust ID',
'account->name()'=>'Customer',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
))
);
}
}
?>

View File

@@ -25,7 +25,7 @@ class Controller_Reseller_Service extends Controller_Service {
->title_icon('icon-th-list')
->body(Table::factory()
->jssort('services')
->data($this->filter(ORM::factory('Service')->find_all(),$this->ao->RTM->customers($this->ao->RTM),'account_id'))
->data(ORM::factory('Service')->where('account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->find_all())
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
@@ -49,9 +49,9 @@ class Controller_Reseller_Service extends Controller_Service {
// @todo This needs to be configurable
$go = ORM::factory('Group',array('name'=>'Personal'));
foreach (ORM::factory('Account')->list_active() as $ao)
foreach (ORM::factory('Account')->where_active()->where('id','IN',$this->ao->RTM->customers($this->ao->RTM))->find_all() as $ao)
if ($ao->has_any('group',array($go)))
foreach ($this->filter($ao->service->list_active(),$this->ao->RTM->customers($this->ao->RTM),'account_id') as $so)
foreach ($ao->service->list_active() as $so)
if (! $so->service_billing->checkout_plugin_id)
array_push($svs,$so);
@@ -80,8 +80,8 @@ class Controller_Reseller_Service extends Controller_Service {
foreach (ORM::factory('Checkout')->find_all() as $co) {
$svs = array();
foreach ($co->account->find_all() as $ao)
foreach ($this->filter($ao->service->list_active(),$this->ao->RTM->customers($this->ao->RTM),'account_id') as $so)
foreach ($co->account->where('account.id','IN',$this->ao->RTM->customers($this->ao->RTM))->find_all() as $ao)
foreach ($ao->service->list_active() as $so)
if ($so->service_billing->checkout_plugin_id == $co->id)
array_push($svs,$so);