* fix bug for install when ztv_ and undelete.

This commit is contained in:
wangyidong
2015-08-07 09:09:19 +08:00
parent 5d799fba83
commit f583369235
2 changed files with 3 additions and 2 deletions
+2 -2
View File
@@ -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']));
+1
View File
@@ -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;
}