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
This commit is contained in:
abijah
2009-07-11 08:23:55 +00:00
parent f7b81ec615
commit d683895413

View File

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