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

@@ -105,9 +105,9 @@ class Config extends Kohana_Config {
* security).
*/
public static function modules() {
static $return = array();
static $result = array();
if (! count($return)) {
if (! count($result)) {
// We need to know our site here, so that we can subsequently load our enabled modules.
if (PHP_SAPI === 'cli') {
if (! $site = Minion_CLI::options('site'))
@@ -118,10 +118,10 @@ class Config extends Kohana_Config {
}
foreach (ORM::factory('Module')->list_external() as $mo)
$return[$mo->name] = MODPATH.$mo->name;
$result[$mo->name] = MODPATH.$mo->name;
}
return $return;
return $result;
}
public static function module_config($item) {

View File

@@ -21,14 +21,14 @@ class Controller_Reseller_Account extends Controller_Account {
* @note list_autocomplete() will limit to authorised accounts
*/
public function action_ajaxlist() {
$return = array();
$result = array();
if (isset($_REQUEST['term']) AND trim($_REQUEST['term']))
$return += ORM::factory('Account')->list_autocomplete($_REQUEST['term']);
$result += ORM::factory('Account')->list_autocomplete($_REQUEST['term']);
$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)));
}
/**

View File

@@ -68,13 +68,13 @@ class Model_Account extends Model_Auth_UserDefault {
* @param int Date (in secs) to only retrieve invoices prior to this date
*/
public function invoices_due($date=NULL) {
$return = array();
$result = array();
foreach ($this->invoices() as $io)
if ((is_null($date) OR $io->date_orig < $date) AND $io->due())
$return[$io->id] = $io;
$result[$io->id] = $io;
return $return;
return $result;
}
/**
@@ -139,7 +139,7 @@ class Model_Account extends Model_Auth_UserDefault {
* Search for accounts matching a term
*/
public function list_autocomplete($term,$index='id',array $limit=array()) {
$return = array();
$result = array();
$ao = Auth::instance()->get_user();
$this->clear();
@@ -183,12 +183,12 @@ class Model_Account extends Model_Auth_UserDefault {
$this->and_where('id','IN',$ao->RTM->customers($ao->RTM));
foreach ($this->find_all() as $o)
$return[$o->$index] = array(
$result[$o->$index] = array(
'value'=>$o->$index,
'label'=>sprintf('ACC %s: %s',$o->id,Table::resolve($o,$value)),
);
return $return;
return $result;
}
}
?>

View File

@@ -42,21 +42,21 @@ class Model_Group extends Model_Auth_RoleDefault {
* are also related to this group, in the group heirarchy.
*/
public function list_childgrps($incParent=FALSE) {
$return = array();
$result = array();
if (! $this->loaded())
return $return;
return $result;
foreach (ORM::factory('Group')->where_active()->and_where('parent_id','=',$this)->find_all() as $go) {
array_push($return,$go);
array_push($result,$go);
$return = array_merge($return,$go->list_childgrps());
$result = array_merge($result,$go->list_childgrps());
}
if ($incParent)
array_push($return,$this);
array_push($result,$this);
return $return;
return $result;
}
/**
@@ -64,21 +64,21 @@ class Model_Group extends Model_Auth_RoleDefault {
* are also related to this group, in the group heirarchy.
*/
public function list_parentgrps($incParent=FALSE) {
$return = array();
$result = array();
if (! $this->loaded())
return $return;
return $result;
foreach (ORM::factory('Group')->where_active()->and_where('id','=',$this->parent_id)->find_all() as $go) {
array_push($return,$go);
array_push($result,$go);
$return = array_merge($return,$go->list_parentgrps());
$result = array_merge($result,$go->list_parentgrps());
}
if ($incParent)
array_push($return,$this);
array_push($result,$this);
return $return;
return $result;
}
}
?>

View File

@@ -20,15 +20,15 @@ class Model_RTM extends ORM_OSB {
);
public function customers(Model_RTM $rtmo) {
$return = array();
$result = array();
foreach ($rtmo->agents_direct() as $artmo)
$return = $return+$rtmo->customers($artmo);
$result = $result+$rtmo->customers($artmo);
foreach ($rtmo->customers_direct() as $ao)
array_push($return,$ao);
array_push($result,$ao);
return $return;
return $result;
}
public function agents_direct() {

View File

@@ -106,7 +106,7 @@ class Period {
// Change our end date to the day before
$period_end -= 86400;
$return = array(
$result = array(
'start'=>$period_start,
'start_time'=>$start,
'date'=>$start,
@@ -121,9 +121,9 @@ class Period {
if ($df)
foreach (array('start','date','end') as $key)
$return[$key] = Config::date($return[$key]);
$result[$key] = Config::date($result[$key]);
return $return;
return $result;
}
}
?>