diff --git a/site/models/tender.php b/site/models/tender.php index f80b9ba..66c7144 100644 --- a/site/models/tender.php +++ b/site/models/tender.php @@ -191,10 +191,54 @@ class Tender extends AppModel { if ($result['error']) die("Unable to save Bounce transaction"); - // REVISIT : 20090730 - // Add NSF Charge +/* [data] => Array */ +/* ( */ +/* [Transaction] => Array */ +/* ( */ +/* [stamp] => 07/30/2009 17:17 */ +/* [comment] => */ +/* [type] => INVOICE */ +/* [crdr] => DEBIT */ +/* [account_id] => 3 */ +/* [customer_id] => */ +/* [lease_id] => 43 */ +/* ) */ -/* $nsf_fee_account_id = $A->nsfChargeAccountID(); */ +/* [Entry] => Array */ +/* ( */ +/* [1] => Array */ +/* ( */ +/* [account_id] => 17 */ +/* [effective_date] => 07/30/2009 */ +/* [through_date] => */ +/* [amount] => 35 */ +/* [comment] => */ +/* [type] => CHARGE */ +/* [crdr] => CREDIT */ +/* ) */ +/* ) */ +/* ) */ + + // Add NSF Charge + $result = $this->NsfTransaction->addInvoice + (array('Transaction' => + array('stamp' => $nsf_deposit['stamp'], + ), + + 'Entry' => + array + (array('account_id' => $this->LedgerEntry->Account->nsfChargeAccountID(), + 'effective_date' => $nsf_deposit['stamp'], + // REVISIT : 20090730 + // BAD, BAD, BAD... who would actually + // hardcode a value like this???? ;-) + 'amount' => 35, + 'comment' => "NSF: " . $tender['Tender']['name'], + ), + ), + ), + $tender['Tender']['customer_id']); + $this->pr(20, compact('result')); return $this->prReturn(true); } diff --git a/site/models/transaction.php b/site/models/transaction.php index 87dfc01..b06d146 100644 --- a/site/models/transaction.php +++ b/site/models/transaction.php @@ -37,6 +37,8 @@ class Transaction extends AppModel { ); + //var $default_log_level = 30; + /************************************************************************** ************************************************************************** ************************************************************************** @@ -45,6 +47,8 @@ class Transaction extends AppModel { */ function addInvoice($data, $customer_id, $lease_id = null) { + $this->prEnter(compact('data', 'customer_id', 'lease_id')); + // Establish the transaction as an invoice $invoice =& $data['Transaction']; $invoice['type'] = 'INVOICE'; @@ -75,6 +79,8 @@ class Transaction extends AppModel { */ function addReceipt($data, $customer_id, $lease_id = null) { + $this->prEnter(compact('data', 'customer_id', 'lease_id')); + // Establish the transaction as a receipt $receipt =& $data['Transaction']; $receipt['type'] = 'RECEIPT'; @@ -108,6 +114,8 @@ class Transaction extends AppModel { */ function addDeposit($data, $account_id) { + $this->prEnter(compact('data', 'account_id')); + // Establish the transaction as a deposit $deposit =& $data['Transaction']; $deposit['type'] = 'DEPOSIT'; @@ -156,6 +164,8 @@ class Transaction extends AppModel { */ function addClose($data) { + $this->prEnter(compact('data')); + // Establish the transaction as a close $close =& $data['Transaction']; $close['type'] = 'CLOSE'; @@ -220,9 +230,7 @@ class Transaction extends AppModel { && (empty($transaction['account_id']) || empty($transaction['crdr']))) || (in_array($transaction['type'], array('INVOICE', 'RECEIPT')) - && empty($transaction['customer_id'])) || - (in_array($transaction['type'], array('INVOICE')) - && empty($transaction['lease_id'])) + && empty($transaction['customer_id'])) ) { return $this->prReturn(false); }