Box->recursive = 0; $this->set('boxes', $this->paginate()); } function view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid Box.', true)); $this->redirect(array('action'=>'index')); } $this->set('box', $this->Box->read(null, $id)); } function add() { if (!empty($this->data)) { $this->Box->create(); if ($this->Box->save($this->data)) { $this->Session->setFlash(__('The Box has been saved', true)); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('The Box could not be saved. Please, try again.', true)); } } $shipments = $this->Box->Shipment->find('list'); $this->set(compact('shipments')); } function edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid Box', true)); $this->redirect(array('action'=>'index')); } if (!empty($this->data)) { if ($this->Box->save($this->data)) { $this->Session->setFlash(__('The Box has been saved', true)); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('The Box could not be saved. Please, try again.', true)); } } if (empty($this->data)) { $this->data = $this->Box->read(null, $id); } $shipments = $this->Box->Shipment->find('list'); $this->set(compact('shipments')); } function delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for Box', true)); $this->redirect(array('action'=>'index')); } if ($this->Box->del($id)) { $this->Session->setFlash(__('Box deleted', true)); $this->redirect(array('action'=>'index')); } } } ?>