Merge in some desired changes from the statements_20090623 branch

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@193 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-30 18:09:17 +00:00
parent 2b2991a13a
commit 0558c35ebc
2 changed files with 25 additions and 18 deletions

View File

@@ -78,6 +78,24 @@ class AppModel extends Model {
/**************************************************************************
**************************************************************************
**************************************************************************
* function: nameToID
* - Returns the ID of the named item
*/
function nameToID($name) {
$this->cacheQueries = true;
$item = $this->find('first', array
('recursive' => -1,
'conditions' => compact('name'),
));
$this->cacheQueries = false;
$item = current($item);
return $item['id'];
}
/************************************************************************** /**************************************************************************
************************************************************************** **************************************************************************
************************************************************************** **************************************************************************

View File

@@ -82,26 +82,15 @@ class Account extends AppModel {
/************************************************************************** /**************************************************************************
************************************************************************** **************************************************************************
************************************************************************** **************************************************************************
* function: accountNameToID * function: Account IDs
* - Returns the ID of the named account * - Returns the ID of the desired account
*/ */
function accountNameToID($name) {
$this->cacheQueries = true;
$account = $this->find('first', array
('recursive' => -1,
'conditions' => compact('name'),
));
$this->cacheQueries = false;
return $account['Account']['id'];
}
function securityDepositAccountID() { return $this->accountNameToID('Security Deposit'); } function securityDepositAccountID() { return $this->nameToID('Security Deposit'); }
function rentAccountID() { return $this->accountNameToID('Rent'); } function rentAccountID() { return $this->nameToID('Rent'); }
function accountReceivableAccountID() { return $this->accountNameToID('A/R'); } function accountReceivableAccountID() { return $this->nameToID('A/R'); }
function invoiceAccountID() { return $this->accountReceivableAccountID(); } function invoiceAccountID() { return $this->nameToID('Invoice'); }
function receiptAccountID() { return $this->accountReceivableAccountID(); } function receiptAccountID() { return $this->nameToID('Receipt'); }
//function invoiceAccountID() { return $this->accountNameToID('Invoice'); }
//function receiptAccountID() { return $this->accountNameToID('Receipt'); }
/************************************************************************** /**************************************************************************