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

@@ -119,7 +119,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
}
/**
* Return a list of invoice items for this payment.
* Return a list of invoice items for this invoice.
* @param type [CHARGE|CREDIT|ALL]
* @see invoice_items
*/
@@ -128,6 +128,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
foreach ($this->invoice_items as $ito) {
$return = FALSE;
switch ($type) {
case 'CHARGE':
if ($ito->quantity > 0)
@@ -143,7 +144,6 @@ class Model_Invoice extends ORM_OSB implements Cartable {
default:
$return = TRUE;
break;
}
if ($return)
@@ -530,7 +530,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
* Search for invoices matching a term
*/
public function list_autocomplete($term,$index='id') {
$return = array();
$result = array();
if (is_numeric($term)) {
$this->clear();
@@ -541,13 +541,13 @@ class Model_Invoice extends ORM_OSB implements Cartable {
// @todo This should limit the results so that users dont see other users services.
foreach ($this->find_all() as $o)
$return[$o->$index] = array(
$result[$o->$index] = array(
'value'=>$o->$index,
'label'=>sprintf('INV %s: %s',$o->id,Table::resolve($o,$value)),
);
}
return $return;
return $result;
}
private function _list_due() {
@@ -589,19 +589,19 @@ class Model_Invoice extends ORM_OSB implements Cartable {
* Return a list of invoices that are over their due date with/without auto billing
*/
public function list_overdue_billing($time=NULL,$billing=FALSE) {
$return = array();
$result = array();
foreach ($this->list_overdue($time) as $io) {
$i = FALSE;
foreach ($io->service->find_all() as $so)
if (($billing AND $so->account_billing_id) OR (! $billing AND ! $so->account_billing_id)) {
array_push($return,$io);
array_push($result,$io);
break;
}
}
return $return;
return $result;
}
/**