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'])