diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index faec4335..d7b58e2a 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -2322,7 +2322,7 @@ class Admin_DataController extends Zend_Controller_Action if (!empty($uuid) && empty($ac)) { //view the versions of the data - $sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id,u.username,u.realname,g.id as gid FROM mdversion v + $sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id,u.username,u.realname,g.id as gid FROM en.mdversion v LEFT JOIN en.metadata md ON md.uuid=v.uuid left join users u on v.userid=u.id left join en.geonetworkmetadata g on md.uuid=g.uuid @@ -2345,7 +2345,7 @@ class Admin_DataController extends Zend_Controller_Action //查看所有版本列表 else if((empty($ac) && empty($uuid))|| $ac=='list') { - $sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id,u.username,u.realname FROM mdversion v + $sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id,u.username,u.realname FROM en.mdversion v LEFT JOIN en.metadata md ON md.uuid=v.uuid left join users u on v.userid=u.id WHERE md.title IS NOT NULL @@ -2369,7 +2369,7 @@ class Admin_DataController extends Zend_Controller_Action $keywords = $this->_request->getParam('q'); if(!empty($keywords)) $this->view->q = $keywords; - $sql = "SELECT md.title,md.uuid,count(v.id) as c FROM mdversion v + $sql = "SELECT md.title,md.uuid,count(v.id) as c FROM en.mdversion v LEFT JOIN en.metadata md ON md.uuid=v.uuid WHERE md.title IS NOT NULL"; if(!empty($keywords)) @@ -2412,7 +2412,7 @@ class Admin_DataController extends Zend_Controller_Action return true; } - $sql = "DELETE FROM mdversion WHERE id=?"; + $sql = "DELETE FROM en.mdversion WHERE id=?"; $sth = $this->db->prepare($sql); $ex = $sth -> execute(array($id)); @@ -2453,7 +2453,7 @@ class Admin_DataController extends Zend_Controller_Action } $this->wdb=Zend_Db::factory($this->view->config->geonetwork); - $sql = "SELECT v.xml,v.uuid FROM mdversion v + $sql = "SELECT v.xml,v.uuid FROM en.mdversion v WHERE v.id=?"; $sth = $this->db->prepare($sql); $sth ->execute(array($id)); @@ -2521,17 +2521,17 @@ class Admin_DataController extends Zend_Controller_Action // 1. 权限认定 --skip // 2. 保存变化记录 save changelog & userid - $sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id=?"; + $sql = "UPDATE en.mdversion SET changelog=?,userid=? WHERE id=?"; $this->db->query($sql,array($changelog,$u_id,$id)); // 3. 获取数据评审状态 - $sql = "SELECT s.*,v.xml,m.title FROM mdstatus s left join mdversion v on s.uuid=v.uuid + $sql = "SELECT s.*,v.xml,m.title FROM en.mdstatus s left join en.mdversion v on s.uuid=v.uuid left join en.metadata m on s.uuid=m.uuid WHERE v.id=?"; $sth = $this->db->prepare($sql); $sth->execute(array($id)); $row = $sth->fetch(); - $sql="select * from xunsearch where uuid=?"; + $sql="select * from en.xunsearch where uuid=?"; $sth = $this->db->prepare($sql); $sth->execute(array($row['uuid'])); $data_search = $sth->fetch(); @@ -2540,7 +2540,7 @@ class Admin_DataController extends Zend_Controller_Action if (empty($row)) //无对应记录 { - $sql="select m.id from en.metadata m left join mdversion v on m.uuid=v.uuid where v.id=?"; + $sql="select m.id from en.metadata m left join en.mdversion v on m.uuid=v.uuid where v.id=?"; $sth=$this->db->prepare($sql); $sth->execute(array($id)); $mrow=$sth->fetch(); @@ -2550,7 +2550,7 @@ class Admin_DataController extends Zend_Controller_Action $iso=new ISO19115(); $iso->saveDB($this->db,$row['xml']); //进入评审库 - $sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from mdversion where id=?"; + $sql="insert into en.mdstatus (uuid,status,userid) select uuid,0,? from en.mdversion where id=?"; $this->db->query($sql,array($u_id,$id)); //email to admin @@ -2604,10 +2604,10 @@ class Admin_DataController extends Zend_Controller_Action $iso=new ISO19115(); $iso->saveDB($this->db,$row['xml']); //移除中间版本 - $sql="delete from mdversion where uuid in (select uuid from mdversion where id=?) and changelog is null"; + $sql="delete from en.mdversion where uuid in (select uuid from en.mdversion where id=?) and changelog is null"; $this->db->query($sql,array($id)); //修改评审状态为发布,且由其提交的用户进行管理 - $sql="insert into mdstatus (uuid,status,userid) select uuid,6,? from mdversion where id=?"; + $sql="insert into en.mdstatus (uuid,status,userid) select uuid,6,? from en.mdversion where id=?"; $this->db->query($sql,array($u_id,$id)); //email to admin & author @@ -2782,7 +2782,7 @@ class Admin_DataController extends Zend_Controller_Action $iso=new ISO19115(); $iso->saveDB($this->db,$row['xml']); //移除中间版本 - $sql="delete from mdversion where uuid in (select uuid from mdversion where id=?) and changelog is null"; + $sql="delete from en.mdversion where uuid in (select uuid from en.mdversion where id=?) and changelog is null"; $this->db->query($sql,array($id)); //email to admin & author @@ -2833,7 +2833,7 @@ class Admin_DataController extends Zend_Controller_Action return true; } - $sql = "SELECT v.uuid,md.title FROM mdversion v + $sql = "SELECT v.uuid,md.title FROM en.mdversion v LEFT JOIN en.metadata md ON v.uuid=md.uuid WHERE v.id=?"; $sth = $this->db->prepare($sql); @@ -2842,15 +2842,15 @@ class Admin_DataController extends Zend_Controller_Action $row = $sth->fetch(); if ($ac=='diff') { - $sql = "SELECT v.* FROM mdversion v - WHERE v.uuid=? and v.ts_created<=(select ts_created from mdversion where id=?) + $sql = "SELECT v.* FROM en.mdversion v + WHERE v.uuid=? and v.ts_created<=(select ts_created from en.mdversion where id=?) ORDER BY v.ts_created DESC LIMIT ?"; $sth = $this->db->prepare($sql); $sth -> execute(array($row['uuid'],$id,2)); } else { - $sql = "SELECT v.* FROM mdversion v - WHERE v.uuid=? and (v.id=? or (v.ts_created<(select ts_created from mdversion where id=?) and changelog is not null)) + $sql = "SELECT v.* FROM en.mdversion v + WHERE v.uuid=? and (v.id=? or (v.ts_created<(select ts_created from en.mdversion where id=?) and changelog is not null)) ORDER BY v.ts_created DESC LIMIT ?"; $sth = $this->db->prepare($sql); diff --git a/application/admin/controllers/ReviewController.php b/application/admin/controllers/ReviewController.php index 1f4c5b53..0f99e0f1 100644 --- a/application/admin/controllers/ReviewController.php +++ b/application/admin/controllers/ReviewController.php @@ -760,7 +760,7 @@ class Admin_ReviewController extends Zend_Controller_Action //仅对单条数据发送email信息 if (is_numeric($ids)) { - $sql="select distinct u.email,m.title,m.uuid from mdstatus s left join en.metadata m on s.uuid=m.uuid + $sql="select distinct u.email,m.title,m.uuid from en.mdstatus s left join en.metadata m on s.uuid=m.uuid right join mdauthor a on s.uuid=a.uuid left join users u on a.userid=u.id where s.id=? order by u.email"; $rs=$this->db->query($sql,array($ids)); $rows=$rs->fetchAll();