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/site@466 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-02 22:44:55 +00:00
parent a9ef3a75ae
commit 6b357fc285

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);