确认了委托状态为6,并同步修改userid

This commit is contained in:
wlx 2012-05-10 13:10:22 +00:00
parent 7e8a7d0f82
commit 1ea9fbccc0
2 changed files with 8 additions and 8 deletions

View File

@ -2795,17 +2795,17 @@ class AuthorController extends Zend_Controller_Action
$this->view->metadata = $row; $this->view->metadata = $row;
//确认一下用户有权限如果直接使用update语句无法得到已更改过的状态 //确认一下用户有权限如果直接使用update语句无法得到已更改过的状态
//只要是认证后的数据作者,都可以修改数据的委托状态
$sql = "SELECT * FROM mdstatus $sql = "SELECT * FROM mdstatus
WHERE uuid=? AND userid=? AND (status=? OR status=?)"; WHERE uuid=? AND userid in (select userid from mdauthor where status=1 and uuid=?) AND status=?";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($uuid,$uid,5,6)); $sth->execute(array($uuid,$uuid,6));
$mds = $sth->fetch(); $mds = $sth->fetch();
if(!empty($mds['id'])) if(!empty($mds['id']))
{ {
$sql = "UPDATE mdstatus SET status=7,ts_changed='now()' WHERE uuid='$uuid' AND userid=$uid"; $sql = "UPDATE mdstatus SET status=7,ts_changed='now()',userid=$uid WHERE uuid='$uuid'";
if($this->db->exec($sql)) if($this->db->exec($sql))
{ {
$this->view->info = "委托成功!"; $this->view->info = "委托成功!";
@ -2845,15 +2845,15 @@ class AuthorController extends Zend_Controller_Action
$this->view->metadata = $row; $this->view->metadata = $row;
$sql = "SELECT * FROM mdstatus $sql = "SELECT * FROM mdstatus
WHERE uuid=? AND userid=? AND status=?"; WHERE uuid=? AND userid in (select userid from mdauthor where status=1 and uuid=?) AND status=?";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($uuid,$uid,7)); $sth->execute(array($uuid,$uuid,7));
$mds = $sth->fetch(); $mds = $sth->fetch();
if(!empty($mds['id'])) if(!empty($mds['id']))
{ {
$sql = "UPDATE mdstatus SET status=6,ts_changed='now()' WHERE uuid='$uuid' AND userid=$uid"; $sql = "UPDATE mdstatus SET status=6,ts_changed='now()',userid=$uid WHERE uuid='$uuid'";
if($this->db->exec($sql)) if($this->db->exec($sql))
{ {
$this->view->info = "取消委托成功!"; $this->view->info = "取消委托成功!";

View File

@ -44,7 +44,7 @@ $this->breadcrumb()->setSeparator(' > ');
<a href="/author/qa/uuid/<?php echo $item['uuid']; ?>">QA</a> | <a href="/author/qa/uuid/<?php echo $item['uuid']; ?>">QA</a> |
<a href="/author/news/uuid/<?php echo $item['uuid']; ?>">新闻</a> | <a href="/author/news/uuid/<?php echo $item['uuid']; ?>">新闻</a> |
<a href="/author/viewauthors/uuid/<?php echo $item['uuid']; ?>">所有作者</a> <a href="/author/viewauthors/uuid/<?php echo $item['uuid']; ?>">所有作者</a>
<?php if($item['mdstatus']==5 || $item['mdstatus']==6) {?> <?php if($item['mdstatus']==6) {?>
| <a href="/author/delegate/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定将该数据委托至数据中心?');">委托</a> | <a href="/author/delegate/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定将该数据委托至数据中心?');">委托</a>
<?php } if($item['mdstatus']==7){ ?> <?php } if($item['mdstatus']==7){ ?>
| <a href="/author/delegate/ac/cancel/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定取消该数据的委托?');">取消委托</a> | <a href="/author/delegate/ac/cancel/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定取消该数据的委托?');">取消委托</a>