/** * to edit a Matter * * */ public function editAction() { $request = $this->getRequest(); $matterModel = new Application_Model_Matter(); $this->_helper->layout->disableLayout(); if ($request->isPost()) { $this->_helper->viewRenderer->setNoRender(); $data = $request->getPost(); $matter_id = $data['matter_id']; $caseref_prev = $data['caseref_prev']; unset($data['matter_id']); unset($data['caseref_prev']); foreach ($data as $key => $val) { if ($val == "") { $data[$key] = NULL; } } if (!$matterModel->isMatterUnique($data, $matter_id)) { $nidx = $matterModel->getNextIdx($data); if ($data['caseref'] == $caseref_prev) { $data['idx'] = $nidx; } else { echo "caseidx-" . $nidx; return; } } $matterModel->updateMatter($data, $matter_id); echo $matter_id; } else { $matter_id = $this->_getParam('mid'); $matterInfo = $matterModel->getMatter($matter_id); if ($matterModel->hasFiledEvent($matter_id)) { $this->view->cat_edit = 0; $this->view->country_edit = 0; } else { $this->view->cat_edit = 1; $this->view->country_edit = 1; } $this->view->matter = $matterInfo[0]; $origin_arr = $matterModel->getCountryByCode($matterInfo[0]['origin']); $this->view->origin_name = $origin_arr['name']; $this->view->origin_code = $origin_arr['iso']; $type_arr = $matterModel->getTypeCode($matterInfo[0]['type_code']); $this->view->type_name = $type_arr['type']; $this->view->type_code = $type_arr['code']; if ($matterInfo[0]['parent_ID']) { $this->view->parent = $matterModel->getMatterUID($matterInfo[0]['parent_ID']) . " (" . $matterInfo[0]['parent_ID'] . ")"; $this->view->parent_id = $matterInfo[0]['parent_ID']; } if ($matterInfo[0]['container_ID']) { $this->view->container = $matterModel->getMatterUID($matterInfo[0]['container_ID']) . " (" . $matterInfo[0]['container_ID'] . ")"; $this->view->container_id = $matterInfo[0]['container_ID']; } $this->view->cats = $matterModel->getAllCategories(); $this->view->types = $matterModel->getMatterTypes(); } }