明确了数据版本提交的流程
This commit is contained in:
parent
8328fff993
commit
6236ca494d
|
@ -1586,7 +1586,7 @@ class AuthorController extends Zend_Controller_Action
|
|||
|
||||
$sql = "DELETE FROM mdversion v
|
||||
USING mdauthor a
|
||||
WHERE v.id=? AND a.userid=? AND a.status=1";
|
||||
WHERE v.uuid=a.uuid and v.id=? AND a.userid=? AND a.status=1";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$ex = $sth -> execute(array($id,$u_id));
|
||||
|
||||
|
@ -1626,36 +1626,28 @@ class AuthorController extends Zend_Controller_Action
|
|||
return true;
|
||||
}
|
||||
|
||||
$db = Zend_Db::factory('Pdo_Pgsql', array(
|
||||
'host' => 'localhost',
|
||||
'username' => 'postgres',
|
||||
'password' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
||||
'dbname' => 'geonetwork',
|
||||
'persistent' => true
|
||||
));
|
||||
|
||||
$this->wdb=Zend_Db::factory($this->view->config->geonetwork);
|
||||
$sql = "SELECT v.xml,v.uuid FROM mdversion v
|
||||
LEFT JOIN mdauthor a ON a.uuid=v.uuid
|
||||
WHERE v.id=? AND a.userid=? AND a.status=1";
|
||||
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth ->execute(array($id,$u_id));
|
||||
$row = $sth->fetch();
|
||||
|
||||
$sql = "SELECT data FROM metadata WHERE uuid=?";
|
||||
$sth = $db->prepare($sql);
|
||||
$sth = $this->wdb->prepare($sql);
|
||||
$sth ->execute(array($row['uuid']));
|
||||
$row_geo = $sth->fetch();
|
||||
|
||||
if($row['xml']==$row_geo['data'])
|
||||
{
|
||||
$data = array("error"=>$this->alertbox('warning','恢复失败,目前两个版本中的内容相同'));
|
||||
$data = array("error"=>$this->alertbox('warning','无须恢复,元数据相同'));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
$sql = "UPDATE metadata SET data=? WHERE uuid=?";
|
||||
$sth = $db->prepare($sql);
|
||||
$sth = $this->wdb->prepare($sql);
|
||||
$ex = $sth ->execute(array($row['xml'],$row['uuid']));
|
||||
|
||||
if($ex)
|
||||
|
@ -1694,14 +1686,61 @@ class AuthorController extends Zend_Controller_Action
|
|||
return true;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM mdstatus s
|
||||
LEFT JOIN mdversion v ON v.uuid=s.uuid
|
||||
LEFT JOIN mdauthor a ON a.uuid=v.uuid
|
||||
WHERE v.id=? AND a.userid=? AND a.status=1";
|
||||
$changelog = $this->_request->getParam('changelog');
|
||||
if(empty($changelog))
|
||||
{
|
||||
$data = array("error"=>$this->alertbox('warning','请输入变更信息'));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 1. 权限认定
|
||||
$sql="select a.* from mdauthor a left join mdversion v on a.uuid=v.uuid
|
||||
where a.status=1 and a.userid=? and v.id=?";
|
||||
$sth=$this->db->prepare($sql);
|
||||
$sth->execute(array($id,$u_id));
|
||||
$sth->execute(array($u_id,$id));
|
||||
$row=$sth->fetch();
|
||||
if (empty($row))
|
||||
{
|
||||
$data = array("error"=>'无权限修改数据');
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 2. 获取数据评审状态
|
||||
$sql = "SELECT s.* FROM mdstatus s left join mdversion v on s.uuid=v.uuid WHERE v.id=?";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($id));
|
||||
$row = $sth->fetch();
|
||||
|
||||
if (empty($row)) //无对应记录
|
||||
{
|
||||
// do
|
||||
}
|
||||
else if ($row['id']==-1) //取消发布的数据
|
||||
{
|
||||
//do something.
|
||||
}
|
||||
else if ($row['id']==0) //初始状态
|
||||
{
|
||||
//do
|
||||
}
|
||||
else if ($row['id']==1)//接收
|
||||
{
|
||||
//
|
||||
}
|
||||
else if ($row['id']==2)//已发送过外审邮件,需由编辑告知变化信息
|
||||
{
|
||||
//do
|
||||
}
|
||||
else if ($row['id']==3 || $row['id']==4)//专家在审理中
|
||||
{
|
||||
//do
|
||||
}
|
||||
else if ($row['id']==5)//数据已经发布,再次修改后将只通知管理员,保留发布状态
|
||||
{
|
||||
//do
|
||||
}
|
||||
|
||||
if(!empty($row['id']))
|
||||
{
|
||||
|
@ -1710,16 +1749,10 @@ class AuthorController extends Zend_Controller_Action
|
|||
return true;
|
||||
}
|
||||
|
||||
$changelog = $this->_request->getParam('changelog');
|
||||
if(empty($changelog))
|
||||
{
|
||||
$data = array("error"=>$this->alertbox('warning','请输入变更信息'));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
$sql = "UPDATE mdversion SET changelog=? WHERE id=?";
|
||||
|
||||
$sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id=?";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$ex_changelog = $sth->execute(array($changelog,$id));
|
||||
$ex_changelog = $sth->execute(array($changelog,$u_id,$id));
|
||||
|
||||
if($ex_changelog){
|
||||
|
||||
|
|
Loading…
Reference in New Issue