diff --git a/models/account.php b/models/account.php index e4c9f39..36a9d2b 100644 --- a/models/account.php +++ b/models/account.php @@ -121,25 +121,32 @@ class Account extends AppModel { * - Returns the ID of the desired account */ - function securityDepositAccountID() { return $this->nameToID('Security Deposit'); } - function rentAccountID() { return $this->nameToID('Rent'); } - function lateChargeAccountID() { return $this->nameToID('Late Charge'); } - function nsfAccountID() { return $this->nameToID('NSF'); } - function nsfChargeAccountID() { return $this->nameToID('NSF Charge'); } - function taxAccountID() { return $this->nameToID('Tax'); } - function accountReceivableAccountID() { return $this->nameToID('A/R'); } - function accountPayableAccountID() { return $this->nameToID('A/P'); } - function cashAccountID() { return $this->nameToID('Cash'); } - function checkAccountID() { return $this->nameToID('Check'); } - function moneyOrderAccountID() { return $this->nameToID('Money Order'); } - function achAccountID() { return $this->nameToID('ACH'); } - function concessionAccountID() { return $this->nameToID('Concession'); } - function waiverAccountID() { return $this->nameToID('Waiver'); } - function pettyCashAccountID() { return $this->nameToID('Petty Cash'); } - function invoiceAccountID() { return $this->nameToID('Invoice'); } - function receiptAccountID() { return $this->nameToID('Receipt'); } - function badDebtAccountID() { return $this->nameToID('Bad Debt'); } - function customerCreditAccountID() { return $this->nameToID( + function lookup($name, $check = true) { + $id = $this->nameToID($name); + if (empty($id) && $check) + $this->INTERNAL_ERROR("Missing Account '$name'"); + return $id; + } + + function securityDepositAccountID() { return $this->lookup('Security Deposit'); } + function rentAccountID() { return $this->lookup('Rent'); } + function lateChargeAccountID() { return $this->lookup('Late Charge'); } + function nsfAccountID() { return $this->lookup('NSF'); } + function nsfChargeAccountID() { return $this->lookup('NSF Charge'); } + function taxAccountID() { return $this->lookup('Tax'); } + function accountReceivableAccountID() { return $this->lookup('A/R'); } + function accountPayableAccountID() { return $this->lookup('A/P'); } + function cashAccountID() { return $this->lookup('Cash'); } + function checkAccountID() { return $this->lookup('Check'); } + function moneyOrderAccountID() { return $this->lookup('Money Order'); } + function achAccountID() { return $this->lookup('ACH'); } + function concessionAccountID() { return $this->lookup('Concession'); } + function waiverAccountID() { return $this->lookup('Waiver'); } + function pettyCashAccountID() { return $this->lookup('Petty Cash'); } + function invoiceAccountID() { return $this->lookup('Invoice'); } + function receiptAccountID() { return $this->lookup('Receipt'); } + function badDebtAccountID() { return $this->lookup('Bad Debt'); } + function customerCreditAccountID() { return $this->lookup( // REVISIT : 20090816 // Use of A/R works, and saves an excess of accounts. // However, a dedicated account is nice, since it can @@ -238,8 +245,8 @@ class Account extends AppModel { $this->nsfAccountID(), $this->waiverAccountID(), $this->badDebtAccountID(), - //$this->nameToID('Closing'), - //$this->nameToID('Equity'), + //$this->lookup('Closing'), + //$this->lookup('Equity'), ) AS $account_id) { $accounts[$account_id] = $this->name($account_id);