Added a couple helper functions to Ledger.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@347 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-15 18:33:30 +00:00
parent ae04aafaca
commit 4d4bebc3d3

View File

@@ -46,6 +46,34 @@ class Ledger extends AppModel {
);
/**************************************************************************
**************************************************************************
**************************************************************************
* function: accountID
* - Returns the account ID for the given ledger
*/
function accountID($id) {
$this->cacheQueries = true;
$item = $this->find('first', array
('contain' => 'Account.id',
'conditions' => array('Ledger.id' => $id),
));
$this->cacheQueries = false;
return $item['Account']['id'];
}
/**************************************************************************
**************************************************************************
**************************************************************************
* function: currentLedgerID
* - Returns the current ledger ID of the account for the given ledger.
*/
function currentLedgerID($id) {
return $this->Account->currentLedgerID($this->accountID($id));
}
/**************************************************************************
**************************************************************************
**************************************************************************