This is the remainder of the previous, invalid, partial checkin.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@419 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-29 23:25:03 +00:00
parent a8862ea3fd
commit ccf7a5fccd
4 changed files with 207 additions and 132 deletions

View File

@@ -9,6 +9,10 @@ class Transaction extends AppModel {
var $hasMany = array(
'LedgerEntry',
'StatementEntry',
'DepositTender' => array(
'className' => 'Tender',
'foreignKey' => 'deposit_transaction_id',
),
'Charge' => array(
'className' => 'StatementEntry',
@@ -112,18 +116,9 @@ class Transaction extends AppModel {
$deposit['customer_id'] = null;
$deposit['lease_id'] = null;
// For some reason, $data is being modified by the
// addTransaction call, even though we're not passing by
// reference. Not all items in $data['Entry'] are being
// stomped on... only the last one in the list :-/
// Save off all the tender ids now, before calling
// addTransaction, to make sure we don't lose any.
$tender_ids = array_map(create_function('$item',
/* 'if (!isset($item))' . */
/* ' pr("NO ITEM");' . */
/* 'if (!isset($item["tender_id"]))' . */
/* ' pr(array("BAD ITEM" => compact("item")));' . */
'return $item["tender_id"];'),
// Save the list of IDs, so that we can mark their
// deposit transaction after it has been created.
$tender_ids = array_map(create_function('$item', 'return $item["tender_id"];'),
$data['Entry']);
// Go through the statement entries and re-group by account id