Suppressed all the debug print statements from transaction insertion.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@398 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -373,20 +373,20 @@ class Customer extends AppModel {
|
|||||||
'conditions' => array('StatementEntry.customer_id' => $id),
|
'conditions' => array('StatementEntry.customer_id' => $id),
|
||||||
));
|
));
|
||||||
$find_stats = $find_stats[0];
|
$find_stats = $find_stats[0];
|
||||||
pr(compact('find_stats'));
|
/* pr(compact('find_stats')); */
|
||||||
|
|
||||||
$tquery = $query;
|
$tquery = $query;
|
||||||
$tquery['conditions'][] = array('StatementEntry.customer_id' => $id);
|
$tquery['conditions'][] = array('StatementEntry.customer_id' => $id);
|
||||||
$statement_stats = $this->StatementEntry->stats(null, $tquery);
|
$statement_stats = $this->StatementEntry->stats(null, $tquery);
|
||||||
$statement_stats['balance'] = $statement_stats['Charge']['balance'];
|
$statement_stats['balance'] = $statement_stats['Charge']['balance'];
|
||||||
pr(compact('statement_stats'));
|
/* pr(compact('statement_stats')); */
|
||||||
|
|
||||||
$tquery = $query;
|
$tquery = $query;
|
||||||
//$tquery['conditions'][] = array('StatementEntry.customer_id' => $id);
|
//$tquery['conditions'][] = array('StatementEntry.customer_id' => $id);
|
||||||
$tquery['conditions'][] = array('Transaction.customer_id' => $id);
|
$tquery['conditions'][] = array('Transaction.customer_id' => $id);
|
||||||
$transaction_stats = $this->Transaction->stats(null, $tquery);
|
$transaction_stats = $this->Transaction->stats(null, $tquery);
|
||||||
$transaction_stats += $transaction_stats['StatementEntry'];
|
$transaction_stats += $transaction_stats['StatementEntry'];
|
||||||
pr(compact('transaction_stats'));
|
/* pr(compact('transaction_stats')); */
|
||||||
|
|
||||||
$tquery = $query;
|
$tquery = $query;
|
||||||
//$tquery['conditions'][] = array('StatementEntry.customer_id' => $id);
|
//$tquery['conditions'][] = array('StatementEntry.customer_id' => $id);
|
||||||
@@ -394,7 +394,7 @@ class Customer extends AppModel {
|
|||||||
$ar_transaction_stats = $this->Transaction->stats(null, $tquery,
|
$ar_transaction_stats = $this->Transaction->stats(null, $tquery,
|
||||||
$this->Transaction->Account->accountReceivableAccountID());
|
$this->Transaction->Account->accountReceivableAccountID());
|
||||||
$ar_transaction_stats += $ar_transaction_stats['LedgerEntry'];
|
$ar_transaction_stats += $ar_transaction_stats['LedgerEntry'];
|
||||||
pr(compact('ar_transaction_stats'));
|
/* pr(compact('ar_transaction_stats')); */
|
||||||
|
|
||||||
//$stats = $ar_transaction_stats;
|
//$stats = $ar_transaction_stats;
|
||||||
$stats = $find_stats;
|
$stats = $find_stats;
|
||||||
|
|||||||
@@ -19,25 +19,25 @@ class DoubleEntry extends AppModel {
|
|||||||
* (not in a pre-existing double entry)
|
* (not in a pre-existing double entry)
|
||||||
*/
|
*/
|
||||||
function verifyDoubleEntry($entry1, $entry2, $entry1_tender = null) {
|
function verifyDoubleEntry($entry1, $entry2, $entry1_tender = null) {
|
||||||
pr(array("DoubleEntry::verifyDoubleEntry()"
|
/* pr(array("DoubleEntry::verifyDoubleEntry()" */
|
||||||
=> compact('entry1', 'entry2', 'entry1_tender')));
|
/* => compact('entry1', 'entry2', 'entry1_tender'))); */
|
||||||
|
|
||||||
$LE = new LedgerEntry();
|
$LE = new LedgerEntry();
|
||||||
if (!$LE->verifyLedgerEntry($entry1, $entry1_tender)) {
|
if (!$LE->verifyLedgerEntry($entry1, $entry1_tender)) {
|
||||||
pr(array("DoubleEntry::verifyDoubleEntry()"
|
/* pr(array("DoubleEntry::verifyDoubleEntry()" */
|
||||||
=> "Entry1 verification failed"));
|
/* => "Entry1 verification failed")); */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!$LE->verifyLedgerEntry($entry2)) {
|
if (!$LE->verifyLedgerEntry($entry2)) {
|
||||||
pr(array("DoubleEntry::verifyDoubleEntry()"
|
/* pr(array("DoubleEntry::verifyDoubleEntry()" */
|
||||||
=> "Entry2 verification failed"));
|
/* => "Entry2 verification failed")); */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(($entry1['crdr'] === 'DEBIT' && $entry2['crdr'] === 'CREDIT') ||
|
if (!(($entry1['crdr'] === 'DEBIT' && $entry2['crdr'] === 'CREDIT') ||
|
||||||
($entry1['crdr'] === 'CREDIT' && $entry2['crdr'] === 'DEBIT'))) {
|
($entry1['crdr'] === 'CREDIT' && $entry2['crdr'] === 'DEBIT'))) {
|
||||||
pr(array("DoubleEntry::verifyDoubleEntry()"
|
/* pr(array("DoubleEntry::verifyDoubleEntry()" */
|
||||||
=> "Double Entry verification failed"));
|
/* => "Double Entry verification failed")); */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,8 +52,8 @@ class DoubleEntry extends AppModel {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function addDoubleEntry($entry1, $entry2, $entry1_tender = null) {
|
function addDoubleEntry($entry1, $entry2, $entry1_tender = null) {
|
||||||
pr(array('DoubleEntry::addDoubleEntry' =>
|
/* pr(array('DoubleEntry::addDoubleEntry' => */
|
||||||
compact('entry1', 'entry2', 'entry1_tender')));
|
/* compact('entry1', 'entry2', 'entry1_tender'))); */
|
||||||
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
if (!$this->verifyDoubleEntry($entry1, $entry2, $entry1_tender))
|
if (!$this->verifyDoubleEntry($entry1, $entry2, $entry1_tender))
|
||||||
@@ -81,9 +81,9 @@ class DoubleEntry extends AppModel {
|
|||||||
$double_entry['credit_entry_id'] =
|
$double_entry['credit_entry_id'] =
|
||||||
($entry1['crdr'] === 'CREDIT') ? $ret['Entry1']['ledger_entry_id'] : $ret['Entry2']['ledger_entry_id'];
|
($entry1['crdr'] === 'CREDIT') ? $ret['Entry1']['ledger_entry_id'] : $ret['Entry2']['ledger_entry_id'];
|
||||||
|
|
||||||
pr(array('DoubleEntry::addDoubleEntry' =>
|
/* pr(array('DoubleEntry::addDoubleEntry' => */
|
||||||
array('checkpoint' => 'Pre-Save')
|
/* array('checkpoint' => 'Pre-Save') */
|
||||||
+ compact('double_entry')));
|
/* + compact('double_entry'))); */
|
||||||
|
|
||||||
$this->create();
|
$this->create();
|
||||||
if (!$this->save($double_entry))
|
if (!$this->save($double_entry))
|
||||||
|
|||||||
@@ -84,21 +84,21 @@ class LedgerEntry extends AppModel {
|
|||||||
* (not in a pre-existing ledger entry)
|
* (not in a pre-existing ledger entry)
|
||||||
*/
|
*/
|
||||||
function verifyLedgerEntry($entry, $tender = null) {
|
function verifyLedgerEntry($entry, $tender = null) {
|
||||||
pr(array("LedgerEntry::verifyLedgerEntry()"
|
/* pr(array("LedgerEntry::verifyLedgerEntry()" */
|
||||||
=> compact('entry', 'tender')));
|
/* => compact('entry', 'tender'))); */
|
||||||
|
|
||||||
if (empty($entry['account_id']) ||
|
if (empty($entry['account_id']) ||
|
||||||
empty($entry['crdr']) ||
|
empty($entry['crdr']) ||
|
||||||
empty($entry['amount'])
|
empty($entry['amount'])
|
||||||
) {
|
) {
|
||||||
pr(array("LedgerEntry::verifyLedgerEntry()"
|
/* pr(array("LedgerEntry::verifyLedgerEntry()" */
|
||||||
=> "Entry verification failed"));
|
/* => "Entry verification failed")); */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($tender) && !$this->Tender->verifyTender($tender)) {
|
if (isset($tender) && !$this->Tender->verifyTender($tender)) {
|
||||||
pr(array("LedgerEntry::verifyLedgerEntry()"
|
/* pr(array("LedgerEntry::verifyLedgerEntry()" */
|
||||||
=> "Tender verification failed"));
|
/* => "Tender verification failed")); */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,8 +113,8 @@ class LedgerEntry extends AppModel {
|
|||||||
* - Inserts new Ledger Entry into the database
|
* - Inserts new Ledger Entry into the database
|
||||||
*/
|
*/
|
||||||
function addLedgerEntry($entry, $tender = null) {
|
function addLedgerEntry($entry, $tender = null) {
|
||||||
pr(array('LedgerEntry::addLedgerEntry' =>
|
/* pr(array('LedgerEntry::addLedgerEntry' => */
|
||||||
compact('entry', 'tender')));
|
/* compact('entry', 'tender'))); */
|
||||||
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
if (!$this->verifyLedgerEntry($entry, $tender))
|
if (!$this->verifyLedgerEntry($entry, $tender))
|
||||||
@@ -124,9 +124,9 @@ class LedgerEntry extends AppModel {
|
|||||||
$entry['ledger_id'] =
|
$entry['ledger_id'] =
|
||||||
$this->Account->currentLedgerID($entry['account_id']);
|
$this->Account->currentLedgerID($entry['account_id']);
|
||||||
|
|
||||||
pr(array('LedgerEntry::addLedgerEntry' =>
|
/* pr(array('LedgerEntry::addLedgerEntry' => */
|
||||||
array('checkpoint' => 'Pre-Save')
|
/* array('checkpoint' => 'Pre-Save') */
|
||||||
+ compact('entry')));
|
/* + compact('entry'))); */
|
||||||
|
|
||||||
$this->create();
|
$this->create();
|
||||||
if (!$this->save($entry))
|
if (!$this->save($entry))
|
||||||
|
|||||||
@@ -64,16 +64,16 @@ class StatementEntry extends AppModel {
|
|||||||
* (not in a pre-existing statement entry)
|
* (not in a pre-existing statement entry)
|
||||||
*/
|
*/
|
||||||
function verifyStatementEntry($entry) {
|
function verifyStatementEntry($entry) {
|
||||||
pr(array("StatementEntry::verifyStatementEntry()"
|
/* pr(array("StatementEntry::verifyStatementEntry()" */
|
||||||
=> compact('entry')));
|
/* => compact('entry'))); */
|
||||||
|
|
||||||
if (empty($entry['type']) ||
|
if (empty($entry['type']) ||
|
||||||
//empty($entry['effective_date']) ||
|
//empty($entry['effective_date']) ||
|
||||||
empty($entry['account_id']) ||
|
empty($entry['account_id']) ||
|
||||||
empty($entry['amount'])
|
empty($entry['amount'])
|
||||||
) {
|
) {
|
||||||
pr(array("StatementEntry::verifyStatementEntry()"
|
/* pr(array("StatementEntry::verifyStatementEntry()" */
|
||||||
=> "Entry verification failed"));
|
/* => "Entry verification failed")); */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,16 +88,16 @@ class StatementEntry extends AppModel {
|
|||||||
* - Inserts new Statement Entry into the database
|
* - Inserts new Statement Entry into the database
|
||||||
*/
|
*/
|
||||||
function addStatementEntry($entry) {
|
function addStatementEntry($entry) {
|
||||||
pr(array('StatementEntry::addStatementEntry' =>
|
/* pr(array('StatementEntry::addStatementEntry' => */
|
||||||
compact('entry')));
|
/* compact('entry'))); */
|
||||||
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
if (!$this->verifyStatementEntry($entry))
|
if (!$this->verifyStatementEntry($entry))
|
||||||
return array('error' => true, 'verify_data' => $entry) + $ret;
|
return array('error' => true, 'verify_data' => $entry) + $ret;
|
||||||
|
|
||||||
pr(array('StatementEntry::addStatementEntry' =>
|
/* pr(array('StatementEntry::addStatementEntry' => */
|
||||||
array('checkpoint' => 'Pre-Save')
|
/* array('checkpoint' => 'Pre-Save') */
|
||||||
+ compact('entry')));
|
/* + compact('entry'))); */
|
||||||
|
|
||||||
$this->create();
|
$this->create();
|
||||||
if (!$this->save($entry))
|
if (!$this->save($entry))
|
||||||
@@ -406,7 +406,7 @@ OPTION 2
|
|||||||
* - Assigns all credits to existing charges
|
* - Assigns all credits to existing charges
|
||||||
*/
|
*/
|
||||||
function assignCredits($query = null, $receipt_id = null) {
|
function assignCredits($query = null, $receipt_id = null) {
|
||||||
pr(array('StatementEntry::assignCredits' => compact('query', 'receipt_id')));
|
/* pr(array('StatementEntry::assignCredits' => compact('query', 'receipt_id'))); */
|
||||||
$this->queryInit($query);
|
$this->queryInit($query);
|
||||||
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
@@ -416,7 +416,7 @@ OPTION 2
|
|||||||
$lquery['conditions'][] = array('StatementEntry.type' => 'CREDIT');
|
$lquery['conditions'][] = array('StatementEntry.type' => 'CREDIT');
|
||||||
$lquery['order'][] = 'StatementEntry.effective_date ASC';
|
$lquery['order'][] = 'StatementEntry.effective_date ASC';
|
||||||
$credits = $this->find('all', $lquery);
|
$credits = $this->find('all', $lquery);
|
||||||
pr(compact('lquery', 'credits'));
|
/* pr(compact('lquery', 'credits')); */
|
||||||
|
|
||||||
// Then, find all receipts that have not had all
|
// Then, find all receipts that have not had all
|
||||||
// monies dispursed for either payments or credits
|
// monies dispursed for either payments or credits
|
||||||
@@ -439,7 +439,7 @@ OPTION 2
|
|||||||
$ac['Transaction'] += $ac[0];
|
$ac['Transaction'] += $ac[0];
|
||||||
unset($ac[0]);
|
unset($ac[0]);
|
||||||
}
|
}
|
||||||
pr(compact('lquery', 'anon_credits'));
|
/* pr(compact('lquery', 'anon_credits')); */
|
||||||
|
|
||||||
// Next, add in the credits from the newly added receipt
|
// Next, add in the credits from the newly added receipt
|
||||||
if (!empty($receipt_id)) {
|
if (!empty($receipt_id)) {
|
||||||
@@ -452,7 +452,7 @@ OPTION 2
|
|||||||
if ($receipt_credit)
|
if ($receipt_credit)
|
||||||
$anon_credits[] = $receipt_credit;
|
$anon_credits[] = $receipt_credit;
|
||||||
|
|
||||||
pr(compact('lquery', 'anon_credits'));
|
/* pr(compact('lquery', 'anon_credits')); */
|
||||||
}
|
}
|
||||||
|
|
||||||
// REVISIT <AP>: 20090726
|
// REVISIT <AP>: 20090726
|
||||||
@@ -463,7 +463,7 @@ OPTION 2
|
|||||||
$lquery = $query;
|
$lquery = $query;
|
||||||
$lquery['order'] = 'StatementEntry.effective_date ASC';
|
$lquery['order'] = 'StatementEntry.effective_date ASC';
|
||||||
$charges = $this->reconciledSet('CHARGE', $query, true);
|
$charges = $this->reconciledSet('CHARGE', $query, true);
|
||||||
pr(compact('lquery', 'charges'));
|
/* pr(compact('lquery', 'charges')); */
|
||||||
|
|
||||||
// Initialize our list of used credits
|
// Initialize our list of used credits
|
||||||
$used_credits = array();
|
$used_credits = array();
|
||||||
@@ -472,9 +472,9 @@ OPTION 2
|
|||||||
// Work through all unpaid charges, applying payments as we go
|
// Work through all unpaid charges, applying payments as we go
|
||||||
foreach ($charges['entries'] AS $charge) {
|
foreach ($charges['entries'] AS $charge) {
|
||||||
|
|
||||||
pr(array('StatementEntry::assignCredits' =>
|
/* pr(array('StatementEntry::assignCredits' => */
|
||||||
array('checkpoint' => 'Process Charge')
|
/* array('checkpoint' => 'Process Charge') */
|
||||||
+ compact('charge')));
|
/* + compact('charge'))); */
|
||||||
|
|
||||||
// Check that we have available credits.
|
// Check that we have available credits.
|
||||||
// Technically, this isn't necessary, since the loop
|
// Technically, this isn't necessary, since the loop
|
||||||
@@ -482,8 +482,8 @@ OPTION 2
|
|||||||
// just saves extra processing if/when there is no
|
// just saves extra processing if/when there is no
|
||||||
// means to resolve a charge anyway.
|
// means to resolve a charge anyway.
|
||||||
if (count($credits) == 0 && count($anon_credits) == 0) {
|
if (count($credits) == 0 && count($anon_credits) == 0) {
|
||||||
pr(array('StatementEntry::assignCredits' =>
|
/* pr(array('StatementEntry::assignCredits' => */
|
||||||
array('checkpoint' => 'No available credits')));
|
/* array('checkpoint' => 'No available credits'))); */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,9 +491,9 @@ OPTION 2
|
|||||||
while ($charge['balance'] > 0 &&
|
while ($charge['balance'] > 0 &&
|
||||||
(count($credits) || count($anon_credits))) {
|
(count($credits) || count($anon_credits))) {
|
||||||
|
|
||||||
pr(array('StatementEntry::assignCredits' =>
|
/* pr(array('StatementEntry::assignCredits' => */
|
||||||
array('checkpoint' => 'Attempt Charge Reconciliation')
|
/* array('checkpoint' => 'Attempt Charge Reconciliation') */
|
||||||
+ compact('charge')));
|
/* + compact('charge'))); */
|
||||||
|
|
||||||
// Use explicit credits before using implicit credits
|
// Use explicit credits before using implicit credits
|
||||||
// (Not sure it matters though).
|
// (Not sure it matters though).
|
||||||
@@ -529,11 +529,11 @@ OPTION 2
|
|||||||
$credit['applied'] += $payment_amount;
|
$credit['applied'] += $payment_amount;
|
||||||
$credit['balance'] -= $payment_amount;
|
$credit['balance'] -= $payment_amount;
|
||||||
|
|
||||||
pr(array('StatementEntry::assignCredits' =>
|
/* pr(array('StatementEntry::assignCredits' => */
|
||||||
array('checkpoint' => (($credit['balance'] > 0 ? 'Utilized' : 'Exhausted')
|
/* array('checkpoint' => (($credit['balance'] > 0 ? 'Utilized' : 'Exhausted') */
|
||||||
. (count($credits) ? '' : ' Anon')
|
/* . (count($credits) ? '' : ' Anon') */
|
||||||
. ' Credit'))
|
/* . ' Credit')) */
|
||||||
+ compact('credit')));
|
/* + compact('credit'))); */
|
||||||
|
|
||||||
if ($credit['balance'] < 0)
|
if ($credit['balance'] < 0)
|
||||||
die("HOW DID WE END UP WITH NEGATIVE CREDIT BALANCE?");
|
die("HOW DID WE END UP WITH NEGATIVE CREDIT BALANCE?");
|
||||||
@@ -559,9 +559,9 @@ OPTION 2
|
|||||||
'comment' => null,
|
'comment' => null,
|
||||||
);
|
);
|
||||||
|
|
||||||
pr(array('StatementEntry::assignCredits' =>
|
/* pr(array('StatementEntry::assignCredits' => */
|
||||||
array('checkpoint' => 'New Payment Entry')
|
/* array('checkpoint' => 'New Payment Entry') */
|
||||||
+ compact('payment')));
|
/* + compact('payment'))); */
|
||||||
|
|
||||||
$result = $this->addStatementEntry($payment);
|
$result = $this->addStatementEntry($payment);
|
||||||
$ret['Payment'][] = $result;
|
$ret['Payment'][] = $result;
|
||||||
@@ -573,9 +573,9 @@ OPTION 2
|
|||||||
if ($charge['balance'] < 0)
|
if ($charge['balance'] < 0)
|
||||||
die("HOW DID WE GET A NEGATIVE CHARGE AMOUNT?");
|
die("HOW DID WE GET A NEGATIVE CHARGE AMOUNT?");
|
||||||
|
|
||||||
if ($charge['balance'] <= 0)
|
/* if ($charge['balance'] <= 0) */
|
||||||
pr(array('StatementEntry::assignCredits' =>
|
/* pr(array('StatementEntry::assignCredits' => */
|
||||||
array('checkpoint' => 'Fully Paid Charge')));
|
/* array('checkpoint' => 'Fully Paid Charge'))); */
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -584,24 +584,24 @@ OPTION 2
|
|||||||
if (isset($credits[0]['applied']))
|
if (isset($credits[0]['applied']))
|
||||||
$used_credits[] = array_shift($credits);
|
$used_credits[] = array_shift($credits);
|
||||||
|
|
||||||
pr(array('StatementEntry::assignCredits' =>
|
/* pr(array('StatementEntry::assignCredits' => */
|
||||||
array('checkpoint' => 'Payments added')
|
/* array('checkpoint' => 'Payments added') */
|
||||||
+ compact('credits', 'used_credits', 'anon_credits', 'used_anon_credits')));
|
/* + compact('credits', 'used_credits', 'anon_credits', 'used_anon_credits'))); */
|
||||||
|
|
||||||
// Clean up any explicit credits that have been used
|
// Clean up any explicit credits that have been used
|
||||||
foreach ($used_credits AS $credit) {
|
foreach ($used_credits AS $credit) {
|
||||||
if ($credit['balance'] > 0) {
|
if ($credit['balance'] > 0) {
|
||||||
pr(array('StatementEntry::assignCredits' =>
|
/* pr(array('StatementEntry::assignCredits' => */
|
||||||
array('checkpoint' => 'Update Credit Entry')
|
/* array('checkpoint' => 'Update Credit Entry') */
|
||||||
+ compact('credit')));
|
/* + compact('credit'))); */
|
||||||
|
|
||||||
$this->id = $credit['StatementEntry']['id'];
|
$this->id = $credit['StatementEntry']['id'];
|
||||||
$this->saveField('amount', $credit['balance']);
|
$this->saveField('amount', $credit['balance']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pr(array('StatementEntry::assignCredits' =>
|
/* pr(array('StatementEntry::assignCredits' => */
|
||||||
array('checkpoint' => 'Delete Exhausted Credit Entry')
|
/* array('checkpoint' => 'Delete Exhausted Credit Entry') */
|
||||||
+ compact('credit')));
|
/* + compact('credit'))); */
|
||||||
|
|
||||||
$this->del($credit['StatementEntry']['id'], false);
|
$this->del($credit['StatementEntry']['id'], false);
|
||||||
}
|
}
|
||||||
@@ -612,9 +612,9 @@ OPTION 2
|
|||||||
if ($credit['balance'] <= 0)
|
if ($credit['balance'] <= 0)
|
||||||
die("HOW DID EXHAUSTED ANON CREDITS GET LEFT?");
|
die("HOW DID EXHAUSTED ANON CREDITS GET LEFT?");
|
||||||
|
|
||||||
pr(array('StatementEntry::assignCredits' =>
|
/* pr(array('StatementEntry::assignCredits' => */
|
||||||
array('checkpoint' => 'Create Explicit Credit')
|
/* array('checkpoint' => 'Create Explicit Credit') */
|
||||||
+ compact('credit')));
|
/* + compact('credit'))); */
|
||||||
|
|
||||||
$result = $this->addStatementEntry
|
$result = $this->addStatementEntry
|
||||||
(array('type' => 'CREDIT',
|
(array('type' => 'CREDIT',
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ class Tender extends AppModel {
|
|||||||
* (not in a pre-existing tender)
|
* (not in a pre-existing tender)
|
||||||
*/
|
*/
|
||||||
function verifyTender($tender) {
|
function verifyTender($tender) {
|
||||||
pr(array("Tender::verifyTender()"
|
/* pr(array("Tender::verifyTender()" */
|
||||||
=> compact('tender')));
|
/* => compact('tender'))); */
|
||||||
|
|
||||||
if (empty($tender['tender_type_id'])) {
|
if (empty($tender['tender_type_id'])) {
|
||||||
pr(array("Tender::verifyTender()"
|
/* pr(array("Tender::verifyTender()" */
|
||||||
=> "Tender verification failed"));
|
/* => "Tender verification failed")); */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,8 +42,8 @@ class Tender extends AppModel {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function addTender($tender) {
|
function addTender($tender) {
|
||||||
pr(array('Tender::addTender' =>
|
/* pr(array('Tender::addTender' => */
|
||||||
compact('tender')));
|
/* compact('tender'))); */
|
||||||
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
if (!$this->verifyTender($tender))
|
if (!$this->verifyTender($tender))
|
||||||
@@ -65,9 +65,9 @@ class Tender extends AppModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pr(array('Tender::addTender' =>
|
/* pr(array('Tender::addTender' => */
|
||||||
array('checkpoint' => 'Pre-Save')
|
/* array('checkpoint' => 'Pre-Save') */
|
||||||
+ array('Tender' => $tender)));
|
/* + array('Tender' => $tender))); */
|
||||||
|
|
||||||
$this->create();
|
$this->create();
|
||||||
if (!$this->save($tender))
|
if (!$this->save($tender))
|
||||||
|
|||||||
@@ -101,8 +101,8 @@ class Transaction extends AppModel {
|
|||||||
* (not in a pre-existing transaction)
|
* (not in a pre-existing transaction)
|
||||||
*/
|
*/
|
||||||
function verifyTransaction($transaction, $entries) {
|
function verifyTransaction($transaction, $entries) {
|
||||||
pr(array("Transaction::verifyTransaction()"
|
/* pr(array("Transaction::verifyTransaction()" */
|
||||||
=> compact('transaction', 'entries', 'customer_id', 'lease_id')));
|
/* => compact('transaction', 'entries', 'customer_id', 'lease_id'))); */
|
||||||
|
|
||||||
// Verify required Transaction data is present
|
// Verify required Transaction data is present
|
||||||
if (empty($transaction['type']) ||
|
if (empty($transaction['type']) ||
|
||||||
@@ -113,8 +113,8 @@ class Transaction extends AppModel {
|
|||||||
(in_array($transaction['type'], array('INVOICE'))
|
(in_array($transaction['type'], array('INVOICE'))
|
||||||
&& empty($transaction['lease_id']))
|
&& empty($transaction['lease_id']))
|
||||||
) {
|
) {
|
||||||
pr(array("Transaction::verifyTransaction()"
|
/* pr(array("Transaction::verifyTransaction()" */
|
||||||
=> "Transaction verification failed"));
|
/* => "Transaction verification failed")); */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,13 +122,13 @@ class Transaction extends AppModel {
|
|||||||
foreach ($entries AS $entry) {
|
foreach ($entries AS $entry) {
|
||||||
extract($entry);
|
extract($entry);
|
||||||
if (!$this->LedgerEntry->DoubleEntry->verifyDoubleEntry($le1, $le2, $le1_tender)) {
|
if (!$this->LedgerEntry->DoubleEntry->verifyDoubleEntry($le1, $le2, $le1_tender)) {
|
||||||
pr(array("Transaction::verifyTransaction()"
|
/* pr(array("Transaction::verifyTransaction()" */
|
||||||
=> "Double Entry verification failed"));
|
/* => "Double Entry verification failed")); */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!$this->StatementEntry->verifyStatementEntry($se)) {
|
if (!$this->StatementEntry->verifyStatementEntry($se)) {
|
||||||
pr(array("Transaction::verifyTransaction()"
|
/* pr(array("Transaction::verifyTransaction()" */
|
||||||
=> "Statement Entry verification failed"));
|
/* => "Statement Entry verification failed")); */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,8 +196,8 @@ class Transaction extends AppModel {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function addTransaction($data, $customer_id, $lease_id = null) {
|
function addTransaction($data, $customer_id, $lease_id = null) {
|
||||||
pr(array("Transaction::addTransaction()"
|
/* pr(array("Transaction::addTransaction()" */
|
||||||
=> compact('data', 'customer_id', 'lease_id')));
|
/* => compact('data', 'customer_id', 'lease_id'))); */
|
||||||
|
|
||||||
if (!isset($data['Transaction']) || !isset($data['Entry']))
|
if (!isset($data['Transaction']) || !isset($data['Entry']))
|
||||||
return array('error' => true);
|
return array('error' => true);
|
||||||
@@ -278,9 +278,9 @@ class Transaction extends AppModel {
|
|||||||
if (!$this->verifyTransaction($transaction, $data['Entry'], $customer_id, $lease_id))
|
if (!$this->verifyTransaction($transaction, $data['Entry'], $customer_id, $lease_id))
|
||||||
return array('error' => true) + $ret;
|
return array('error' => true) + $ret;
|
||||||
|
|
||||||
pr(array('Transaction::addTransaction' =>
|
/* pr(array('Transaction::addTransaction' => */
|
||||||
array('checkpoint' => 'Pre Transaction Save')
|
/* array('checkpoint' => 'Pre Transaction Save') */
|
||||||
+ compact('transaction')));
|
/* + compact('transaction'))); */
|
||||||
|
|
||||||
// Save transaction to the database
|
// Save transaction to the database
|
||||||
$this->create();
|
$this->create();
|
||||||
@@ -338,8 +338,8 @@ class Transaction extends AppModel {
|
|||||||
$ret['error'] = true;
|
$ret['error'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pr(array('Transaction::addTransaction' =>
|
/* pr(array('Transaction::addTransaction' => */
|
||||||
array('return' => $ret)));
|
/* array('return' => $ret))); */
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user