fix #332, 发布数据时同时更新数据版本信息

This commit is contained in:
wlx 2012-05-14 15:08:39 +00:00
parent 9566e9ed53
commit f693bc98c0
1 changed files with 10 additions and 3 deletions

View File

@ -77,7 +77,7 @@ class Admin_ReviewController extends Zend_Controller_Action
{return "专家接受邀请";} {return "专家接受邀请";}
else if($status==4) else if($status==4)
{return "专家反馈";} {return "专家反馈";}
else if($status==5) else if($status>=5)
{return "已发布";} {return "已发布";}
else else
{return "";} {return "";}
@ -99,7 +99,8 @@ class Admin_ReviewController extends Zend_Controller_Action
2, //开始邀请专家,送审阶段 2, //开始邀请专家,送审阶段
3, //专家接受邀请,在审阶段 3, //专家接受邀请,在审阶段
4, //专家反馈,在审 4, //专家反馈,在审
5 //评审结束,发布 5, //评审结束,发布
6,7
); );
if(empty($id) || !isset($status) || !in_array($status,$stvalues)) if(empty($id) || !isset($status) || !in_array($status,$stvalues))
{ {
@ -656,7 +657,13 @@ class Admin_ReviewController extends Zend_Controller_Action
if($this->changestatus($id,5)) if($this->changestatus($id,5))
{ {
$this->messenger->addMessage('操作成功:该元数据成功发布'); $this->messenger->addMessage('操作成功:该元数据成功发布');
//发布正式版本
$sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid in (select uuid from mdstatus where id=?) order by ts_created desc limit 1)";
$this->db->query($sql,array('发布第一个正式版本 version 1.0',$userid,$id));
//删除所有的中间版本
$sql="delete from mdversion where changelog is null and uuid in (select uuid from mdstatus where id=?)";
$this->db->query($sql,array($id));
//email message //email message
$mail=new WestdcMailer($this->view->config->smtp); $mail=new WestdcMailer($this->view->config->smtp);
$sql="select m.uuid,m.title from metadata m left join mdstatus s on m.uuid=s.uuid where s.id='$id'"; $sql="select m.uuid,m.title from metadata m left join mdstatus s on m.uuid=s.uuid where s.id='$id'";