|
@@ -608,12 +608,16 @@ class Project extends Base_Controller {
|
|
|
if(empty($data['projectname'])) exit(json_result('0204',$this->response['0204'],array()));
|
|
|
|
|
|
if (empty($where['id'])) { // 添加项目
|
|
|
+ $data['userId'] = $this->get_user_info('id');
|
|
|
+ $data['company'] = $this->get_user_info('company');
|
|
|
+ if ($this->Project_model->getDataCount(array('projectname'=>$data['projectname'], 'company'=>$data['company'])) > 0) {
|
|
|
+ exit(json_result('0203', $this->response['0203'], array()));
|
|
|
+ }
|
|
|
$data['projectid'] = $this->input->post('project_no',true);
|
|
|
if(empty($data['projectid'])) exit(json_result('0205',$this->response['0205'],array()));
|
|
|
if(mb_strlen($data['projectid']) > 20) exit(json_result('0210',$this->response['0210'],array()));
|
|
|
if(!preg_match('/^[A-Za-z0-9]+$/', $data['projectid'])) exit(json_result('0212',$this->response['0212'],array()));
|
|
|
- $data['userId'] = $this->get_user_info('id');
|
|
|
- $data['company'] = $this->get_user_info('company');
|
|
|
+
|
|
|
|
|
|
$data['createtime'] = date('Y-m-d H:i:s',time() - 8*3600);
|
|
|
|
|
@@ -623,7 +627,8 @@ class Project extends Base_Controller {
|
|
|
$this->add_operation_log('insert',"添加\"{$data['projectname']}\"项目,项目编号\"{$data['projectid']}\"",0);
|
|
|
$this->add_operation_log('insert',"Add project.Project name:\"{$data['projectname']}\".Project number:\"{$data['projectid']}\"",0,1);
|
|
|
} else { // 编辑项目
|
|
|
- if ($this->Project_model->getDataCount(array('projectname'=>$data['projectname'], 'company'=>$data['company']), $where['id']) > 0) {
|
|
|
+ $company = $this->get_user_info('company');
|
|
|
+ if ($this->Project_model->getDataCount(array('projectname'=>$data['projectname'], 'company'=>$company), $where['id']) > 0) {
|
|
|
exit(json_result('0203', $this->response['0203'], array()));
|
|
|
}
|
|
|
$ret = $this->Project_model->get_one($where);
|