Fixed a confusion over the usage of the 'opposite' function, which was converting, for example, from 'ASSET' to 'credit'. However, it seemed like it could be used to convert from 'debit' to 'credit', but it didn't work that way. So, I modified it to do so, and made things a bit more robust by making the comparisons case insensitive.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605@164 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -52,7 +52,7 @@ class Account extends AppModel {
|
||||
$type = $id_or_type;
|
||||
|
||||
// Asset and Expense accounts are debit accounts
|
||||
if (in_array($type, array('ASSET', 'EXPENSE')))
|
||||
if (in_array(strtoupper($type), array('ASSET', 'EXPENSE')))
|
||||
return 'debit';
|
||||
|
||||
// Otherwise, it's a credit account
|
||||
@@ -67,7 +67,10 @@ class Account extends AppModel {
|
||||
* - Returns the opposite fundmental type of the account, credit or debit
|
||||
*/
|
||||
function fundamentalOpposite($id_or_type) {
|
||||
$fund = $this->fundamentalType($id_or_type);
|
||||
if (in_array(strtolower($id_or_type), array('credit', 'debit')))
|
||||
$fund = $id_or_type;
|
||||
else
|
||||
$fund = $this->fundamentalType($id_or_type);
|
||||
|
||||
if ($fund == 'debit')
|
||||
return 'credit';
|
||||
|
||||
Reference in New Issue
Block a user