Modified to use the logging mechanism
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@445 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -22,16 +22,14 @@ class Tender extends AppModel {
|
||||
* (not in a pre-existing tender)
|
||||
*/
|
||||
function verifyTender($tender) {
|
||||
/* pr(array("Tender::verifyTender()" */
|
||||
/* => compact('tender'))); */
|
||||
$this->prFunctionLevel(10);
|
||||
$this->prEnter(compact('tender'));
|
||||
|
||||
if (empty($tender['tender_type_id'])) {
|
||||
/* pr(array("Tender::verifyTender()" */
|
||||
/* => "Tender verification failed")); */
|
||||
return false;
|
||||
return $this->prReturn(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
return $this->prReturn(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,12 +41,11 @@ class Tender extends AppModel {
|
||||
*/
|
||||
|
||||
function addTender($tender) {
|
||||
/* pr(array('Tender::addTender' => */
|
||||
/* compact('tender'))); */
|
||||
$this->prEnter(compact('tender'));
|
||||
|
||||
$ret = array();
|
||||
if (!$this->verifyTender($tender))
|
||||
return array('error' => true) + $ret;
|
||||
return $this->prReturn(array('error' => true) + $ret);
|
||||
|
||||
// Come up with a (not necessarily unique) name for the tender.
|
||||
// For checks & money orders, this will be based on the check
|
||||
@@ -66,16 +63,15 @@ class Tender extends AppModel {
|
||||
}
|
||||
}
|
||||
|
||||
/* pr(array('Tender::addTender' => */
|
||||
/* array('checkpoint' => 'Pre-Save') */
|
||||
/* + array('Tender' => $tender))); */
|
||||
$this->pr(20, array('Tender' => $tender),
|
||||
'Pre-Save');
|
||||
|
||||
$this->create();
|
||||
if (!$this->save($tender))
|
||||
return array('error' => true) + $ret;
|
||||
return $this->prReturn(array('error' => true) + $ret);
|
||||
|
||||
$ret['tender_id'] = $this->id;
|
||||
return $ret + array('error' => false);
|
||||
return $this->prReturn($ret + array('error' => false));
|
||||
}
|
||||
|
||||
|
||||
@@ -107,8 +103,8 @@ class Tender extends AppModel {
|
||||
*/
|
||||
|
||||
function nsf($id, $stamp = null) {
|
||||
pr(array('Tender::nsf',
|
||||
compact('id')));
|
||||
$this->prFunctionLevel(30);
|
||||
$this->prEnter(compact('id'));
|
||||
|
||||
// Get information about this NSF item.
|
||||
$this->id = $id;
|
||||
@@ -120,7 +116,7 @@ class Tender extends AppModel {
|
||||
'NsfTransaction'),
|
||||
));
|
||||
//'conditions' => array(array('Tender.id' => $id)),
|
||||
pr($tender);
|
||||
$this->pr(20, compact('tender'));
|
||||
|
||||
if (!empty($tender['NsfTransaction']['id']))
|
||||
die("Item has already been set as NSF");
|
||||
@@ -136,7 +132,7 @@ class Tender extends AppModel {
|
||||
'amount' => -1 * $tender['LedgerEntry']['amount'],
|
||||
))),
|
||||
$tender['DepositTransaction']['account_id']);
|
||||
pr(compact('result'));
|
||||
$this->pr(20, compact('result'));
|
||||
|
||||
if ($result['error'])
|
||||
die("Unable to save NSF transaction");
|
||||
@@ -161,7 +157,7 @@ class Tender extends AppModel {
|
||||
'conditions' => array('LedgerEntry.id' => $tender['LedgerEntry']['id']),
|
||||
));
|
||||
|
||||
pr(compact('nsf_ledger_entry'));
|
||||
$this->pr(20, compact('nsf_ledger_entry'));
|
||||
|
||||
$bounce = array('Transaction' => array(), 'Entry' => array());
|
||||
|
||||
@@ -189,7 +185,7 @@ class Tender extends AppModel {
|
||||
}
|
||||
}
|
||||
|
||||
pr(compact('bounce'));
|
||||
$this->pr(20, compact('bounce'));
|
||||
$result = $this->NsfTransaction->addNsf($bounce);
|
||||
|
||||
if ($result['error'])
|
||||
@@ -200,7 +196,7 @@ class Tender extends AppModel {
|
||||
|
||||
/* $nsf_fee_account_id = $A->nsfChargeAccountID(); */
|
||||
|
||||
return true;
|
||||
return $this->prReturn(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user