diff --git a/site/models/account.php b/site/models/account.php index ab6fa13..56b90f2 100644 --- a/site/models/account.php +++ b/site/models/account.php @@ -495,9 +495,6 @@ class Account extends AppModel { $monetary_data, $entry_data, $reconcile = null) { - // Create some models for convenience - $A = new Account(); - //pr(compact('transaction_data', 'monetary_data', 'entry_data', 'reconcile')); // Automatically figure out the customer if we have the lease @@ -538,12 +535,12 @@ class Account extends AppModel { // Convert Account ID to name or vice versa if (isset($monetary_data['account_id'])) { - $monetary_data['account_name'] = $A->name($monetary_data['account_id']); + $monetary_data['account_name'] = $this->name($monetary_data['account_id']); } elseif (isset($monetary_data['account_name'])) { - $monetary_data['account_id'] = $A->nameToID($monetary_data['account_name']); + $monetary_data['account_id'] = $this->nameToID($monetary_data['account_name']); } - if ($monetary_data['account_id'] == $A->cashAccountID()) { + if ($monetary_data['account_id'] == $this->cashAccountID()) { // No distinguishing features of Cash, just // use the shared monetary source $monetary_data['monetary_source_id'] = @@ -561,8 +558,8 @@ class Account extends AppModel { // Create a new one dedicated to this entry // Give it a fancy name based on the check number $monetary_data['MonetarySource']['name'] = $monetary_data['account_name']; - if ($monetary_data['account_name'] === $A->name($A->checkAccountID()) || - $monetary_data['account_name'] === $A->name($A->moneyOrderAccountID())) { + if ($monetary_data['account_name'] === $this->name($this->checkAccountID()) || + $monetary_data['account_name'] === $this->name($this->moneyOrderAccountID())) { $monetary_data['MonetarySource']['name'] .= ' #' . $monetary_data['MonetarySource']['data1']; } @@ -593,9 +590,9 @@ class Account extends AppModel { if (!isset($entry_data['debit_ledger_id'])) { $entry_data['debit_ledger_id'] = (isset($entry_data['debit_account_id']) - ? $A->currentLedgerID($entry_data['debit_account_id']) + ? $this->currentLedgerID($entry_data['debit_account_id']) : (isset($entry_data['debit_account_name']) - ? $A->currentLedgerID($A->nameToID($entry_data['debit_account_name'])) + ? $this->currentLedgerID($this->nameToID($entry_data['debit_account_name'])) : null ) ); @@ -605,9 +602,9 @@ class Account extends AppModel { if (!isset($entry_data['credit_ledger_id'])) { $entry_data['credit_ledger_id'] = (isset($entry_data['credit_account_id']) - ? $A->currentLedgerID($entry_data['credit_account_id']) + ? $this->currentLedgerID($entry_data['credit_account_id']) : (isset($entry_data['credit_account_name']) - ? $A->currentLedgerID($A->nameToID($entry_data['credit_account_name'])) + ? $this->currentLedgerID($this->nameToID($entry_data['credit_account_name'])) : null ) ); @@ -673,8 +670,8 @@ class Account extends AppModel { $ids = $this->postLedgerEntry ($split_transaction, null, - array('debit_ledger_id' => $A->currentLedgerID($A->receiptAccountID()), - 'credit_ledger_id' => $A->currentLedgerID($A->accountReceivableAccountID()), + array('debit_ledger_id' => $this->currentLedgerID($this->receiptAccountID()), + 'credit_ledger_id' => $this->currentLedgerID($this->accountReceivableAccountID()), 'amount' => $rec['applied'], 'lease_id' => $rec['lease_id'], 'customer_id' => $rec['customer_id'],