Consistent use of return , payment refund handling

This commit is contained in:
Deon George
2013-04-05 23:50:08 +11:00
parent 43dfd88bce
commit 52d9005b64
30 changed files with 255 additions and 210 deletions

View File

@@ -33,20 +33,20 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
);
public function action_ajaxlist() {
$return = array();
$result = array();
$return += ORM::factory('Service')->list_autocomplete(
$result += 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(array_values($return)));
$this->response->body(json_encode(array_values($result)));
}
public function action_ajaxjson_traffic() {
$return = array();
$result = array();
$svs = ORM::factory('Service')->list_bylistgroup('ADSL');
$data = $this->consoltraffic($svs,time());
@@ -610,7 +610,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
return;
$start = $end = FALSE;
$return = array();
$result = array();
foreach (preg_split("/\n/",$data) as $line) {
// Items start after "Item ID"
if (! $start && preg_match('/^Item ID,/',$line)) {
@@ -638,18 +638,18 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
// If the description says Monthly Charge, we know its the monthly fee.
if (preg_match('/^Monthly Charge/',$description))
$return[$service]['cost'] = preg_replace('/\$/','',$total);
$result[$service]['cost'] = preg_replace('/\$/','',$total);
// If the description says VISP credit, we know this is commission.
elseif (preg_match('/^VISP Credit/',$description))
$return[$service]['credit'] = preg_replace('/\$/','',$total);
$result[$service]['credit'] = preg_replace('/\$/','',$total);
// If the description says Excess, we know this is excess charges.
elseif (preg_match('/^Excess usage/',$description))
$return[$service]['excess'] = preg_replace('/\$/','',$total);
$result[$service]['excess'] = preg_replace('/\$/','',$total);
else
$return[$service]['info'] = $line;
$result[$service]['info'] = $line;
}
return $return;
return $result;
}
/**