false, 'limit' => 100, 'order'=>array('Shipment.id' => 'desc'), 'recursive' => 1 ); function index() { $this->Shipment->recursive = 0; $this->set('shipments', $this->paginate()); } function view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid Shipment.', true)); $this->redirect(array('action'=>'index')); } $this->set('shipment', $this->Shipment->read(null, $id)); } function add() { if (!empty($this->data)) { $this->Shipment->create(); if ($this->Shipment->save($this->data)) { $this->Session->setFlash(__('The Shipment has been saved', true)); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('The Shipment could not be saved. Please, try again.', true)); } } $jobs = $this->Shipment->Job->find('list'); $principles = $this->Shipment->Principle->find('list'); $purchaseOrders = $this->Shipment->PurchaseOrder->find('list'); $freightForwarders = $this->Shipment->FreightForwarder->find('list'); $this->set(compact('jobs', 'principles', 'purchaseOrders', 'freightForwarders')); } function add_edit($action = 'add') { $principles = $this->Shipment->Principle->find('list'); $freightForwarders = $this->Shipment->FreightForwarder->find('list'); $this->set('principles', 'freightForwarders'); } function delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for Shipment', true)); $this->redirect(array('action'=>'index')); } if ($this->Shipment->del($id)) { $this->Session->setFlash(__('Shipment deleted', true)); $this->redirect(array('action'=>'index')); } } } ?>