修复前台数据作者提交数据时的“错误入口”问题

This commit is contained in:
wlx 2015-12-29 08:31:43 +08:00
parent ffe2f305aa
commit 6a59a692f2
1 changed files with 6 additions and 8 deletions

View File

@ -2337,11 +2337,9 @@ class AuthorController extends Zend_Controller_Action
} }
// 1. 权限认定当前用户必须和其owner相同 // 1. 权限认定当前用户必须和其owner相同
// 数据应当没有评审状态,没有作者信息 // 数据应当没有评审状态,没有作者信息, 此两项信息使用条件插入,省略判断。
$sql="select gn.id from geonetworkmetadata gn $sql="select gn.id from geonetworkmetadata gn
left join mdstatus s on gn.uuid=s.uuid where gn.id=?";
left join mdauthor a on s.uuid=a.uuid
where s.id is not null and a.id is not null and gn.id=?";
$sth=$this->db->prepare($sql); $sth=$this->db->prepare($sql);
$sth->execute(array($id)); $sth->execute(array($id));
$row=$sth->fetch(); $row=$sth->fetch();
@ -2373,8 +2371,8 @@ class AuthorController extends Zend_Controller_Action
} }
// 保存数据作者信息 // 保存数据作者信息
$sql="insert into mdauthor (uuid,userid,ts_activated,status) values(?,?,now(),1)"; $sql="insert into mdauthor (uuid,userid,ts_activated,status) select ?,?,now(),1 where not exists (select id from mdauthor where uuid=? and userid=?)";
$this->db->query($sql,array($row['uuid'],$u_id)); $this->db->query($sql,array($row['uuid'],$u_id,$row['uuid'],$u_id));
// 2. 保存变化记录 save changelog & userid for the latest version // 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 mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid=? order by ts_created desc limit 1)";
@ -2384,8 +2382,8 @@ class AuthorController extends Zend_Controller_Action
//导入元数据 //导入元数据
@$iso->saveDB($this->db); @$iso->saveDB($this->db);
//进入评审库 //进入评审库
$sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from geonetworkmetadata where id=?"; $sql="insert into mdstatus (uuid,status,userid) select ?,0,? where not exists (select id from mdstatus where uuid=? and userid=?)";
$this->db->query($sql,array($u_id,$id)); $this->db->query($sql,array($row['uuid'],$u_id,$row['uuid'],$u_id));
//email to admin //email to admin
$mail=new WestdcMailer($this->view->config->smtp); $mail=new WestdcMailer($this->view->config->smtp);