Changed the list of payment types to be dynamically generated. This works OK, but the list is longer than is probably useful, and more importantly, some of these types need to be associated with a lease, such as a security deposit. Not sure how I'll handle that.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@289 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-09 09:20:04 +00:00
parent 7a31f5cbd2
commit 6e1eba03a0
3 changed files with 53 additions and 44 deletions

View File

@@ -166,7 +166,7 @@ class Transaction extends AppModel {
foreach ($data['LedgerEntry'] AS $entry) {
// Get the Monetary Source squared away
if ($entry['account_name'] === 'Cash') {
if ($entry['account_id'] == $A->cashAccountID()) {
// No distinguishing features of Cash, just
// use the shared monetary source
$entry['monetary_source_id'] =
@@ -174,17 +174,14 @@ class Transaction extends AppModel {
unset($entry['MonetarySource']);
}
else {
// The monetary source needs to be unique
// Create a new one dedicated to this entry
$entry['MonetarySource']['name'] = $A->name($entry['account_id']);
// Give it a fancy name based on the check number
if ($entry['account_name'] === 'Check' ||
$entry['account_name'] === 'Money Order') {
if ($A->name($entry['account_id']) === 'Check' ||
$A->name($entry['account_id']) === 'Money Order') {
$entry['MonetarySource']['name'] .=
' #' . $entry['MonetarySource']['data1'];
}
else {
$entry['MonetarySource']['name'] = $entry['account_name'];
}
}
// This entry of physical money is part of the receipt transaction
@@ -193,7 +190,7 @@ class Transaction extends AppModel {
// Receipt must debit the "money" asset (bank, cash, check, etc)...
$entry['debit_ledger_id']
= $A->currentLedgerID($A->nameToID($entry['account_name']));
= $A->currentLedgerID($entry['account_id']);
// ...and credit the Receipt ledger
$entry['credit_ledger_id']