Added confirmation to the NSF functionality, as well as a timestamp field instead of forcing time=now.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@513 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-10 05:49:43 +00:00
parent 76df8c924f
commit 1f97e8db35
4 changed files with 111 additions and 39 deletions

View File

@@ -673,8 +673,8 @@ class Transaction extends AppModel {
* - Adds NSF transaction
*/
function addNsf($tender, $stamp) {
$this->prEnter(compact('tender', 'stamp'));
function addNsf($tender, $stamp = null, $comment = null) {
$this->prEnter(compact('tender', 'stamp', 'comment'));
$ret = array();
@@ -683,7 +683,8 @@ class Transaction extends AppModel {
// and recording it in the NSF account. It has nothing to do
// with the customer statement (charges, disbursements, credits, etc).
$bounce_result = $this->addDeposit
(array('Transaction' => array('crdr' => 'CREDIT'),
(array('Transaction' => array('stamp' => $stamp,
'crdr' => 'CREDIT'),
'Entry' => array(array('tender_id' => null,
'account_id' => $this->Account->nsfAccountID(),
'crdr' => 'DEBIT',
@@ -731,6 +732,7 @@ class Transaction extends AppModel {
$rollback['Transaction']['crdr'] = 'CREDIT'; // Unused... keeps verifyTx happy
$rollback['Transaction']['account_id'] = $this->Account->nsfAccountID();
$rollback['Transaction']['customer_id'] = $tender['Tender']['customer_id'];
$rollback['Transaction']['comment'] = $comment;
foreach ($nsf_ledger_entry['Transaction']['StatementEntry'] AS $disbursement) {
if ($disbursement['type'] === 'SURPLUS') {
@@ -746,7 +748,6 @@ class Transaction extends AppModel {
'customer_id' => $disbursement['customer_id'],
'lease_id' => $disbursement['lease_id'],
'charge_entry_id' => $disbursement['charge_entry_id'],
'effective_date' => $stamp,
);
}
}