From b39414f83b6c358c5ffd6ae2f5e4a6abcc0c3630 Mon Sep 17 00:00:00 2001 From: wlx Date: Thu, 1 Jul 2010 13:22:59 +0000 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E8=81=94=E7=B3=BB=E4=BA=BA=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E7=89=B9=E6=AE=8A=E5=A4=84=E7=90=86=EF=BC=8C=E5=AF=B9?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E8=81=94=E7=B3=BB=E4=BA=BA=E7=9A=84=E5=A4=84?= =?UTF-8?q?=E7=90=86=E8=BF=98=E4=B8=8D=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/DataController.php | 20 +++++++++++++------ .../admin/views/scripts/index/index.phtml | 1 + 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index 8c9fe1d5..0e6efa9d 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -43,6 +43,11 @@ class Admin_DataController extends Zend_Controller_Action } $this->view->msg='成功同步元数据!'; } elseif ($source=="watergn" && empty($uuid) ) { + //首先删除所有的黑河试验数据 + $sql="delete from metadata where source='0595169a-279e-4b95-819f-129d0ba4280d'"; + $this->db->query($sql); + $sql="delete from responsible where id not in (select distinct(resid) from role)"; + $this->db->query($sql); //同步黑河遥感实验的元数据 $sql="select uuid,data,source from watergn where schemaid='iso19115'"; $rs=$this->db->fetchAll($sql); @@ -700,6 +705,9 @@ class Admin_DataController extends Zend_Controller_Action //先删除已有元数据,然后再插入新数据 $sql="delete from metadata where uuid=?"; $this->db->query($sql,array($iso->uuid)); + //删除所有未用到的responsible数据 + $sql="delete from responsible where id not in (select distinct(resid) from role)"; + $this->db->query($sql); $row=$md->createRow(); $trow=$thumb->createRow(); $row->uuid=$iso->uuid; @@ -827,25 +835,25 @@ class Admin_DataController extends Zend_Controller_Action foreach($inds as $ind) { $sql="select id from responsible where individual=? and organisation=?"; - $row=$this->db->fetchRow($sql,array($ind,$au['organisation'])); + $row=$this->db->fetchRow($sql,array(trim($ind),trim($au['organisation']))); if (!$row) { $sql="insert into responsible (individual,organisation,position,delivery,phone,email,city,country,administrative,postal) values(?,?,?,?,?,?,?,?,?,?)"; - $this->db->query($sql,array($ind,$au['organisation'],$au['position'],$au['delivery'],$au['phone'],$au['email'],$au['city'],$au['country'],$au['administrative'],$au['postal'])); - } else { + $this->db->query($sql,array(trim($ind),trim($au['organisation']),trim($au['position']),trim($au['delivery']),trim($au['phone']),trim($au['email']),trim($au['city']),trim($au['country']),trim($au['administrative']),trim($au['postal']))); + } elseif (count($inds)==1) { //deal email address if (($au['email']) && empty($row->email)) { $sql="update responsible set email=? where id=?"; - $this->db->query($sql,array($au['email'],$row->id)); + $this->db->query($sql,array(trim($au['email']),$row->id)); } } $sql="select id from responsible where individual=? and organisation=?"; - $row=$this->db->fetchRow($sql,array($ind,$au['organisation'])); + $row=$this->db->fetchRow($sql,array(trim($ind),trim($au['organisation']))); if ($row->id>0) { $sql="insert into role (resid,uuid,role) values(?,?,?)"; - $this->db->query($sql,array($row->id,$iso->uuid,$au['role'])); + $this->db->query($sql,array($row->id,$iso->uuid,trim($au['role']))); } } } diff --git a/application/admin/views/scripts/index/index.phtml b/application/admin/views/scripts/index/index.phtml index fef718e5..08c83777 100755 --- a/application/admin/views/scripts/index/index.phtml +++ b/application/admin/views/scripts/index/index.phtml @@ -19,6 +19,7 @@
  • 数据管理
  • WATER元数据处理工具
  • 数据测试管理
  • +
  • 数据库工具