Removed remnants of the Containable behavior (which we've already put into the application model. Modified the account model to look for all unreconciled transactions, not just those from the current ledger. Added a mechanism to find unreconciled transactions up the chain, including lease and customer.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@159 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-17 09:00:38 +00:00
parent 16126b7b6e
commit 45ae013e99
5 changed files with 53 additions and 15 deletions

View File

@@ -100,13 +100,11 @@ class Account extends AppModel {
$contain = array('CurrentLedger' => array('fields' => array('CurrentLedger.id')));
}
$this->Behaviors->attach('Containable');
$account = $this->find('first', array
('contain' => $contain,
'fields' => array(),
'conditions' => array(array('Account.id' => $id)),
));
$this->Behaviors->detach('Containable');
if ($all) {
$ledger_ids = array();
@@ -199,7 +197,8 @@ class Account extends AppModel {
**************************************************************************
**************************************************************************
* function: findUnreconciledLedgerEntries
* - Returns summary data from the requested account.
* - Returns ledger entries that are not yet reconciled
* (such as charges not paid).
*/
function findUnreconciledLedgerEntries($id = null) {
@@ -207,7 +206,7 @@ class Account extends AppModel {
$unreconciled['debits'] = $this->find
('all', array
('link' => array
('CurrentLedger' => array
('Ledger' => array
('fields' => array(),
'DebitLedgerEntry' => array
('fields' => array('id', 'amount'),
@@ -229,7 +228,7 @@ class Account extends AppModel {
$unreconciled['credits'] = $this->find
('all', array
('link' => array
('CurrentLedger' => array
('Ledger' => array
('fields' => array(),
'CreditLedgerEntry' => array
('fields' => array('id', 'amount'),
@@ -268,7 +267,6 @@ class Account extends AppModel {
// (not just the balance), so we may have to query all
// ledgers, as dictated by the $all parameter.
$this->Behaviors->attach('Containable');
$account = $this->find('first',
array('contain' =>
($all
@@ -280,7 +278,6 @@ class Account extends AppModel {
'conditions' => array
(array('Account.id' => $id))
));
$this->Behaviors->detach('Containable');
$stats = array();
if ($all) {