Added a way to associate the meaningful part of NSF with the corresponding tender.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@456 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -1187,9 +1187,11 @@ CREATE TABLE `pmgr_tenders` (
|
||||
|
||||
-- The ledger entry this legal tender applies to
|
||||
`ledger_entry_id` INT(10) UNSIGNED NOT NULL,
|
||||
-- The ledger entry if this tender is marked NSF
|
||||
`nsf_ledger_entry_id` INT(10) UNSIGNED DEFAULT NULL,
|
||||
-- The deposit transaction that included these monies
|
||||
`deposit_transaction_id` INT(10) UNSIGNED DEFAULT NULL,
|
||||
-- The NSF transaction, should this come back from the bank.
|
||||
-- The NSF transaction coming back from the bank.
|
||||
`nsf_transaction_id` INT(10) UNSIGNED DEFAULT NULL,
|
||||
|
||||
`comment` VARCHAR(255) DEFAULT NULL,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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'),
|
||||
)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user