Eliminated the ID field from the grids, wherever feasible.

git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@736 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-23 00:16:04 +00:00
parent da88975fed
commit 86b0c14eda
9 changed files with 7 additions and 129 deletions

View File

@@ -113,7 +113,7 @@ class LedgersController extends AppController {
} }
function gridDataPostProcessLinks(&$params, &$model, &$records, $links) { function gridDataPostProcessLinks(&$params, &$model, &$records, $links) {
$links['Ledger'] = array('id_sequence'); $links['Ledger'] = array('name');
$links['Account'] = array('name'); $links['Account'] = array('name');
return parent::gridDataPostProcessLinks($params, $model, $records, $links); return parent::gridDataPostProcessLinks($params, $model, $records, $links);
} }

View File

@@ -2,7 +2,6 @@
// Define the table columns // Define the table columns
$cols = array(); $cols = array();
$cols['ID'] = array('index' => 'Account.id', 'formatter' => 'id');
$cols['Name'] = array('index' => 'Account.name', 'formatter' => 'longname'); $cols['Name'] = array('index' => 'Account.name', 'formatter' => 'longname');
$cols['Type'] = array('index' => 'Account.type', 'formatter' => 'enum'); $cols['Type'] = array('index' => 'Account.type', 'formatter' => 'enum');
$cols['Entries'] = array('index' => 'entries', 'formatter' => 'number'); $cols['Entries'] = array('index' => 'entries', 'formatter' => 'number');
@@ -15,7 +14,7 @@ $cols['Comment'] = array('index' => 'Account.comment', 'formatter' => 'comment
$grid $grid
->columns($cols) ->columns($cols)
->sortField('Name') ->sortField('Name')
->defaultFields(array('ID', 'Name')) ->defaultFields(array('Name'))
->searchFields(array('Name')) ->searchFields(array('Name'))
->render($this, isset($config) ? $config : null, ->render($this, isset($config) ? $config : null,
array_diff(array_keys($cols), array('Comment'))); array_diff(array_keys($cols), array('Comment')));

View File

@@ -2,7 +2,6 @@
// Define the table columns // Define the table columns
$cols = array(); $cols = array();
$cols['ID'] = array('index' => 'Contact.id', 'formatter' => 'id');
$cols['Last Name'] = array('index' => 'Contact.last_name', 'formatter' => 'name'); $cols['Last Name'] = array('index' => 'Contact.last_name', 'formatter' => 'name');
$cols['First Name'] = array('index' => 'Contact.first_name', 'formatter' => 'name'); $cols['First Name'] = array('index' => 'Contact.first_name', 'formatter' => 'name');
$cols['Company'] = array('index' => 'Contact.company_name', 'formatter' => 'longname'); $cols['Company'] = array('index' => 'Contact.company_name', 'formatter' => 'longname');
@@ -14,7 +13,7 @@ $cols['Comment'] = array('index' => 'Contact.comment', 'formatter' =
$grid $grid
->columns($cols) ->columns($cols)
->sortField('Last Name') ->sortField('Last Name')
->defaultFields(array('ID', 'Last Name', 'First Name')) ->defaultFields(array('Last Name', 'First Name'))
->searchFields(array('Last Name', 'First Name', 'Company')) ->searchFields(array('Last Name', 'First Name', 'Company'))
->render($this, isset($config) ? $config : null, ->render($this, isset($config) ? $config : null,
array_diff(array_keys($cols), array('Type', 'Active', 'Comment'))); array_diff(array_keys($cols), array('Type', 'Active', 'Comment')));

View File

@@ -2,7 +2,6 @@
// Define the table columns // Define the table columns
$cols = array(); $cols = array();
$cols['ID'] = array('index' => 'Customer.id', 'formatter' => 'id');
$cols['Relationship'] = array('index' => 'ContactsCustomer.type', 'formatter' => 'enum'); $cols['Relationship'] = array('index' => 'ContactsCustomer.type', 'formatter' => 'enum');
$cols['Name'] = array('index' => 'Customer.name', 'formatter' => 'longname'); $cols['Name'] = array('index' => 'Customer.name', 'formatter' => 'longname');
$cols['Last Name'] = array('index' => 'PrimaryContact.last_name', 'formatter' => 'name'); $cols['Last Name'] = array('index' => 'PrimaryContact.last_name', 'formatter' => 'name');
@@ -20,7 +19,7 @@ if (!isset($config['filter']['Contact.id']))
$grid $grid
->columns($cols) ->columns($cols)
->sortField('Name') ->sortField('Name')
->defaultFields(array('ID', 'Name')) ->defaultFields(array('Name'))
->searchFields(array('Name', 'Last Name', 'First Name')) ->searchFields(array('Name', 'Last Name', 'First Name'))
->render($this, isset($config) ? $config : null, ->render($this, isset($config) ? $config : null,
array_diff(array_keys($cols), array('Comment'))); array_diff(array_keys($cols), array('Comment')));

View File

@@ -1,116 +0,0 @@
<?php /* -*- mode:PHP -*- */
// Define the table columns
$cols = array();
$cols['Transaction'] = array('index' => 'Transaction.id', 'formatter' => 'id');
$cols['Entry'] = array('index' => 'LedgerEntry.id', 'formatter' => 'id');
$cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
$cols['Effective'] = array('index' => 'LedgerEntry.effective_date', 'formatter' => 'date');
$cols['Through'] = array('index' => 'LedgerEntry.through_date', 'formatter' => 'date');
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'name');
$cols['Debit Account'] = array('index' => 'DebitAccount.name', 'formatter' => 'name');
$cols['Credit Account'] = array('index' => 'CreditAccount.name', 'formatter' => 'name');
$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
$cols['Lease'] = array('index' => 'Lease.number', 'formatter' => 'id');
$cols['Unit'] = array('index' => 'Unit.name', 'formatter' => 'name');
$cols['Source'] = array('index' => 'MonetarySource.name', 'formatter' => 'name');
$cols['Comment'] = array('index' => 'LedgerEntry.comment', 'formatter' => 'comment', 'width'=>150);
$cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' => 'currency');
$cols['Debit'] = array('index' => 'debit', 'formatter' => 'currency');
$cols['Credit'] = array('index' => 'credit', 'formatter' => 'currency');
$cols['Last Payment'] = array('index' => 'last_paid', 'formatter' => 'date');
$cols['Applied'] = array('index' => "applied", 'formatter' => 'currency');
$cols['Sub-Total'] = array('index' => 'subtotal-LedgerEntry.amount', 'formatter' => 'currency', 'sortable' => false);
if (isset($transaction_id) || isset($reconcile_id))
$grid->invalidFields('Transaction');
if (!isset($collected_account_id))
$grid->invalidFields('Last Payment');
if (isset($account_ftype) || isset($ledger_id) || isset($account_id) || isset($ar_account) || isset($customer_id))
$grid->invalidFields(array('Debit Account', 'Credit Account'));
else
$grid->invalidFields('Account');
if (isset($no_account) || $group_by_tx || isset($collected_account_id))
$grid->invalidFields(array('Account', 'Debit Account', 'Credit Account'));
if (isset($ledger_id) || isset($account_id) || isset($ar_account) || isset($customer_id)) {
$grid->invalidFields('Amount');
$cols['Sub-Total']['index'] = 'subtotal-balance';
} else {
$grid->invalidFields(array('Debit', 'Credit'));
$cols['Sub-Total']['index'] = 'subtotal-LedgerEntry.amount';
}
// 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))
$grid->invalidFields(array('Customer'));
if (isset($lease_id) || $group_by_tx)
$grid->invalidFields(array('Lease', 'Unit'));
if (!isset($reconcile_id) && !isset($collected_account_id))
$grid->invalidFields('Applied');
else
$cols['Sub-Total']['index'] = 'subtotal-applied';
if (isset($account_ftype) || isset($collected_account_id))
$grid->invalidFields('Sub-Total');
// Now that columns are defined, establish basic grid parameters
$grid
->columns($cols)
->sortField('Date')
->defaultFields(array('Entry', 'Date', 'Amount', 'Credit', 'Debit'));
if (!isset($config['rows']) && !isset($collected_account_id)) {
$config['action'] = 'ledger';
$grid->limit(50);
}
if (isset($reconcile_id)) {
$config['action'] = 'reconcile';
$grid->customData(compact('reconcile_id'))->limit(20);
}
if (isset($collected_account_id)) {
$config['action'] = 'collected';
$account_id = $collected_account_id;
$grid->limit(50);
$grid->sortField('Last Payment');
}
if (isset($entry_ids))
$grid->id_list($entry_ids);
// Set up search fields if requested by caller
if (isset($searchfields))
$grid->searchFields(array('Customer', 'Unit'));
// Include custom data
$grid->customData(compact('ledger_id', 'account_id', 'ar_account',
'account_type', 'account_ftype', 'monetary_source_id',
'customer_id', 'lease_id', 'transaction_id', 'group_by_tx'));
// Render the grid
$grid
->render($this, isset($config) ? $config : null,
array('Transaction', 'Entry', 'Date', 'Effective', 'Last Payment',
'Account', 'Debit Account', 'Credit Account',
'Customer', 'Unit',
'Comment',
'Amount', 'Debit', 'Credit',
'Applied', 'Sub-Total')
);

View File

@@ -2,7 +2,7 @@
// Define the table columns // Define the table columns
$cols = array(); $cols = array();
$cols['ID'] = array('index' => 'id_sequence', 'formatter' => 'id'); $cols['ID'] = array('index' => 'id_sequence', 'formatter' => 'id', 'hidden' => true);
$cols['Name'] = array('index' => 'Ledger.name', 'formatter' => 'name'); $cols['Name'] = array('index' => 'Ledger.name', 'formatter' => 'name');
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'longname'); $cols['Account'] = array('index' => 'Account.name', 'formatter' => 'longname');
$cols['Open Date'] = array('index' => 'PriorCloseTransaction.stamp', 'formatter' => 'date'); $cols['Open Date'] = array('index' => 'PriorCloseTransaction.stamp', 'formatter' => 'date');

