Merge in from surplus_account_20090815 r592
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@593 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -13,7 +13,7 @@ class LedgerEntry extends AppModel {
|
||||
),
|
||||
'DebitDoubleEntry' => array(
|
||||
'className' => 'DoubleEntry',
|
||||
'foreignKey' => 'credit_entry_id',
|
||||
'foreignKey' => 'debit_entry_id',
|
||||
'dependent' => true,
|
||||
),
|
||||
'CreditDoubleEntry' => array(
|
||||
@@ -127,24 +127,20 @@ class LedgerEntry extends AppModel {
|
||||
* - Inserts new Ledger Entry into the database
|
||||
*/
|
||||
function addLedgerEntry($entry, $tender = null) {
|
||||
/* pr(array('LedgerEntry::addLedgerEntry' => */
|
||||
/* compact('entry', 'tender'))); */
|
||||
$this->prFunctionLevel(16);
|
||||
$this->prEnter(compact('entry', 'tender'));
|
||||
|
||||
$ret = array();
|
||||
$ret = array('data' => $entry);
|
||||
if (!$this->verifyLedgerEntry($entry, $tender))
|
||||
return array('error' => true) + $ret;
|
||||
return $this->prReturn(array('error' => true) + $ret);
|
||||
|
||||
if (empty($entry['ledger_id']))
|
||||
$entry['ledger_id'] =
|
||||
$this->Account->currentLedgerID($entry['account_id']);
|
||||
|
||||
/* pr(array('LedgerEntry::addLedgerEntry' => */
|
||||
/* array('checkpoint' => 'Pre-Save') */
|
||||
/* + compact('entry'))); */
|
||||
|
||||
$this->create();
|
||||
if (!$this->save($entry))
|
||||
return array('error' => true) + $ret;
|
||||
return $this->prReturn(array('error' => true) + $ret);
|
||||
|
||||
$ret['ledger_entry_id'] = $this->id;
|
||||
|
||||
@@ -154,10 +150,10 @@ class LedgerEntry extends AppModel {
|
||||
$result = $this->Tender->addTender($tender);
|
||||
$ret['Tender'] = $result;
|
||||
if ($result['error'])
|
||||
return array('error' => true) + $ret;
|
||||
return $this->prReturn(array('error' => true) + $ret);
|
||||
}
|
||||
|
||||
return $ret + array('error' => false);
|
||||
return $this->prReturn($ret + array('error' => false));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user