Added a new statement entry type, 'WAIVE', and added the beginnings of a function to add a new waiver transaction. Haven't even started the work yet though...

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@466 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-02 22:44:55 +00:00
parent 35d7656bc5
commit cb716b06b7
2 changed files with 42 additions and 1 deletions

View File

@@ -955,6 +955,7 @@ CREATE TABLE `pmgr_transactions` (
'CLOSE',
-- 'CREDIT',
-- 'REFUND',
-- 'WAIVER',
'TRANSFER')
NOT NULL,
@@ -1066,6 +1067,7 @@ CREATE TABLE `pmgr_statement_entries` (
-- REVISIT <AP>: 20090730
-- VOID is just to test out a theory
-- for handling NSF and charge reversals
'WAIVE',
'VOID')
NOT NULL,

View File

@@ -106,6 +106,46 @@ class Transaction extends AppModel {
}
/**************************************************************************
**************************************************************************
**************************************************************************
* function: addWaiver
* - Adds a new waiver
*/
function addWaiver($data, $customer_id, $lease_id = null) {
$this->prEnter(compact('data', 'customer_id', 'lease_id'));
// REVISIT <AP>: 20090802
// Completely un-implemented. Just copied from addReceipt
// and search-replace receipt with waiver.
return ('error' => true);
// Establish the transaction as a waiver
$waiver =& $data['Transaction'];
$waiver['type'] = 'RECEIPT';
$waiver['crdr'] = 'CREDIT';
$waiver['account_id'] = $this->Account->accountReceivableAccountID();
$waiver['customer_id'] = $customer_id;
$waiver['lease_id'] = $lease_id;
// Go through the statement entries and flag as payments
foreach ($data['Entry'] AS &$entry) {
$entry['type'] = 'WAIVE';
$entry['crdr'] = 'DEBIT';
if (empty($entry['account_id']) && isset($entry['Tender']['tender_type_id'])) {
$entry['account_id'] = $this->LedgerEntry->Tender->TenderType->
accountID($entry['Tender']['tender_type_id']);
}
}
$ids = $this->addTransaction($data['Transaction'], $data['Entry']);
if (isset($ids['transaction_id']))
$ids['waiver_id'] = $ids['transaction_id'];
return $ids;
}
/**************************************************************************
**************************************************************************
**************************************************************************
@@ -428,7 +468,6 @@ class Transaction extends AppModel {
$this->pr(20, compact('transaction', 'entries'));
// Move forward, verifying and saving everything.
// REVISIT <AP>: 20090731 NSF was not verifying... let's find out why
$ret = array();
if (!$this->verifyTransaction($transaction, $entries))
return $this->prReturn(array('error' => true) + $ret);