View File

@@ -2,7 +2,6 @@
// Define the table columns // Define the table columns
$cols = array(); $cols = array();
$cols['ID'] = array('index' => 'Map.id', 'formatter' => 'id');
$cols['Name'] = array('index' => 'Map.name', 'formatter' => 'longname'); $cols['Name'] = array('index' => 'Map.name', 'formatter' => 'longname');
$cols['Site Area'] = array('index' => 'SiteArea.name', 'formatter' => 'longname'); $cols['Site Area'] = array('index' => 'SiteArea.name', 'formatter' => 'longname');
$cols['Width'] = array('index' => 'Map.width', 'formatter' => 'number'); $cols['Width'] = array('index' => 'Map.width', 'formatter' => 'number');
@@ -13,7 +12,7 @@ $cols['Comment'] = array('index' => 'Map.comment', 'formatter' => 'comment
$grid $grid
->columns($cols) ->columns($cols)
->sortField('Name') ->sortField('Name')
->defaultFields(array('ID', 'Name')) ->defaultFields(array('Name'))
->searchFields(array('Name')) ->searchFields(array('Name'))
->render($this, isset($config) ? $config : null, ->render($this, isset($config) ? $config : null,
array_diff(array_keys($cols), array())); array_diff(array_keys($cols), array()));

View File

@@ -2,7 +2,6 @@
// Define the table columns // Define the table columns
$cols = array(); $cols = array();
//$cols['ID'] = array('index' => 'Tender.id', 'formatter' => 'id');
$cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date'); $cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname'); $cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
$cols['Item'] = array('index' => 'Tender.name', 'formatter' => 'longname'); $cols['Item'] = array('index' => 'Tender.name', 'formatter' => 'longname');

