More use of list_active(), setup ajax actions that are check to be ajax
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
// @todo This "module" menu items should belong in the module dir.
|
||||
protected $secure_actions = array(
|
||||
'autolist'=>FALSE, // @todo To Change
|
||||
'ajaxlist'=>FALSE, // @todo To Change
|
||||
'adslstat'=>TRUE,
|
||||
'list'=>TRUE,
|
||||
'listbycheckout'=>TRUE,
|
||||
@@ -31,23 +31,17 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
'view'=>TRUE,
|
||||
);
|
||||
|
||||
public function action_autolist() {
|
||||
public function action_ajaxlist() {
|
||||
$return = array();
|
||||
|
||||
$s = ORM::factory('service')->where_active();
|
||||
if (isset($_REQUEST['aid']))
|
||||
$s = $s->where('account_id','=',$_REQUEST['aid']);
|
||||
|
||||
// @todo This should limit the results so that users dont see other users services.
|
||||
foreach ($s->find_all() as $so)
|
||||
array_push($return,array(
|
||||
'value'=>$so->id,
|
||||
'text'=>sprintf('%s: %s',$so->id,$so->service_name()),
|
||||
));
|
||||
$return += ORM::factory('service')->list_autocomplete(
|
||||
isset($_REQUEST['term']) ? $_REQUEST['term'] : '',
|
||||
'id',
|
||||
isset($_REQUEST['aid']) ? array(array('account_id','=',$_REQUEST['aid'])) : array());
|
||||
|
||||
$this->auto_render = FALSE;
|
||||
$this->response->headers('Content-Type','application/json');
|
||||
$this->response->body(json_encode($return));
|
||||
$this->response->body(json_encode(array_values($return)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +78,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
||||
// @todo This needs to be configurable
|
||||
$go = ORM::factory('group',array('name'=>'Personal'));
|
||||
|
||||
foreach (ORM::factory('account')->where('status','=',1)->find_all() as $ao)
|
||||
foreach (ORM::factory('account')->list_active() as $ao)
|
||||
if ($ao->has_any('group',array($go)))
|
||||
foreach ($ao->service->list_active() as $so)
|
||||
if (! $so->service_billing->checkout_plugin_id)
|
||||
|
Reference in New Issue
Block a user