diff --git a/application/module/Order/Order.php b/application/module/Order/Order.php index 187a4ad3..909aca04 100644 --- a/application/module/Order/Order.php +++ b/application/module/Order/Order.php @@ -152,10 +152,14 @@ class Order { $uid = view::User('id'); } + + $sql = "select count(*) as cnt from dataorder where status=1 and uuid in (select uuid from en.mdstatus) and userid=".$uid; + $row=$this->db->FetchRow($sql); + if ($row['cnt']>=$this->config->download->max) return "Reached the maximum limits of one offline application. Please remove some data."; if($id == -1) { - $sql = $this->db->quoteInto("update dataorder set status=2 where status=1 and userid=?",$uid); + $sql = $this->db->quoteInto("update dataorder set status=2 where status=1 and uuid in (select uuid from en.mdstatus) and userid=?",$uid); if($this->db->exec($sql)) { return true; @@ -166,7 +170,7 @@ class Order if($id > 0) { - $sql = $this->db->quoteInto("update dataorder set status=2 where status=1 and userid=$uid and id=?",$id); + $sql = $this->db->quoteInto("update dataorder set status=2 where status=1 and uuid in (select uuid from en.mdstatus) and userid=$uid and id=?",$id); if($this->db->exec($sql)) { return true;