From a79adbce2d217a7c7ffc24f3865a77fd0d587453 Mon Sep 17 00:00:00 2001 From: abijah Date: Fri, 28 Aug 2009 16:32:21 +0000 Subject: [PATCH] Moved the creation actions into the CONTROLLER menu. Minor cleanup of deposit_slip. Minor tweaking to views. git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@803 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/controllers/customers_controller.php | 2 +- site/controllers/transactions_controller.php | 24 +++++++++----------- site/views/tenders/view.ctp | 2 +- site/views/transactions/view.ctp | 9 ++------ 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/site/controllers/customers_controller.php b/site/controllers/customers_controller.php index be4ec30..2106c16 100644 --- a/site/controllers/customers_controller.php +++ b/site/controllers/customers_controller.php @@ -25,7 +25,7 @@ class CustomersController extends AppController { $this->addSideMenuLink('New Customer', array('controller' => 'customers', 'action' => 'add'), null, - 'ACTION', $this->new_area); + 'CONTROLLER', $this->new_area); } diff --git a/site/controllers/transactions_controller.php b/site/controllers/transactions_controller.php index 05bdc48..6330080 100644 --- a/site/controllers/transactions_controller.php +++ b/site/controllers/transactions_controller.php @@ -50,7 +50,7 @@ class TransactionsController extends AppController { function deposit() { $this->addSideMenuLink('New Deposit', array('controller' => 'tenders', 'action' => 'deposit'), null, - 'ACTION', $this->new_area); + 'CONTROLLER', $this->new_area); $this->gridView('Deposits'); } @@ -276,7 +276,7 @@ class TransactionsController extends AppController { $this->Session->setFlash(__('Unable to Create Deposit', true)); $this->redirect(array('controller' => 'tenders', 'action'=>'deposit')); } - + // Present the deposit slip to the user $this->redirect(array('controller' => 'transactions', 'action' => 'deposit_slip', @@ -440,15 +440,12 @@ class TransactionsController extends AppController { */ function deposit_slip($id) { - // Build a container for the deposit slip data - $deposit = array('types' => array()); - + // Find the deposit transaction $this->Transaction->id = $id; - $deposit += - $this->Transaction->find('first', array('contain' => false)); + $deposit = $this->Transaction->find('first', array('contain' => false)); // Get a summary of all forms of tender in the deposit - $result = $this->Transaction->find + $tenders = $this->Transaction->find ('all', array('link' => array('DepositTender' => array('fields' => array(), @@ -463,16 +460,17 @@ class TransactionsController extends AppController { 'group' => 'TenderType.id', )); - if (empty($result)) { - die(); + // Verify the deposit exists, and that something was actually deposited + if (empty($deposit) || empty($tenders)) { $this->Session->setFlash(__('Invalid Deposit.', true)); $this->redirect(array('action'=>'deposit')); } // Add the summary to our deposit slip data container - foreach ($result AS $type) { - $deposit['types'][$type['TenderType']['id']] = - $type['TenderType'] + $type[0]; + $deposit['types'] = array(); + foreach ($tenders AS $tender) { + $deposit['types'][$tender['TenderType']['id']] = + $tender['TenderType'] + $tender[0]; } $deposit_total = 0; diff --git a/site/views/tenders/view.ctp b/site/views/tenders/view.ctp index 2b7e7c1..5691ca6 100644 --- a/site/views/tenders/view.ctp +++ b/site/views/tenders/view.ctp @@ -36,7 +36,7 @@ for ($i=1; $i<=4; ++$i) if (!empty($tender['deposit_transaction_id'])) $rows[] = array('Deposit', $html->link('#'.$tender['deposit_transaction_id'], array('controller' => 'transactions', - 'action' => 'view', + 'action' => 'deposit_slip', $tender['deposit_transaction_id']))); if (!empty($tender['nsf_transaction_id'])) diff --git a/site/views/transactions/view.ctp b/site/views/transactions/view.ctp index 4daffa6..6bbb9ab 100644 --- a/site/views/transactions/view.ctp +++ b/site/views/transactions/view.ctp @@ -27,18 +27,13 @@ $rows[] = array('Account', ($account['link'] 'action' => 'view', $account['id'])) : $account['name'])); -$rows[] = array('Ledger', ($account['link'] - ? $html->link('#' . $ledger['sequence'], - array('controller' => 'ledgers', - 'action' => 'view', - $ledger['id'])) - : '#' . $ledger['sequence'])); - + if (!empty($nsf_tender['id'])) $rows[] = array('NSF Tender', $html->link($nsf_tender['name'], array('controller' => 'tenders', 'action' => 'view', $nsf_tender['id']))); + $rows[] = array('Comment', $transaction['comment']); echo $this->element('table',