对联系人进行特殊处理,对多个联系人的处理还不完善

This commit is contained in:
wlx 2010-07-01 13:22:59 +00:00
parent fc71b1912a
commit b39414f83b
2 changed files with 15 additions and 6 deletions

View File

@ -43,6 +43,11 @@ class Admin_DataController extends Zend_Controller_Action
} }
$this->view->msg='成功同步元数据!'; $this->view->msg='成功同步元数据!';
} elseif ($source=="watergn" && empty($uuid) ) { } 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'"; $sql="select uuid,data,source from watergn where schemaid='iso19115'";
$rs=$this->db->fetchAll($sql); $rs=$this->db->fetchAll($sql);
@ -700,6 +705,9 @@ class Admin_DataController extends Zend_Controller_Action
//先删除已有元数据,然后再插入新数据 //先删除已有元数据,然后再插入新数据
$sql="delete from metadata where uuid=?"; $sql="delete from metadata where uuid=?";
$this->db->query($sql,array($iso->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(); $row=$md->createRow();
$trow=$thumb->createRow(); $trow=$thumb->createRow();
$row->uuid=$iso->uuid; $row->uuid=$iso->uuid;
@ -827,25 +835,25 @@ class Admin_DataController extends Zend_Controller_Action
foreach($inds as $ind) foreach($inds as $ind)
{ {
$sql="select id from responsible where individual=? and organisation=?"; $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) if (!$row)
{ {
$sql="insert into responsible (individual,organisation,position,delivery,phone,email,city,country,administrative,postal) values(?,?,?,?,?,?,?,?,?,?)"; $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'])); $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'])));
} else { } elseif (count($inds)==1) {
//deal email address //deal email address
if (($au['email']) && empty($row->email)) if (($au['email']) && empty($row->email))
{ {
$sql="update responsible set email=? where id=?"; $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=?"; $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) if ($row->id>0)
{ {
$sql="insert into role (resid,uuid,role) values(?,?,?)"; $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'])));
} }
} }
} }

View File

@ -19,6 +19,7 @@
<li><a href="/admin/data">数据管理</a></li> <li><a href="/admin/data">数据管理</a></li>
<li><a href="/admin/watermd">WATER元数据处理工具</a></li> <li><a href="/admin/watermd">WATER元数据处理工具</a></li>
<li><a href="/admin/test">数据测试管理</a></li> <li><a href="/admin/test">数据测试管理</a></li>
<li><a href="/admin/dbtool">数据库工具</a></li>
</ul> </ul>
</div> </div>