Added customer association to each tender

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@413 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-29 09:33:29 +00:00
parent 2ffe04e3e4
commit b789ed62b7
6 changed files with 37 additions and 15 deletions

View File

@@ -3,6 +3,7 @@ class Tender extends AppModel {
var $belongsTo = array(
'TenderType',
'Customer',
'LedgerEntry',
'DepositTransaction' => array(
'className' => 'Transaction',

View File

@@ -353,6 +353,7 @@ class Transaction extends AppModel {
foreach ($data['Entry'] AS $e_index => &$entry) {
extract($entry);
$le1['transaction_id'] = $le2['transaction_id'] = $ret['transaction_id'];
$le1_tender['customer_id'] = $transaction['customer_id'];
$result = $this->LedgerEntry->DoubleEntry->addDoubleEntry($le1, $le2, $le1_tender);
$ret['entries'][$e_index]['DoubleEntry'] = $result;
if ($result['error']) {
@@ -376,7 +377,7 @@ class Transaction extends AppModel {
!$ret['error']) {
$result = $this->StatementEntry->assignCredits
(array('link' => array('Customer'),
'conditions' => array('Customer.id' => $customer_id)),
'conditions' => array('Customer.id' => $transaction['customer_id'])),
($transaction['type'] == 'RECEIPT'
? $ret['transaction_id']
: null));