Initial thoughts on the charge reversal. It's obviously not working yet, or I wouldn't leave it hanging on a branch.
git-svn-id: file:///svn-source/pmgr/branches/alt_reversal_20090806@502 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -37,7 +37,7 @@ class Transaction extends AppModel {
|
||||
);
|
||||
|
||||
|
||||
//var $default_log_level = array('log' => 30, 'show' => 15);
|
||||
var $default_log_level = array('log' => 30, 'show' => 30);
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -149,17 +149,12 @@ class Transaction extends AppModel {
|
||||
function addReversal($data, $charge_id, $customer_id, $lease_id = null) {
|
||||
$this->prEnter(compact('data', 'charge_id', 'customer_id', 'lease_id'));
|
||||
|
||||
if (count($data['Entry']) != 1)
|
||||
INTERNAL_ERROR("Should be one Entry for addReversal");
|
||||
$data['Transaction'] += array('type' => 'CREDIT_NOTE');
|
||||
foreach ($data['Entry'] AS &$entry)
|
||||
$entry += array('type' => 'REVERSAL');
|
||||
|
||||
// Just make sure the disbursement(s) are marked as reversals
|
||||
// and that they go to cover the specific charge.
|
||||
$data['Transaction']['type'] = 'CREDIT_NOTE';
|
||||
$data['Transaction']['disbursement_type'] = 'REVERSAL';
|
||||
$data['Transaction']['assign_charge_entry_id'] = $charge_id;
|
||||
|
||||
// In all other respects this is just a receipt.
|
||||
$ids = $this->addReceipt($data, $customer_id, $lease_id);
|
||||
// In all other respects this is just an invoice
|
||||
$ids = $this->addInvoice($data, $customer_id, $lease_id);
|
||||
if (isset($ids['transaction_id']))
|
||||
$ids['reversal_id'] = $ids['transaction_id'];
|
||||
|
||||
@@ -529,16 +524,17 @@ class Transaction extends AppModel {
|
||||
|
||||
// (DISBURSEMENTS will have statement entries created below, when
|
||||
// assigning credits, and DEPOSITS don't have statement entries)
|
||||
if (empty($transaction['customer_id']) ||
|
||||
($transaction['account_id'] == $this->Account->accountReceivableAccountID() &&
|
||||
$transaction['crdr'] == 'CREDIT'))
|
||||
if (empty($entry['charge_entry_id']) &&
|
||||
(empty($transaction['customer_id']) ||
|
||||
($transaction['account_id'] == $this->Account->accountReceivableAccountID() &&
|
||||
$transaction['crdr'] == 'CREDIT')))
|
||||
$se = null;
|
||||
|
||||
// NSF transactions don't use LedgerEntries
|
||||
// REVISIT <AP>: 20090731
|
||||
// Doesn't seem right... probably doing this because of the
|
||||
// single A/R entry we add below for NSF
|
||||
if ($subtype === 'NSF')
|
||||
if ($entry['type'] == 'SURPLUS' || $subtype === 'NSF')
|
||||
$le1 = $le1_tender = $le2 = null;
|
||||
|
||||
// Replace combined entry with our new individual entries
|
||||
|
||||
Reference in New Issue
Block a user