function WorkOrderStatus($id = null)
 {
     App::import("Model", "WorkOrderManager.WorkOrderStatus");
     $work_order_model = new WorkOrderStatus();
     $status = $work_order_model->find("first", array("conditions" => array("WorkOrderStatus.work_order_id" => $id), 'order' => array('WorkOrderStatus.id' => 'DESC')));
     return $status['WorkOrderStatus']['status'];
 }
 public function detail_section($id = null, $section = null)
 {
     $this->layoutOpt['left_nav_selected'] = "view_work_order";
     $this->WorkOrder->recursive = 3;
     $this->WorkOrder->id = $id;
     if (!$this->WorkOrder->exists()) {
         throw new NotFoundException(__('Invalid work order'));
     }
     $work_order = $this->WorkOrder->read(null, $id);
     App::import('Model', 'WorkOrderManager.WorkOrderStatus');
     $workOrderStatusModel = new WorkOrderStatus();
     $workOrder_status = $workOrderStatusModel->find('all', array('conditions' => array('WorkOrderStatus.work_order_id' => $id)));
     $user_id = $this->loginUser['id'];
     $this->set(compact('work_order', 'section', 'user_id', 'modal', 'workOrder_status'));
 }