More Standardisation work.
This commit is contained in:
@@ -30,11 +30,11 @@ class Controller_Reseller_Charge extends Controller_Charge {
|
||||
$result = array();
|
||||
|
||||
if (isset($_REQUEST['term']) AND trim($_REQUEST['term'])) {
|
||||
$result = Arr::merge($result,ORM::factory('Account')->list_autocomplete($_REQUEST['term'],'id','id',array('ACC %s: %s'=>array('id','name(TRUE)'))));
|
||||
$result = Arr::merge($result,ORM::factory('Service')->list_autocomplete($_REQUEST['term'],'account_id','id',array('ACC %s: %s (%s)'=>array('account_id','account->name()','name()'))));
|
||||
$result = Arr::merge($result,ORM::factory('Account')->list_autocomplete($_REQUEST['term'],'id','id',array('%s: %s'=>array('refnum()','name()'))));
|
||||
$result = Arr::merge($result,ORM::factory('Service')->list_autocomplete($_REQUEST['term'],'account_id','id',array('%s: %s (%s)'=>array('account->refnum()','account->name()','name()'))));
|
||||
|
||||
foreach (array('Service_Plugin_Adsl','Service_Plugin_Domain','Service_Plugin_Host') as $o)
|
||||
$result = Arr::merge($result,ORM::factory($o)->list_autocomplete($_REQUEST['term'],'account_id','service->account_id',array('ACC %s: %s (%s)'=>array('service->account_id','service->account->name()','name()'))));
|
||||
$result = Arr::merge($result,ORM::factory($o)->list_autocomplete($_REQUEST['term'],'account_id','service->account_id',array('%s: %s (%s)'=>array('service->account->refnum()','service->account->name()','service->name()'))));
|
||||
}
|
||||
|
||||
$this->response->headers('Content-Type','application/json');
|
||||
@@ -45,7 +45,7 @@ class Controller_Reseller_Charge extends Controller_Charge {
|
||||
$result = array();
|
||||
|
||||
if (isset($_REQUEST['key']) AND trim($_REQUEST['key']))
|
||||
$result = Arr::merge($result,ORM::factory('Service')->list_autocomplete('','id','id',array('SVC %s: %s'=>array('id','service_name()')),array(array('account_id','=',$_REQUEST['key']))));
|
||||
$result = Arr::merge($result,ORM::factory('Service')->list_autocomplete('','id','id',array('%s: %s'=>array('refnum(TRUE)','name()')),array(array('account_id','=',$_REQUEST['key']))));
|
||||
|
||||
$this->response->headers('Content-Type','application/json');
|
||||
$this->response->body(json_encode(array_values($result)));
|
||||
@@ -104,6 +104,7 @@ $(document).ready(function() {
|
||||
alert("Failed to submit");
|
||||
},
|
||||
success: function(data) {
|
||||
$("select[name=service_id]").empty();
|
||||
$.each(data, function(i, j){
|
||||
var row = "<option value=\"" + j.value + "\">" + j.label + "</option>";
|
||||
$(row).appendTo("select[name=service_id]");
|
||||
|
Reference in New Issue
Block a user