diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php index d17b7814..5ad9eb49 100644 --- a/application/default/controllers/AuthorController.php +++ b/application/default/controllers/AuthorController.php @@ -2351,7 +2351,7 @@ class AuthorController extends Zend_Controller_Action return true; } - $sql="select uuid,data from en.metadata where id=? and owner=?"; + $sql="select uuid,data from metadata where id=? and owner=?"; $sth=$this->wdb->prepare($sql); $sth->execute(array($id,$u_id)); $row=$sth->fetch(); @@ -2372,24 +2372,28 @@ class AuthorController extends Zend_Controller_Action } // 保存数据作者信息 - $sql="insert into mdauthor (uuid,userid,ts_activated,status) values(?,?,now(),1)"; - $this->db->query($sql,array($row['uuid'],$u_id)); + // 仅保存不存在的作者信息 + $sql="insert into mdauthor (uuid,userid,ts_activated,status) values(?,?,now(),1) where not exists + (select * from mdauthor where uuid=? and userid=?)"; + $this->db->query($sql,array($row['uuid'],$u_id),$row['uuid'],$u_id)); // 2. 保存变化记录 save changelog & userid for the latest version - $sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid=? order by ts_created desc limit 1)"; + $sql = "UPDATE en.mdversion SET changelog=?,userid=? WHERE id in (select id from en.mdversion where uuid=? order by ts_created desc limit 1)"; $this->db->query($sql,array($changelog,$u_id,$row['uuid'])); - file_get_contents("http://ftp2.westgis.ac.cn/proftp_upload.php?uuid=".$row['uuid']."&filelist=1"); + //暂时不导入文件信息(英文版数据的文件信息都在中文版导入过) + //file_get_contents("http://ftp2.westgis.ac.cn/proftp_upload.php?uuid=".$row['uuid']."&filelist=1"); + // 3. 保存数据评审状态 //导入元数据 @$iso->saveDB($this->db); //进入评审库 - $sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from geonetworkmetadata where id=?"; + $sql="insert into en.mdstatus (uuid,status,userid) select uuid,0,? from en.geonetworkmetadata where id=?"; $this->db->query($sql,array($u_id,$id)); //email to admin $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); - $mailtp=new EmailText($this->db,"metadata-new-admin",array( + $mail->setFrom($this->view->config->service->email,'CARD Support Team'); + $mailtp=new EmailText($this->db,"metadata-new-admin-en",array( 'user' => $user->username, 'uuid' => $iso->uuid, 'email'=> $user->email, @@ -2410,8 +2414,8 @@ class AuthorController extends Zend_Controller_Action unset($mailtp); //email to author $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); - $mailtp=new EmailText($this->db,"metadata-new-author",array( + $mail->setFrom($this->view->config->service->email,'CARD Support Team'); + $mailtp=new EmailText($this->db,"metadata-new-author-en",array( 'user' => $user->username, 'uuid' => $iso->uuid, 'email'=> $user->email, @@ -2429,11 +2433,11 @@ class AuthorController extends Zend_Controller_Action } @$mail->send(); - $data = array("commited"=>1,"error"=>$this->alertbox('ok','该版本已经成功提交,请等待数据中心进一步处理!')); + $data = array("commited"=>1,"error"=>$this->alertbox('ok','The submit is successful, please wait for review.')); $this->jsonexit($data); return true; }catch(Exception $e) { - $msg = "提交失败,请确认权限后重试"; + $msg = "Aborted, Please contact the CARD Support Team."; if($this->debug>0) {$msg .= $e->getMessage();} $data = array("error"=>$this->alertbox('error',$msg)); @@ -2460,7 +2464,7 @@ class AuthorController extends Zend_Controller_Action return true; } //安全检查: uuid必须是当前用户且为新建数据 - $sql="select * from geonetworkmetadata where uuid=? and uuid not in (select uuid from metadata) and owner=?"; + $sql="select * from en.geonetworkmetadata where uuid=? and uuid not in (select uuid from metadata) and owner=?"; $sth=$this->db->prepare($sql); $sth->execute(array($uuid,$u_id)); $row=$sth->fetch();