From de80b35803825c4bba2b9df3150498acd9fec232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E5=88=9A?= Date: Fri, 12 Aug 2022 08:17:54 +0000 Subject: [PATCH] * Fix bug#26389,26333,26328 --- module/execution/model.php | 4 ++-- module/product/model.php | 6 +++--- module/search/control.php | 3 ++- module/search/model.php | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 14d8e21126..9944422cb3 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -396,7 +396,7 @@ class executionModel extends model $this->dao->insert(TABLE_EXECUTION)->data($sprint) ->autoCheck($skipFields = 'begin,end') ->batchcheck($this->config->execution->create->requiredFields, 'notempty') - ->checkIF((!empty($sprint->name) and $this->config->systemMode == 'new'), 'name', 'unique', "`type` in ('sprint','stage', 'kanban') and `project` = $sprintProject and `deleted` = '0'") + ->checkIF(!empty($sprint->name), 'name', 'unique', "`type` in ('sprint','stage', 'kanban') and `project` = $sprintProject and `deleted` = '0'") ->checkIF(!empty($sprint->code), 'code', 'unique', "`type` in ('sprint','stage', 'kanban') and `deleted` = '0'") ->checkIF($sprint->begin != '', 'begin', 'date') ->checkIF($sprint->end != '', 'end', 'date') @@ -551,7 +551,7 @@ class executionModel extends model ->checkIF($execution->begin != '', 'begin', 'date') ->checkIF($execution->end != '', 'end', 'date') ->checkIF($execution->end != '', 'end', 'ge', $execution->begin) - ->checkIF((!empty($execution->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $executionID and type in ('sprint','stage', 'kanban') and `project` = $executionProject and `deleted` = '0'") + ->checkIF(!empty($execution->name), 'name', 'unique', "id != $executionID and type in ('sprint','stage', 'kanban') and `project` = $executionProject and `deleted` = '0'") ->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage', 'kanban') and `deleted` = '0'") ->checkFlow() ->where('id')->eq($executionID) diff --git a/module/product/model.php b/module/product/model.php index bda572234c..3ee3ad29c2 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -680,7 +680,7 @@ class productModel extends model $programID = isset($product->program) ? $product->program : 0; $this->dao->insert(TABLE_PRODUCT)->data($product)->autoCheck() ->batchCheck($this->config->product->create->requiredFields, 'notempty') - ->checkIF((!empty($product->name) and $this->config->systemMode == 'new'), 'name', 'unique', "`program` = $programID and `deleted` = '0'") + ->checkIF(!empty($product->name), 'name', 'unique', "`program` = $programID and `deleted` = '0'") ->checkIF(!empty($product->code), 'code', 'unique', "`deleted` = '0'") ->checkFlow() ->exec(); @@ -770,10 +770,10 @@ class productModel extends model $this->lang->error->unique = $this->lang->error->repeat; $product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->edit['id'], $this->post->uid); - $programID = isset($product->program) ? $product->program : ''; + $programID = isset($product->program) ? $product->program : 0; $this->dao->update(TABLE_PRODUCT)->data($product)->autoCheck() ->batchCheck($this->config->product->edit->requiredFields, 'notempty') - ->checkIF((!empty($product->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $productID and `program` = $programID and `deleted` = '0'") + ->checkIF(!empty($product->name), 'name', 'unique', "id != $productID and `program` = $programID and `deleted` = '0'") ->checkIF(!empty($product->code), 'code', 'unique', "id != $productID and `deleted` = '0'") ->checkFlow() ->where('id')->eq($productID) diff --git a/module/search/control.php b/module/search/control.php index 6971bb6295..a6325b3faa 100644 --- a/module/search/control.php +++ b/module/search/control.php @@ -231,10 +231,11 @@ class search extends control $pager = new pager(0, $this->config->search->recPerPage, $pageID); $results = $this->search->getList($words, $type, $pager); - $typeCount = $this->search->getListCount(''); + $typeCount = $this->search->getListCount(); $typeList = array('all' => $this->lang->search->modules['all']); foreach($typeCount as $objectType => $count) { + if(!isset($this->lang->search->modules[$objectType])) continue; $typeList[$objectType] = $this->lang->search->modules[$objectType]; } diff --git a/module/search/model.php b/module/search/model.php index 8132a948b3..4055974eb6 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -647,7 +647,7 @@ class searchModel extends model * @access public * @return array */ - public function getListCount($keywords, $type = 'all') + public function getListCount($keywords = '', $type = 'all') { list($words, $againstCond, $likeCondition, $allowedObject) = $this->getSqlParams($keywords, $type);