提高数据蓝中删除的安全性,添加状态2可以取消的功能

This commit is contained in:
wlx 2012-05-16 02:00:29 +00:00
parent 9defd381ad
commit ef3b13b913
2 changed files with 6 additions and 5 deletions

View File

@ -1167,7 +1167,7 @@ class DataController extends Zend_Controller_Action
} }
} elseif ($del) { } elseif ($del) {
//删除数据申请 //删除数据申请
$sql=$this->db->quoteInto("delete from dataorder where id=?",$del); $sql=$this->db->quoteInto("delete from dataorder where userid=".$userid." and status in (1,2) and id=?",$del);
$this->db->query($sql); $this->db->query($sql);
$this->_redirect('/data/order'); $this->_redirect('/data/order');
} elseif ($apply) { } elseif ($apply) {
@ -1187,7 +1187,7 @@ class DataController extends Zend_Controller_Action
} else { } else {
$sql="update dataorder set ts_approved=now() where status=0 and userid=? and id=?"; $sql="update dataorder set ts_approved=now() where status=0 and userid=? and id=?";
$this->db->query($sql,array($userid,(int)$finish)); $this->db->query($sql,array($userid,(int)$finish));
$sql="update ftpuser set datacount=datacount-1 where userid=?"; $sql="update ftpuser set datacount=datacount-1 where userid=? and datacount>0";
$this->db->query($sql,array($userid)); $this->db->query($sql,array($userid));
} }
} elseif ($cancel) { } elseif ($cancel) {
@ -1197,9 +1197,9 @@ class DataController extends Zend_Controller_Action
$sql="update ftpuser set datacount=0 where userid=?"; $sql="update ftpuser set datacount=0 where userid=?";
$this->db->query($sql,array($userid)); $this->db->query($sql,array($userid));
} else { } else {
$sql="update dataorder set ts_approved=now(),status=-1 where status=0 and userid=? and id=?"; $sql="update dataorder set ts_approved=now(),status=-1 where status in (0,1,2) and userid=? and id=?";
$this->db->query($sql,array($userid,(int)$cancel)); $this->db->query($sql,array($userid,(int)$cancel));
$sql="update ftpuser set datacount=datacount-1 where userid=?"; $sql="update ftpuser set datacount=datacount-1 where userid=? and datacount>0";
$this->db->query($sql,array($userid)); $this->db->query($sql,array($userid));
} }
} elseif ($pdf) { } elseif ($pdf) {

View File

@ -48,7 +48,7 @@
<ul><li class="time"><?php echo date('Y-m-d H:i:s',strtotime($order['ts_created'])); ?></li> <ul><li class="time"><?php echo date('Y-m-d H:i:s',strtotime($order['ts_created'])); ?></li>
<li class="datatype"><?php print $order['datatype']?'离线数据':'在线数据'; ?></li> <li class="datatype"><?php print $order['datatype']?'离线数据':'在线数据'; ?></li>
<li class="name"><a href="/data/<?php echo $order['uuid']; ?>"><?php echo $order['title']; ?></a></li> <li class="name"><a href="/data/<?php echo $order['uuid']; ?>"><?php echo $order['title']; ?></a></li>
<li class="action"><a href="/data/order/del/<?php echo $order['id']; ?>">删除</a> <li class="action"><a href="/data/order/cancel/<?php echo $order['id']; ?>">取消</a>
<a href="/data/order/apply/<?php echo $order['id']; ?>">离线申请</a></li> <a href="/data/order/apply/<?php echo $order['id']; ?>">离线申请</a></li>
</ul> </ul>
<?php endforeach; ?> <?php endforeach; ?>
@ -68,6 +68,7 @@
<?php switch($order['status']) { <?php switch($order['status']) {
case 2: case 2:
echo "请生成PDF申请表"; echo "请生成PDF申请表";
echo ' <a href="/data/order/cancel/'.$order['id'].'">取消</a>';
break; break;
case 3: case 3:
echo "请打印并邮寄申请表"; echo "请打印并邮寄申请表";