* fix for undelete project.

This commit is contained in:
wangyidong
2020-12-11 15:48:30 +08:00
parent dabb2d003d
commit c858ae19e3
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -1027,7 +1027,7 @@ class actionModel extends model
if($action->objectType == 'product')
{
$product = $this->dao->select('id,name,code,acl')->from(TABLE_PRODUCT)->where('id')->eq($action->objectID)->fetch();
$count = $this->dao->select('COUNT(*) AS count')->from(TABLE_PRODUCT)->where('deleted')->eq('0')->andWhere("(`name`='{$product->name}' OR `code`='{$product->code}')")->fetch('count');
$count = $this->dao->select('COUNT(*) AS count')->from(TABLE_PRODUCT)->where('deleted')->eq('0')->andWhere("(`name`='{$product->name}'" . ($product->code ? " OR `code`='{$product->code}'" : '') . ")")->fetch('count');
if($count > 0)
{
echo js::alert(sprintf($this->lang->action->needEdit, $this->lang->action->objectTypes['product']));
@@ -1038,7 +1038,7 @@ class actionModel extends model
elseif($action->objectType == 'project')
{
$project = $this->dao->select('id,name,code,acl')->from(TABLE_PROJECT)->where('id')->eq($action->objectID)->fetch();
$count = $this->dao->select('COUNT(*) AS count')->from(TABLE_PROJECT)->where('deleted')->eq('0')->andWhere("(`name`='{$project->name}' OR `code`='{$project->code}')")->fetch('count');
$count = $this->dao->select('COUNT(*) AS count')->from(TABLE_PROJECT)->where('deleted')->eq('0')->andWhere("(`name`='{$project->name}'" . ($project->code ? " OR `code`='{$project->code}'" : '') . ")")->fetch('count');
if($count > 0)
{
echo js::alert(sprintf($this->lang->action->needEdit, $this->lang->action->objectTypes['project']));