diff --git a/site/controllers/leases_controller.php b/site/controllers/leases_controller.php index 902c5d6..ab49c71 100644 --- a/site/controllers/leases_controller.php +++ b/site/controllers/leases_controller.php @@ -394,6 +394,10 @@ class LeasesController extends AppController { $this->set(compact('default_late')); if ($type === 'move-in') { + // Make sure we have a valid lease that we're moving in + if (empty($lease)) + $this->redirect(array('action' => 'index')); + $movein = array(); $movein['time'] = strtotime($lease['Lease']['movein_date']); $movein['effective_time'] = strtotime($lease['Lease']['movein_date']); diff --git a/site/controllers/transactions_controller.php b/site/controllers/transactions_controller.php index 18bb410..c13be0a 100644 --- a/site/controllers/transactions_controller.php +++ b/site/controllers/transactions_controller.php @@ -112,7 +112,7 @@ class TransactionsController extends AppController { * - handles the creation of a charge invoice */ - function postInvoice() { + function postInvoice($redirect = true) { if (!$this->RequestHandler->isPost()) { echo('

THIS IS NOT A POST FOR SOME REASON

'); return; @@ -127,6 +127,17 @@ class TransactionsController extends AppController { die("

INVOICE FAILED

"); } + if ($redirect) { + if (!empty($this->data['Customer']['id'])) + $this->redirect(array('controller' => 'customers', + 'action' => 'receipt', + $this->data['Customer']['id'])); + else + $this->redirect(array('controller' => 'leases', + 'action' => 'view', + $this->data['Lease']['id'])); + } + $this->layout = null; $this->autoLayout = false; $this->autoRender = false; @@ -140,7 +151,7 @@ class TransactionsController extends AppController { * - handles the creation of a receipt */ - function postReceipt() { + function postReceipt($redirect = true) { if (!$this->RequestHandler->isPost()) { echo('

THIS IS NOT A POST FOR SOME REASON

'); return; @@ -164,6 +175,11 @@ class TransactionsController extends AppController { die("

RECEIPT FAILED

"); } + if ($redirect) + $this->redirect(array('controller' => 'customers', + 'action' => 'view', + $this->data['Customer']['id'])); + $this->layout = null; $this->autoLayout = false; $this->autoRender = false;