Fixed a bug causing leder_entry lists to only list one item from each transaction (although the numbers were right, the other ledger_entry fields were not). This was due to the changes I made to ledger_entries.ctp when moving everything to the Grid Helper. Prior to that, the default was to group by transactions, unless notxgroup was defined. Since it was experimental, it was hardcoded to false in the ledger_entries element, so there was no problem. After Grid Helper, it was inadvertantly deleted, hence the bug. I changed the default to be NOT to group by transaction, and also invalidate the ledger_entry fields when we do group that way. So, this bug should be put mostly to rest, although I don't like converting the ledger_entry list into a simple transaction list (we do have another element for that after all). Oh well, works for now.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@304 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-11 01:52:32 +00:00
parent b96a8f01da
commit fa17e319e0
5 changed files with 44 additions and 10 deletions

View File

@@ -221,10 +221,10 @@ class LedgerEntriesController extends AppController {
} }
function jqGridDataGroup(&$params, &$model) { function jqGridDataGroup(&$params, &$model) {
if (isset($params['custom']['notxgroup'])) if (isset($params['custom']['group_by_tx']) && $params['custom']['group_by_tx'])
return parent::jqGridDataGroup($params, $model); return $model->alias.'.transaction_id';
return $model->alias.'.transaction_id'; return parent::jqGridDataGroup($params, $model);
} }
function jqGridDataOrder(&$params, &$model, $index, $direction) { function jqGridDataOrder(&$params, &$model, $index, $direction) {

View File

@@ -70,6 +70,7 @@ echo $this->element('ledger_entries', array
(// Element configuration (// Element configuration
'ledger_id' => $account['CurrentLedger']['id'], 'ledger_id' => $account['CurrentLedger']['id'],
'account_type' => $account['Account']['type'], 'account_type' => $account['Account']['type'],
'group_by_tx' => true,
// Grid configuration // Grid configuration
'config' => array 'config' => array

View File

@@ -28,12 +28,37 @@ $cols['Applied'] = array('index' => "Reconciliation.amount", 'formatter'
$cols['Sub-Total'] = array('index' => 'subtotal', 'formatter' => 'currency', 'sortable' => false); $cols['Sub-Total'] = array('index' => 'subtotal', 'formatter' => 'currency', 'sortable' => false);
// Since group_by_tx is a boolean, let's just get it
// defined, regardless of whether the caller did so.
// group_by_tx will cause all entry fields to be
// invalidated, and will leave only the transaction
// fields. Yes... the caller should just use the
// transactions element instead, in theory. However,
// it hasn't yet been implemented to the level of
// this element, and additionally, the transactions
// element will not allow for customer information
// (rightly so, since it's a ledger_entry field).
// However, at the current implementation, all ledger
// entries of a transaction are for the same customer.
// So... we allow it for now.
if (!isset($group_by_tx))
$group_by_tx = false;
if (isset($transaction_id) || isset($reconcile_id))
$grid->invalidFields('Transaction');
if ($group_by_tx)
$grid->invalidFields('Entry');
if ($group_by_tx)
$grid->invalidFields(array('Effective', 'Through'));
if (isset($account_ftype) || isset($ledger_id) || isset($account_id) || isset($ar_account)) if (isset($account_ftype) || isset($ledger_id) || isset($account_id) || isset($ar_account))
$grid->invalidFields(array('Debit Account', 'Credit Account')); $grid->invalidFields(array('Debit Account', 'Credit Account'));
else else
$grid->invalidFields('Account'); $grid->invalidFields('Account');
if (isset($no_account)) if (isset($no_account) || $group_by_tx)
$grid->invalidFields(array('Account', 'Debit Account', 'Credit Account')); $grid->invalidFields(array('Account', 'Debit Account', 'Credit Account'));
if (isset($ledger_id) || isset($account_id) || isset($ar_account)) if (isset($ledger_id) || isset($account_id) || isset($ar_account))
@@ -41,10 +66,13 @@ if (isset($ledger_id) || isset($account_id) || isset($ar_account))
else else
$grid->invalidFields(array('Debit', 'Credit')); $grid->invalidFields(array('Debit', 'Credit'));
// group_by_tx SHOULD wipe out Customer, but the reality
// is that it works good at the present, so we'll leave it.
if (isset($lease_id) || isset($customer_id)) if (isset($lease_id) || isset($customer_id))
$grid->invalidFields(array('Customer', 'Lease', 'Unit')) $grid->invalidFields(array('Customer'))
// Invoice/Receipt accounts don't use effective/through
->invalidFields(array('Effective', 'Through')); if (isset($lease_id) || $group_by_tx)
$grid->invalidFields(array('Lease', 'Unit'))
if (!isset($reconcile_id)) if (!isset($reconcile_id))
$grid->invalidFields('Applied'); $grid->invalidFields('Applied');
@@ -59,7 +87,7 @@ if (!isset($config['rows'])) {
} }
if (isset($reconcile_id)) { if (isset($reconcile_id)) {
$grid->customData(compact('reconcile_id'))->limit(5); $grid->customData(compact('reconcile_id'))->limit(20);
} }
// Set up search fields if requested by caller // Set up search fields if requested by caller
@@ -69,7 +97,7 @@ if (isset($searchfields))
// Include custom data // Include custom data
$grid->customData(compact('ledger_id', 'account_id', 'ar_account', $grid->customData(compact('ledger_id', 'account_id', 'ar_account',
'account_type', 'account_ftype', 'account_type', 'account_ftype',
'customer_id', 'lease_id', 'transaction_id', 'notxgroup')); 'customer_id', 'lease_id', 'transaction_id', 'group_by_tx'));
// Render the grid // Render the grid
$grid $grid

View File

@@ -67,6 +67,7 @@ echo $this->element('ledger_entries', array
(// Element configuration (// Element configuration
'ledger_id' => $ledger['id'], 'ledger_id' => $ledger['id'],
'account_type' => $account['type'], 'account_type' => $account['type'],
'group_by_tx' => true,
// Grid configuration // Grid configuration
'config' => array 'config' => array

View File

@@ -54,7 +54,11 @@ echo '<div CLASS="detail supporting">' . "\n";
echo $this->element('ledger_entries', array echo $this->element('ledger_entries', array
(// Element configuration (// Element configuration
'transaction_id' => $transaction['Transaction']['id'], 'transaction_id' => $transaction['Transaction']['id'],
'notxgroup' => true,
// Default for grouping by transaction is already false,
// but we'll get explicit here, since we clearly want to
// see all of the ledger entries not grouped by tx.
'group_by_tx' => false,
// Grid configuration // Grid configuration
'config' => array 'config' => array