View File

@@ -4,7 +4,6 @@
$cols = array(); $cols = array();
$cols['Sort'] = array('index' => 'Unit.sort_order', 'hidden' => true); $cols['Sort'] = array('index' => 'Unit.sort_order', 'hidden' => true);
$cols['Walk'] = array('index' => 'Unit.walk_order', 'formatter' => 'number'); $cols['Walk'] = array('index' => 'Unit.walk_order', 'formatter' => 'number');
$cols['ID'] = array('index' => 'Unit.id', 'formatter' => 'id');
$cols['Unit'] = array('index' => 'Unit.name', 'formatter' => 'shortname'); $cols['Unit'] = array('index' => 'Unit.name', 'formatter' => 'shortname');
$cols['Size'] = array('index' => 'UnitSize.name', 'formatter' => 'shortname'); $cols['Size'] = array('index' => 'UnitSize.name', 'formatter' => 'shortname');
$cols['Rent'] = array('index' => 'Unit.rent', 'formatter' => 'currency'); $cols['Rent'] = array('index' => 'Unit.rent', 'formatter' => 'currency');
@@ -17,7 +16,7 @@ $cols['Comment'] = array('index' => 'Unit.comment', 'formatter' => 'comment');
$grid $grid
->columns($cols) ->columns($cols)
->sortField('Sort') ->sortField('Sort')
->defaultFields(array('Sort', 'ID', 'Unit')) ->defaultFields(array('Sort', 'Unit'))
->searchFields(array('Unit', 'Size', 'Status')) ->searchFields(array('Unit', 'Size', 'Status'))
->render($this, isset($config) ? $config : null, ->render($this, isset($config) ? $config : null,
array_diff(array_keys($cols), array('Walk', 'Deposit', 'Comment'))); array_diff(array_keys($cols), array('Walk', 'Deposit', 'Comment')));