diff --git a/application/admin/controllers/DownController.php b/application/admin/controllers/DownController.php index e7c9c8ed..51a06588 100644 --- a/application/admin/controllers/DownController.php +++ b/application/admin/controllers/DownController.php @@ -119,8 +119,9 @@ class Admin_DownController extends Zend_Controller_Action // 1. 处理有数据作者且自行管理的数据并且未被0处理过的 $sql="select u.email,m.title,d.uuid,a.activation from dataorder d left join mdstatus s on d.uuid=s.uuid left join users u on s.userid=u.id left join metadata m on m.uuid=d.uuid left join mdauthor a on a.uuid=d.uuid - where d.offlineappid=? and s.status=6 and a.userid=s.userid and d.uuid not in (".substr($uuid_done,0,-1).") - order by u.email,m.title"; + where d.offlineappid=? and s.status=6 and a.userid=s.userid "; + if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") "; + $sql.=" order by u.email,m.title"; $rows=$this->db->fetchAll($this->db->quoteInto($sql,$start)); $tmp_email=''; $data=''; @@ -170,7 +171,9 @@ class Admin_DownController extends Zend_Controller_Action // 2. 处理委托数据中心进行管理的数据 $sql="select m.title,d.uuid from dataorder d left join mdstatus s on d.uuid=s.uuid left join metadata m on m.uuid=d.uuid left join datasource ds on ds.uuid=d.uuid left join source on ds.sourceid=source.id - where d.offlineappid=? and (s.status=7 or source.admin_status=2) and d.uuid not in (".substr($uuid_done,0,-1).") order by m.title"; + where d.offlineappid=? and (s.status=7 or source.admin_status=2) "; + if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") "; + $sql.=" order by m.title"; $rows=$this->db->fetchAll($this->db->quoteInto($sql,$start)); $data=""; foreach($rows as $row) @@ -202,9 +205,9 @@ class Admin_DownController extends Zend_Controller_Action //发送管理邮件同时建议用户认证为数据的作者,可以有更多的管理选择,同时邮件中应该有详细的说明为什么会收到此邮件 $sql="select distinct res.email,d.uuid,m.title,role.role from dataorder d left join role on d.uuid=role.uuid left join responsible res on role.resid=res.id left join metadata m on d.uuid=m.uuid where length(res.email)>4 and d.offlineappid=? - and role.role in ('pointOfContact','custodian','resourceProvider','owner','distributor','publisher','author') - and d.uuid not in (".substr($uuid_done,0,-1).") - order by m.title,res.email"; + and role.role in ('pointOfContact','custodian','resourceProvider','owner','distributor','publisher','author')"; + if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") "; + $sql.=" order by m.title,res.email"; $rows=$this->db->fetchAll($this->db->quoteInto($sql,$start)); unset($addrs); $md=array();