From 285c682b1e154120fad465973aef12ccf59f5b45 Mon Sep 17 00:00:00 2001 From: abijah Date: Tue, 30 Mar 2010 15:57:54 +0000 Subject: [PATCH] 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 --- site/controllers/transactions_controller.php | 8 ++++++++ site/views/elements/transactions.ctp | 11 ++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/site/controllers/transactions_controller.php b/site/controllers/transactions_controller.php index b14341d..717bb96 100644 --- a/site/controllers/transactions_controller.php +++ b/site/controllers/transactions_controller.php @@ -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); } diff --git a/site/views/elements/transactions.ctp b/site/views/elements/transactions.ctp index cf8385b..afa4275 100644 --- a/site/views/elements/transactions.ctp +++ b/site/views/elements/transactions.ctp @@ -1,13 +1,18 @@ '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'))));