Added ability to create a new customer directly from the move in operation.
git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@760 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -132,14 +132,18 @@ class CustomersController extends AppController {
|
||||
* - Sets up the move-in page for the given customer.
|
||||
*/
|
||||
|
||||
function move_in($id = null) {
|
||||
function move_in($id = null, $unit_id = null) {
|
||||
$customer = array();
|
||||
$unit = array();
|
||||
|
||||
if (isset($id)) {
|
||||
if (!empty($id)) {
|
||||
$this->Customer->recursive = -1;
|
||||
$customer = current($this->Customer->read(null, $id));
|
||||
}
|
||||
if (!empty($unit_id)) {
|
||||
$this->Customer->Lease->Unit->recursive = -1;
|
||||
$unit = current($this->Customer->Lease->Unit->read(null, $unit_id));
|
||||
}
|
||||
$this->set(compact('customer', 'unit'));
|
||||
|
||||
$title = 'Customer Move-In';
|
||||
@@ -336,7 +340,17 @@ class CustomersController extends AppController {
|
||||
$this->redirect(array('action'=>'view', $this->Customer->id));
|
||||
|
||||
// Since this is a new customer, go to the move in screen.
|
||||
$this->redirect(array('action'=>'move_in', $this->Customer->id));
|
||||
// First set the move-in unit id, if there is one, ...
|
||||
if (empty($this->data['movein']['Unit']['id']))
|
||||
$unit_id = null;
|
||||
else
|
||||
$unit_id = $this->data['movein']['Unit']['id'];
|
||||
|
||||
// ... then redirect
|
||||
$this->redirect(array('action'=>'move_in',
|
||||
$this->Customer->id,
|
||||
$unit_id,
|
||||
));
|
||||
}
|
||||
|
||||
if ($id) {
|
||||
@@ -399,7 +413,8 @@ class CustomersController extends AppController {
|
||||
* - Add a new customer
|
||||
*/
|
||||
|
||||
function add() {
|
||||
function add($unit_id = null) {
|
||||
$this->set('movein', array('Unit' => array('id' => $unit_id)));
|
||||
$this->edit();
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ class UnitsController extends AppController {
|
||||
$customer = array();
|
||||
$unit = array();
|
||||
|
||||
if (isset($id)) {
|
||||
if (!empty($id)) {
|
||||
$this->Unit->recursive = -1;
|
||||
$unit = current($this->Unit->read(null, $id));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user