修复错误入口问题

This commit is contained in:
wlx 2015-12-29 14:43:54 +08:00
parent 87f796e7e9
commit 0831b3d8aa
1 changed files with 4 additions and 19 deletions

View File

@ -2334,21 +2334,6 @@ class AuthorController extends Zend_Controller_Action
}
// 1. 权限认定当前用户必须和其owner相同
// 数据应当没有评审状态,没有作者信息
$sql="select gn.id from geonetworkmetadata gn
left join mdstatus s on gn.uuid=s.uuid
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->execute(array($id));
$row=$sth->fetch();
if (!empty($row))
{
$data = array("error"=>'错误的入口');
$this->jsonexit($data);
return true;
}
$sql="select uuid,data from metadata where id=? and owner=?";
$sth=$this->wdb->prepare($sql);
$sth->execute(array($id,$u_id));
@ -2370,8 +2355,8 @@ 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 id 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)";
@ -2381,8 +2366,8 @@ class AuthorController extends Zend_Controller_Action
//导入元数据
@$iso->saveDB($this->db);
//进入评审库
$sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from geonetworkmetadata where id=?";
$this->db->query($sql,array($u_id,$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($row['uuid'],$u_id,$row['uuid'],$u_id));
//email to admin
$mail=new WestdcMailer($this->view->config->smtp);