Added ability to see the customer when listing transactions
git-svn-id: file:///svn-source/pmgr/branches/v0.3_work@974 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -54,6 +54,12 @@ class TransactionsController extends AppController {
|
||||
$this->gridView('Deposits');
|
||||
}
|
||||
|
||||
function gridView($title, $action = null, $element = null) {
|
||||
if ($title != 'Deposits')
|
||||
$this->set('include', array('Customer'));
|
||||
parent::gridView($title, $action, $element);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -77,6 +83,7 @@ class TransactionsController extends AppController {
|
||||
$link = $this->gridDataCountTables($params, $model);
|
||||
$link['link']['StatementEntry'] = array('fields' => array());
|
||||
$link['link']['DepositTender'] = array('fields' => array());
|
||||
$link['link']['Customer'] = array('fields' => array('id', 'name'));
|
||||
return $link;
|
||||
}
|
||||
|
||||
@@ -101,6 +108,7 @@ class TransactionsController extends AppController {
|
||||
function gridDataPostProcessLinks(&$params, &$model, &$records, $links) {
|
||||
$links['Transaction'] = array('id', 'action' => ($params['action'] == 'deposit'
|
||||
? 'deposit_slip' : 'view'));
|
||||
$links['Customer'] = array('name');
|
||||
return parent::gridDataPostProcessLinks($params, $model, $records, $links);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
<?php /* -*- mode:PHP -*- */
|
||||
|
||||
if (isset($include))
|
||||
$include = is_array($include) ? $include : array($include);
|
||||
else
|
||||
$include = array();
|
||||
|
||||
// Define the table columns
|
||||
$cols = array();
|
||||
$cols['ID'] = array('index' => 'Transaction.id', 'formatter' => 'id');
|
||||
$cols['Type'] = array('index' => 'Transaction.type', 'formatter' => 'enum');
|
||||
//$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
|
||||
$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
|
||||
$cols['Timestamp'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
|
||||
$cols['Amount'] = array('index' => 'Transaction.amount', 'formatter' => 'currency');
|
||||
$cols['entries'] = array('index' => 'entries', 'formatter' => 'number');
|
||||
$cols['Entries'] = array('index' => 'entries', 'formatter' => 'number');
|
||||
$cols['Comment'] = array('index' => 'Transaction.comment', 'formatter' => 'comment');
|
||||
|
||||
// Render the grid
|
||||
@@ -17,4 +22,4 @@ $grid
|
||||
->defaultFields(array('ID', 'Timestamp'))
|
||||
->searchFields(array('Type', 'Comment'))
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array_diff(array_keys($cols), array('Comment')));
|
||||
array_merge($include, array_diff(array_keys($cols), array('Customer', 'Comment'))));
|
||||
|
||||
Reference in New Issue
Block a user