Added a way to associate the meaningful part of NSF with the corresponding tender.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@456 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-31 18:10:48 +00:00
parent e40778ddbd
commit 8f79f0401f
3 changed files with 7 additions and 30 deletions

View File

@@ -194,24 +194,16 @@ class Tender extends AppModel {
// charges, void any credits, and other similar work.
$this->pr(20, compact('bounce'));
$bounce_result = $this->NsfTransaction->addNsf($bounce);
$this->pr(20, compact('bounce_result'));
if ($bounce_result['error'])
die("Unable to save Bounce transaction");
// Flag the tender as NSF, using the transaction created above.
// REVISIT <AP>: 20090730
// For symmetry, it seems like we should be using the nsf_result.
// Thus the tender's deposit_transaction_id would record how the
// money got into the bank account, and the nsf_transaction_id
// would record how the money was taken back out. However, that
// transaction is just not very useful. So, either we ignore
// the fact that the nsf_result is not useful to the user, we
// use the bounce_result instead, or we modify the tender view
// page to reference the bounce_result, and still use nsf_result
// for our nsf_transaction_id.
// Flag the tender as NSF, using the items created above.
$this->id = $id;
$this->saveField('nsf_transaction_id', $nsf_result['transaction_id']);
$this->saveField('nsf_ledger_entry_id', $bounce_result['entries'][0]['DoubleEntry']['Entry1']['ledger_entry_id']);
// Add NSF Charge

View File

@@ -586,20 +586,9 @@ class Transaction extends AppModel {
}
}
/* if (($transaction['type'] == 'INVOICE' || */
/* $transaction['type'] == 'RECEIPT') && */
/* !$ret['error']) { */
/* $result = $this->StatementEntry->assignCredits */
/* (array('link' => array('Customer'), */
/* 'conditions' => array('Customer.id' => $transaction['customer_id'])), */
/* ($transaction['type'] == 'RECEIPT' */
/* ? $ret['transaction_id'] */
/* : null)); */
/* $ret['assigned'] = $result; */
/* if ($result['error']) */
/* $ret['error'] = true; */
/* } */
// assigning credits could happen now, but the caller
// will be adding an NSF fee, and credit assignment will
// just happen again anyway. Return without assignment.
return $this->prReturn($ret);
}

View File

@@ -88,11 +88,7 @@ echo $this->element('ledger_entries', array
(// Grid configuration
'config' => array
('caption' => "Ledger Entries",
'filter' => array('Tender.id' => $tender['id']),
/* 'filter' => array("IF(Tender.id = {$tender['id']}". */
/* " OR (Transaction.id = {$tender['nsf_transaction_id']}" . */
/* " AND LedgerEntry.crdr = 'CREDIT')," . */
/* " 1, 0)"), */
'filter' => array('id' => array($tender['ledger_entry_id'], $tender['nsf_ledger_entry_id'])),
'exclude' => array('Tender'),
)));