fix #333, 新建元数据自动进入数据评审库,且评审状态为已接受

This commit is contained in:
wlx 2012-05-15 03:26:35 +00:00
parent ac2ce1d680
commit 73ab9e1e1c
1 changed files with 11 additions and 11 deletions

View File

@ -33,12 +33,17 @@ class Admin_DataController extends Zend_Controller_Action
$uuid=trim($this->_request->getParam('uuid'));
if ($source=="geonetwork" && empty($uuid) ) {
//从geonetwork向WESTDC同步
//对所有的新数据增加评审状态
$sql="insert into mdstatus (uuid,status,ts_accepted,userid) select uuid,1,now(),?
from geonetworkmetadata gn where uuid not in (select uuid from mdstatus)";
$userid = Zend_Auth::getInstance()->getIdentity()->id;
$this->db->query($sql,array($userid));
$sql="select uuid,data,source from geonetworkmetadata where schemaid='iso19115'";
$rs=$this->db->fetchAll($sql);
foreach($rs as $gmd) {
$this->import($gmd->data);
$this->db->query("update metadata set source=? where uuid=?",array($gmd->source,$gmd->uuid));
}
$this->db->query("update metadata set source=? where uuid=?",array($gmd->source,$gmd->uuid));
}
$this->view->msg='成功同步元数据!';
} elseif ($source=="watergn" && empty($uuid) ) {
//首先删除所有的黑河试验数据
@ -75,7 +80,10 @@ class Admin_DataController extends Zend_Controller_Action
$sql=$this->db->quoteInto("select data,source from geonetworkmetadata where uuid=?",$uuid);
if ($rs=$this->db->fetchRow($sql)) {
$this->import($rs->data);
$this->db->exec($this->db->quoteInto("update metadata set source=? where uuid='$uuid'",$rs->source));
$this->db->exec($this->db->quoteInto("update metadata set source=? where uuid='$uuid'",$rs->source));
$userid = Zend_Auth::getInstance()->getIdentity()->id;
$this->db->query("insert into mdstatus (uuid,status,ts_accepted,userid) select uuid,1,now(),?
from geonetworkmetadata gn where uuid not in (select uuid from mdstatus) and uuid=?",array($userid,$uuid));
$this->view->msg='成功同步元数据:'.$uuid;
} else $this->view->msg='不存在此元数据:'.$uuid;
} elseif (!empty($uuid) && isset($_POST['gnsubmit'])) {
@ -98,14 +106,6 @@ class Admin_DataController extends Zend_Controller_Action
$this->db->query("update metadata set source=? where uuid=?",array($rs->source,$uuid));
$this->view->msg='成功同步元数据:'.$uuid;
} else $this->view->msg='不存在此元数据:'.$uuid;
} elseif (!empty($uuid)) {
//同步单条元数据
$sql=$this->db->quoteInto("select data,source from geonetworkmetadata where uuid=?",$uuid);
if ($rs=$this->db->fetchRow($sql)) {
$this->import($rs->data);
$this->db->query("update metadata set source=? where uuid=?",array($rs->source,$uuid));
$this->view->msg='成功同步元数据:'.$uuid;
} else $this->view->msg='不存在此元数据:'.$uuid;
} elseif ($list=='westdc') {
$sql="select uuid,title from metadata where uuid not in (select uuid from geonetworkmetadata where schemaid='iso19115')";
$this->view->metadata=$this->db->query($sql);