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:
@@ -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'];
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
|
||||
@@ -82,26 +82,15 @@ class Account extends AppModel {
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: accountNameToID
|
||||
* - Returns the ID of the named account
|
||||
* function: Account IDs
|
||||
* - 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 rentAccountID() { return $this->accountNameToID('Rent'); }
|
||||
function accountReceivableAccountID() { return $this->accountNameToID('A/R'); }
|
||||
function invoiceAccountID() { return $this->accountReceivableAccountID(); }
|
||||
function receiptAccountID() { return $this->accountReceivableAccountID(); }
|
||||
//function invoiceAccountID() { return $this->accountNameToID('Invoice'); }
|
||||
//function receiptAccountID() { return $this->accountNameToID('Receipt'); }
|
||||
function securityDepositAccountID() { return $this->nameToID('Security Deposit'); }
|
||||
function rentAccountID() { return $this->nameToID('Rent'); }
|
||||
function accountReceivableAccountID() { return $this->nameToID('A/R'); }
|
||||
function invoiceAccountID() { return $this->nameToID('Invoice'); }
|
||||
function receiptAccountID() { return $this->nameToID('Receipt'); }
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user