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

@@ -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() {