Added an automatic $35 nsf charge when marking an item as nsf. This required removing the lease_id requirement when adding a transaction, since the charge is not associated with a lease, just a customer. The requirement was artificial anyway; imagine selling POS items to folks that don't even lease from us...

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@447 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-31 03:07:34 +00:00
parent 65b7137f21
commit 57d593fc38
2 changed files with 58 additions and 6 deletions

View File

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