Renamed prExit to prReturn, to be consitent with the return statement where it should be used. Also, modified the chargePaymentFields to be more explicit on the balance, in anticipation of the new type VOID
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@440 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -22,7 +22,7 @@ class StatementEntry extends AppModel {
|
||||
|
||||
);
|
||||
|
||||
var $default_log_level = 30;
|
||||
//var $default_log_level = 30;
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -45,7 +45,8 @@ class StatementEntry extends AppModel {
|
||||
($sum ? ')' : '') . ' AS payment' . ($sum ? 's' : ''),
|
||||
|
||||
($sum ? 'SUM(' : '') .
|
||||
"IF({$entry_name}.type = 'CHARGE', 1, -1)" .
|
||||
"IF({$entry_name}.type = 'CHARGE', 1," .
|
||||
" IF({$entry_name}.type = 'PAYMENT' OR {$entry_name}.type = 'SURPLUS', -1, 0))" .
|
||||
" * IF({$entry_name}.amount, {$entry_name}.amount, 0)" .
|
||||
($sum ? ')' : '') . ' AS balance',
|
||||
);
|
||||
@@ -73,10 +74,10 @@ class StatementEntry extends AppModel {
|
||||
empty($entry['account_id']) ||
|
||||
empty($entry['amount'])
|
||||
) {
|
||||
return $this->prExit(false);
|
||||
return $this->prReturn(false);
|
||||
}
|
||||
|
||||
return $this->prExit(true);
|
||||
return $this->prReturn(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +102,7 @@ class StatementEntry extends AppModel {
|
||||
return array('error' => true, 'save_data' => $entry) + $ret;
|
||||
|
||||
$ret['statement_entry_id'] = $this->id;
|
||||
return $this->prExit($ret + array('error' => false));
|
||||
return $this->prReturn($ret + array('error' => false));
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +185,7 @@ OPTION 2
|
||||
elseif (isset($entry['credit_ledger_id']))
|
||||
$refund_account_id = $this->Ledger->accountID($entry['credit_ledger_id']);
|
||||
else
|
||||
return $this->prExit(null);
|
||||
return $this->prReturn(null);
|
||||
|
||||
// post new refund in the income account
|
||||
$ids = $A->postEntry
|
||||
@@ -207,14 +208,14 @@ OPTION 2
|
||||
);
|
||||
|
||||
if ($ids['error'])
|
||||
return $this->prExit(null);
|
||||
return $this->prReturn(null);
|
||||
$transaction_id = $ids['transaction_id'];
|
||||
|
||||
$this->pr(15, compact('ids', 'amount', 'refund_account_id', 'ar_account_id'),
|
||||
'Posted Refund Ledger Entry');
|
||||
}
|
||||
|
||||
return $this->prExit(true);
|
||||
return $this->prReturn(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +278,7 @@ OPTION 2
|
||||
}
|
||||
}
|
||||
|
||||
return $this->prExit(array('entries' => $resultset,
|
||||
return $this->prReturn(array('entries' => $resultset,
|
||||
'summary' => $this->stats(null, $query)));
|
||||
}
|
||||
|
||||
@@ -314,7 +315,7 @@ OPTION 2
|
||||
foreach (array_keys($result) AS $i)
|
||||
unset($result[$i]['StatementEntry']);
|
||||
|
||||
return $this->prExit(array('entries' => $result));
|
||||
return $this->prReturn(array('entries' => $result));
|
||||
}
|
||||
|
||||
|
||||
@@ -330,6 +331,7 @@ OPTION 2
|
||||
*
|
||||
*/
|
||||
function assignCredits($query = null, $receipt_id = null) {
|
||||
//$this->prFunctionLevel(25);
|
||||
$this->prEnter( compact('query', 'receipt_id'));
|
||||
$this->queryInit($query);
|
||||
|
||||
@@ -524,7 +526,7 @@ OPTION 2
|
||||
$ret['error'] = true;
|
||||
}
|
||||
|
||||
return $this->prExit($ret + array('error' => false));
|
||||
return $this->prReturn($ret + array('error' => false));
|
||||
}
|
||||
|
||||
|
||||
@@ -585,7 +587,7 @@ OPTION 2
|
||||
$this->pr(17, compact('rquery', 'result'),
|
||||
'Payments');
|
||||
|
||||
return $this->prExit($stats);
|
||||
return $this->prReturn($stats);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user