diff --git a/module/action/model.php b/module/action/model.php index a93cff19a1..ab6be8d3dc 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -735,7 +735,7 @@ class actionModel extends model if($action->objectType == 'product') { $product = $this->dao->select('name,code')->from(TABLE_PRODUCT)->where('id')->eq($action->objectID)->fetch(); - $count = $this->dao->select('COUNT(*) AS count')->from(TABLE_PRODUCT)->where('name')->eq($product->name)->orWhere('code')->eq($product->code)->fetch('count'); + $count = $this->dao->select('COUNT(*) AS count')->from(TABLE_PRODUCT)->where('deleted')->eq('0')->andWhere("(`name`='{$product->name}' OR `code`='{$product->code}')")->fetch('count'); if($count > 0) { echo js::alert(sprintf($this->lang->action->needEdit, $this->lang->action->objectTypes['product'])); @@ -745,7 +745,7 @@ class actionModel extends model elseif($action->objectType == 'project') { $project = $this->dao->select('name,code')->from(TABLE_PROJECT)->where('id')->eq($action->objectID)->fetch(); - $count = $this->dao->select('COUNT(*) AS count')->from(TABLE_PROJECT)->where('name')->eq($project->name)->orWhere('code')->eq($project->code)->fetch('count'); + $count = $this->dao->select('COUNT(*) AS count')->from(TABLE_PROJECT)->where('deleted')->eq('0')->andWhere("(`name`='{$project->name}' OR `code`='{$project->code}')")->fetch('count'); if($count > 0) { echo js::alert(sprintf($this->lang->action->needEdit, $this->lang->action->objectTypes['project'])); diff --git a/module/install/model.php b/module/install/model.php index cc1ffc4d28..6b2627a742 100644 --- a/module/install/model.php +++ b/module/install/model.php @@ -382,6 +382,7 @@ class installModel extends model if(strpos($table, '--') === 0) continue; $table = str_replace('`zt_', $this->config->db->name . '.`zt_', $table); + $table = str_replace('`ztv_', $this->config->db->name . '.`ztv_', $table); $table = str_replace('zt_', $this->config->db->prefix, $table); if(!$this->dbh->query($table)) return false; }