From d68389541396a7e050dbe5c163e7e2467cd18155 Mon Sep 17 00:00:00 2001 From: abijah Date: Sat, 11 Jul 2009 08:23:55 +0000 Subject: [PATCH] Eliminated the need for the Invoice Account. I'm having a bit of a hard time believing that it works, since it sure seems like we needed the Invoice account for some reason. However, it's entirely possible that we really just had it for symmetry with Receipt (another account which we'd love to delete). It needs more testing, but it works good enough to check in. git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@308 97e9348a-65ac-dc4b-aefc-98561f571b83 --- models/transaction.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/models/transaction.php b/models/transaction.php index 27f739a..6870b11 100644 --- a/models/transaction.php +++ b/models/transaction.php @@ -36,16 +36,6 @@ class Transaction extends AppModel { foreach ($data['LedgerEntry'] AS $entry) $grand_total += $entry['amount']; - $ids = $this->LedgerEntry->Ledger->Account->postLedgerEntry - (array_intersect_key($data, array('Transaction'=>1, 'transaction_id'=>1)), - null, - array('debit_ledger_id' => $A->currentLedgerID($A->accountReceivableAccountID()), - 'credit_ledger_id' => $A->currentLedgerID($A->invoiceAccountID()), - 'customer_id' => $customer_id, - 'lease_id' => $lease_id, - 'amount' => $grand_total)); - $ar_entry_id = $ids['id']; - // Go through the entered charges $invoice_transaction = array_intersect_key($data, array('Transaction'=>1, 'transaction_id'=>1)); foreach ($data['LedgerEntry'] AS $entry) { @@ -56,13 +46,11 @@ class Transaction extends AppModel { ($invoice_transaction, array_intersect_key($entry, array('MonetarySource'=>1)) + array_intersect_key($entry, array('account_id'=>1)), - array('debit_ledger_id' => $A->currentLedgerID($A->invoiceAccountID()), + array('debit_ledger_id' => $A->currentLedgerID($A->accountReceivableAccountID()), 'credit_ledger_id' => $A->currentLedgerID($entry['account_id']), 'customer_id' => $customer_id, 'lease_id' => $lease_id) - + $entry, - array('debit' => array(array('LedgerEntry' => array('id' => $ar_entry_id, - 'amount' => $entry['amount'])))) + + $entry ); if ($ids['error'])