From 4892143c0ca2ad9e0913ecc5edaa9a43431fa7cc Mon Sep 17 00:00:00 2001 From: abijah Date: Wed, 31 Mar 2010 19:45:45 +0000 Subject: [PATCH] On move-out, redirecting back to the customer instead of the closed lease git-svn-id: file:///svn-source/pmgr/branches/v0.3_work@976 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/controllers/leases_controller.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/site/controllers/leases_controller.php b/site/controllers/leases_controller.php index c03a6cb..2c176c5 100644 --- a/site/controllers/leases_controller.php +++ b/site/controllers/leases_controller.php @@ -176,16 +176,20 @@ class LeasesController extends AppController { function move_out($id = null) { if ($this->data) { // Handle the move out based on the data given - //pr($this->data); - $this->Lease->moveOut($this->data['Lease']['id'], 'VACANT', $this->data['Lease']['moveout_date'] ); - $this->redirect(array('controller' => 'leases', + $lease = $this->Lease->find + ('first', array + ('contain' => array('Customer.id'), + 'conditions' => array(array('Lease.id' => $this->data['Lease']['id'])), + )); + + $this->redirect(array('controller' => 'customers', 'action' => 'view', - $this->data['Lease']['id'])); + $lease['Customer']['id'])); } if (isset($id)) {