diff --git a/module/bug/model.php b/module/bug/model.php index 6b26efe3f0..dcb1855a8e 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -800,6 +800,12 @@ class bugModel extends model */ public function resolve($bugID) { + if(strpos($this->config->bug->resolve->requiredFields, 'comment') !== false and !$this->post->comment) + { + dao::$errors[] = sprintf($this->lang->error->notempty, $this->lang->comment); + return false; + } + $now = helper::now(); $oldBug = $this->getById($bugID); $bug = fixer::input('post') diff --git a/module/bug/view/batchactivate.html.php b/module/bug/view/batchactivate.html.php index 141f022093..788f060b9d 100644 --- a/module/bug/view/batchactivate.html.php +++ b/module/bug/view/batchactivate.html.php @@ -16,7 +16,7 @@ bug->common . $lang->colon . $lang->bug->batchActivate;?> -
"> + diff --git a/module/custom/config.php b/module/custom/config.php index ac2db60060..79834fb550 100644 --- a/module/custom/config.php +++ b/module/custom/config.php @@ -9,8 +9,6 @@ $config->custom->canAdd['todo'] = 'priList,typeList'; $config->custom->canAdd['user'] = 'roleList'; $config->custom->canAdd['block'] = ''; -$config->custom->requiredModules[10] = 'todo'; - $config->custom->requiredModules[15] = 'product'; $config->custom->requiredModules[20] = 'story'; $config->custom->requiredModules[25] = 'productplan'; @@ -28,20 +26,32 @@ $config->custom->requiredModules[70] = 'testtask'; $config->custom->requiredModules[75] = 'doc'; -$config->custom->requiredModules[80] = 'group'; $config->custom->requiredModules[85] = 'user'; -$config->custom->requiredModules[95] = 'entry'; -$config->custom->requiredModules[100] = 'webhook'; - -$config->custom->fieldList['group'] = 'name,desc'; - -$config->custom->excludeFieldList['product'] = 'order'; -$config->custom->excludeFieldList['story'] = 'version,duplicateStory,linkStories,childStories,toBug,fromBug'; -$config->custom->excludeFieldList['project'] = 'order'; -$config->custom->excludeFieldList['task'] = 'fromBug'; -$config->custom->excludeFieldList['bug'] = 'storyVersion,toTask,toStory,hardware,found,confirmed,activatedCount,activatedDate,linkBug,case,caseVersion,result,testtask,repo'; -$config->custom->excludeFieldList['testcase'] = 'version,lastRunResult,lastRunDate,lastRunner,linkCase,fromBug'; -$config->custom->excludeFieldList['testreport'] = 'objectType'; -$config->custom->excludeFieldList['doc'] = 'version'; -$config->custom->excludeFieldList['user'] = 'ranzhi,visits,ip,last'; +$config->custom->fieldList['product']['create'] = 'name,code,line,PO,QD,RD,type,desc'; +$config->custom->fieldList['product']['edit'] = 'name,code,line,PO,QD,RD,type,desc,status'; +$config->custom->fieldList['story']['create'] = 'product,plan,source,sourceNote,title,pri,estimate,mailto,keywords,spec,verify'; +$config->custom->fieldList['story']['change'] = 'title,spec,verify,comment'; +$config->custom->fieldList['story']['close'] = 'closedReason,comment'; +$config->custom->fieldList['story']['review'] = 'reviewedDate,assignedTo,reviewedBy,comment'; +$config->custom->fieldList['productplan'] = 'title,begin,end,desc'; +$config->custom->fieldList['release'] = 'name,build,date,desc'; +$config->custom->fieldList['project']['create'] = 'name,code,begin,end,days,type,desc'; +$config->custom->fieldList['project']['edit'] = 'name,code,begin,end,days,type,desc,PO,PM,QD,RD'; +$config->custom->fieldList['task']['create'] = 'type,story,name,pri,estimate,desc,estStarted,deadline,mailto'; +$config->custom->fieldList['task']['edit'] = 'type,assignedTo,story,name,pri,estimate,desc,estStarted,deadline,mailto'; +$config->custom->fieldList['task']['finish'] = 'consumed,finishedDate,comment'; +$config->custom->fieldList['task']['activate'] = 'assignedTo,left,comment'; +$config->custom->fieldList['build'] = 'product,name,builder,date,scmPath,filePath,desc'; +$config->custom->fieldList['bug']['create'] = 'product,project,openedBuild,assignedTo,deadline,type,os,browser,title,severity,pri,steps,story,task,mailto,keywords'; +$config->custom->fieldList['bug']['edit'] = 'product,plan,project,openedBuild,assignedTo,deadline,type,os,browser,title,severity,pri,steps,story,task,mailto,keywords,status'; +$config->custom->fieldList['bug']['resolve'] = 'resolution,resolvedBuild,resolvedDate,assignedTo,comment'; +$config->custom->fieldList['testcase']['create'] = 'product,type,stage,story,title,pri,precondition,keywords'; +$config->custom->fieldList['testcase']['edit'] = 'product,type,stage,story,title,pri,precondition,keywords,status'; +$config->custom->fieldList['testsuite'] = 'name,desc'; +$config->custom->fieldList['testcase']['createcase'] = 'lib,type,stage,title,pri,precondition,keywords'; +$config->custom->fieldList['testreport'] = 'begin,end,owner,members,title,report'; +$config->custom->fieldList['testtask'] = 'project,build,,owner,pri,begin,end,status,name,desc'; +$config->custom->fieldList['doc'] = 'title,keywords,content'; +$config->custom->fieldList['user']['create'] = 'dept,account,realname,password,password1,password2,role,email,commiter,join'; +$config->custom->fieldList['user']['edit'] = 'dept,account,realname,role,email,commiter,join,skype,qq,mobile,phone,address,zipcode,wangwang,gtalk'; diff --git a/module/custom/control.php b/module/custom/control.php index 9b7a4cb71c..1dd03ff30b 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -259,19 +259,11 @@ class custom extends control unset($requiredFields['editLib']); } - $fields = $this->custom->getDBFields($moduleName); - if($moduleName == 'testsuite') - { - $this->app->loadLang('testcase'); - $this->view->caseFields = $this->custom->getDBFields('testcase'); - } - $this->view->title = $this->lang->custom->required; $this->view->position[] = $this->lang->custom->required; $this->view->requiredFields = $requiredFields; $this->view->moduleName = $moduleName; - $this->view->fields = $fields; $this->display(); } diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php index 403292a831..ad9fe82145 100644 --- a/module/custom/lang/en.php +++ b/module/custom/lang/en.php @@ -126,3 +126,7 @@ $lang->custom->saveFail = 'Failed to save!'; $lang->custom->scoreList[0] = 'Off'; $lang->custom->scoreList[1] = 'On'; + +$lang->custom->moduleName['product'] = $lang->productCommon; +$lang->custom->moduleName['productplan'] = 'Plan'; +$lang->custom->moduleName['project'] = $lang->projectCommon; diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php index 4c9205a2c6..6309389af2 100644 --- a/module/custom/lang/zh-cn.php +++ b/module/custom/lang/zh-cn.php @@ -125,4 +125,8 @@ $lang->custom->menuTip = '点击显示或隐藏导航条目,拖拽来更改 $lang->custom->saveFail = '保存失败!'; $lang->custom->scoreList[0] = '关闭'; -$lang->custom->scoreList[1] = '开启'; \ No newline at end of file +$lang->custom->scoreList[1] = '开启'; + +$lang->custom->moduleName['product'] = $lang->productCommon; +$lang->custom->moduleName['productplan'] = '计划'; +$lang->custom->moduleName['project'] = $lang->projectCommon; diff --git a/module/custom/model.php b/module/custom/model.php index 7836194d2e..c901a32fe3 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -410,30 +410,14 @@ class customModel extends model if(isset($customFields[$moduleName])) { $fieldList = isset($customFields[$moduleName][$method]) ? $customFields[$moduleName][$method] : $customFields[$moduleName]; + if(!is_string($fieldList)) return $fields; + foreach(explode(',', $fieldList) as $fieldName) { + if($fieldName == 'comment') $fields[$fieldName] = $this->lang->comment; if(isset($moduleLang->$fieldName) and is_string($moduleLang->$fieldName)) $fields[$fieldName] = $moduleLang->$fieldName; } } - else - { - $table = zget($this->config->objectTables, $moduleName, ''); - if($table) - { - $excludeFieldList = zget($this->config->custom->excludeFieldList, $moduleName, ''); - foreach($this->dao->query("DESC $table")->fetchAll() as $field) - { - $fieldName = $field->Field; - if($fieldName == 'id' or $fieldName == 'deleted') continue; - if($fieldName == 'openedBy' or $fieldName == 'createdBy' or $fieldName == 'addedBy') continue; - if($fieldName == 'openedDate' or $fieldName == 'createdDate' or $fieldName == 'addedDate') continue; - if($fieldName == 'lastEditedBy' or $fieldName == 'editedBy') continue; - if($fieldName == 'lastEditedDate' or $fieldName == 'editedDate') continue; - if(isset($excludeFieldList) and strpos(",{$excludeFieldList},", ",$fieldName,") !== false) continue; - if(isset($moduleLang->$fieldName) and is_string($moduleLang->$fieldName)) $fields[$fieldName] = $moduleLang->$fieldName; - } - } - } return $fields; } diff --git a/module/custom/view/required.html.php b/module/custom/view/required.html.php index 71161126a7..247ce43aaf 100644 --- a/module/custom/view/required.html.php +++ b/module/custom/view/required.html.php @@ -16,7 +16,8 @@ custom->requiredModules as $requiredModule) { - echo "
  • " . html::a(inlink('required', "module=$requiredModule"), $lang->$requiredModule->common) . "
  • "; + $requiredModuleName = zget($lang->custom->moduleName, $requiredModule, $lang->$requiredModule->common); + echo "
  • " . html::a(inlink('required', "module=$requiredModule"), $requiredModuleName) . "
  • "; } ?> @@ -32,17 +33,19 @@ - + diff --git a/module/product/model.php b/module/product/model.php index 25f2cab5ba..5aa7f32799 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -302,7 +302,7 @@ class productModel extends model ->get(); $product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->create['id'], $this->post->uid); $this->dao->insert(TABLE_PRODUCT)->data($product)->autoCheck() - ->batchCheck('name,code', 'notempty') + ->batchCheck($this->config->product->edit->requiredFields, 'notempty') ->check('name', 'unique', "deleted = '0'") ->check('code', 'unique', "deleted = '0'") ->exec(); diff --git a/module/story/model.php b/module/story/model.php index 2ebcc59f5c..246c734863 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -387,6 +387,12 @@ class storyModel extends model return false; } + if(strpos($this->config->story->change->requiredFields, 'comment') !== false and !$this->post->comment) + { + dao::$errors[] = sprintf($this->lang->error->notempty, $this->lang->comment); + return false; + } + $story = fixer::input('post')->stripTags($this->config->story->editor->change['id'], $this->config->allowedTags)->get(); if($story->spec != $oldStory->spec or $story->verify != $oldStory->verify or $story->title != $oldStory->title or $this->loadModel('file')->getCount()) $specChanged = true; @@ -629,6 +635,12 @@ class storyModel extends model if($this->post->result == false) die(js::alert($this->lang->story->mustChooseResult)); if($this->post->result == 'revert' and $this->post->preVersion == false) die(js::alert($this->lang->story->mustChoosePreVersion)); + if(strpos($this->config->story->review->requiredFields, 'comment') !== false and !$this->post->comment) + { + dao::$errors[] = sprintf($this->lang->error->notempty, $this->lang->comment); + return false; + } + $oldStory = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch(); $now = helper::now(); $date = helper::today(); @@ -768,6 +780,12 @@ class storyModel extends model */ public function close($storyID) { + if(strpos($this->config->story->close->requiredFields, 'comment') !== false and !$this->post->comment) + { + dao::$errors[] = sprintf($this->lang->error->notempty, $this->lang->comment); + return false; + } + $oldStory = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch(); $now = helper::now(); $story = fixer::input('post') @@ -784,6 +802,7 @@ class storyModel extends model ->setIF($this->post->closedReason != 'done', 'plan', 0) ->remove('comment') ->get(); + $this->dao->update(TABLE_STORY)->data($story) ->autoCheck() ->batchCheck($this->config->story->close->requiredFields, 'notempty') diff --git a/module/task/config.php b/module/task/config.php index ee0236e1f1..4c96a6604c 100644 --- a/module/task/config.php +++ b/module/task/config.php @@ -10,7 +10,6 @@ $config->task->activate = new stdclass(); $config->task->create->requiredFields = 'name,type'; $config->task->edit->requiredFields = $config->task->create->requiredFields; -$config->task->start->requiredFields = 'estimate'; $config->task->finish->requiredFields = 'consumed'; $config->task->activate->requiredFields = 'left'; diff --git a/module/task/model.php b/module/task/model.php index c9c6c53e10..8b4b03fb7c 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -28,11 +28,11 @@ class taskModel extends model $task = fixer::input('post') ->add('project', (int)$projectID) ->setDefault('estimate, left, story', 0) - ->setDefault('estStarted', '0000-00-00') - ->setDefault('deadline', '0000-00-00') ->setDefault('status', 'wait') ->setIF($this->post->estimate != false, 'left', $this->post->estimate) ->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) + ->setIF(strpos($this->config->task->create->requiredFields, 'estStarted') === false, 'estStarted', '0000-00-00') + ->setIF(strpos($this->config->task->create->requiredFields, 'deadline') === false, 'deadline', '0000-00-00') ->setDefault('openedBy', $this->app->user->account) ->setDefault('openedDate', helper::now()) ->stripTags($this->config->task->editor->create['id'], $this->config->allowedTags) @@ -313,7 +313,8 @@ class taskModel extends model $now = helper::now(); $task = fixer::input('post') ->setDefault('story, estimate, left, consumed', 0) - ->setDefault('deadline', '0000-00-00') + ->setIF(strpos($this->config->task->edit->requiredFields, 'estStarted') === false, 'estStarted', '0000-00-00') + ->setIF(strpos($this->config->task->edit->requiredFields, 'deadline') === false, 'deadline', '0000-00-00') ->setIF($this->post->story != false and $this->post->story != $oldTask->story, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) ->setIF($this->post->status == 'done', 'left', 0) @@ -880,6 +881,12 @@ class taskModel extends model $oldTask = $this->getById($taskID); $now = helper::now(); + if(strpos($this->config->task->finish->requiredFields, 'comment') !== false and !$this->post->comment) + { + dao::$errors[] = sprintf($this->lang->error->notempty, $this->lang->comment); + return false; + } + $task = fixer::input('post') ->setDefault('left', 0) ->setDefault('assignedTo', $oldTask->openedBy) @@ -933,7 +940,7 @@ class taskModel extends model $this->dao->update(TABLE_TASK)->data($task) ->autoCheck() - ->check('consumed', 'notempty') + ->batchCheck($this->config->task->finish->requiredFields, 'notempty') ->where('id')->eq((int)$taskID)->exec(); if($task->status == 'done') $this->parentStatus($oldTask->parent, 'done'); @@ -1036,6 +1043,12 @@ class taskModel extends model */ public function activate($taskID) { + if(strpos($this->config->task->activate->requiredFields, 'comment') !== false and !$this->post->comment) + { + dao::$errors[] = sprintf($this->lang->error->notempty, $this->lang->comment); + return false; + } + $oldTask = $this->getById($taskID); $task = fixer::input('post') ->setDefault('left', 0) @@ -1048,7 +1061,7 @@ class taskModel extends model $this->dao->update(TABLE_TASK)->data($task) ->autoCheck() - ->check('left', 'notempty') + ->batchCheck($this->config->task->activate->requiredFields, 'notempty') ->where('id')->eq((int)$taskID)->exec(); $this->countTime($oldTask->parent); diff --git a/module/task/view/activate.html.php b/module/task/view/activate.html.php index 81cc43405e..19c6b8b474 100644 --- a/module/task/view/activate.html.php +++ b/module/task/view/activate.html.php @@ -23,7 +23,7 @@
    custom->getDBFields($moduleName, $method); + if($moduleName == 'testsuite' and $method == 'createlib') $method = 'createLib'; if($moduleName == 'testsuite' and $method == 'createcase') { - $fieldList = $caseFields; - $method = 'createCase'; + $this->app->loadLang('testcase'); + $fields = $this->custom->getDBFields('testcase', $method); + $method = 'createCase'; } echo $lang->$moduleName->$method; ?>
    - + diff --git a/module/testsuite/control.php b/module/testsuite/control.php index c16c5db8de..9a3cb35916 100644 --- a/module/testsuite/control.php +++ b/module/testsuite/control.php @@ -486,7 +486,9 @@ class testsuite extends control { if(!empty($_POST)) { - $caseResult = $this->loadModel('testcase')->create($bugID = 0); + $this->loadModel('testcase'); + $this->config->testcase->create->requiredFields = $this->config->testsuite->createcase->requiredFields; + $caseResult = $this->testcase->create($bugID = 0); if(!$caseResult or dao::isError()) die(js::error(dao::getError())); $caseID = $caseResult['id']; diff --git a/module/testsuite/model.php b/module/testsuite/model.php index ff2ea3d1e0..dcc2d7f3b1 100644 --- a/module/testsuite/model.php +++ b/module/testsuite/model.php @@ -612,7 +612,7 @@ class testsuiteModel extends model $cases[$key] = $caseData; } - $forceReview = $this->testcase->forceReview(); + $forceNotReview = $this->testcase->forceNotReview(); foreach($cases as $key => $caseData) { if(!empty($_POST['id'][$key]) and empty($_POST['insert'])) @@ -667,7 +667,7 @@ class testsuiteModel extends model { $caseData->lastEditedBy = $this->app->user->account; $caseData->lastEditedDate = $now; - if($stepChanged and $forceReview) $caseData->status = 'wait'; + if($stepChanged and !$forceNotReview) $caseData->status = 'wait'; $this->dao->update(TABLE_CASE)->data($caseData)->where('id')->eq($caseID)->autoCheck()->exec(); if($stepChanged) { @@ -700,7 +700,7 @@ class testsuiteModel extends model $caseData->version = 1; $caseData->openedBy = $this->app->user->account; $caseData->openedDate = $now; - $caseData->status = $forceReview ? 'wait' : 'normal'; + $caseData->status = $forceNotReview ? 'wait' : 'normal'; $this->dao->insert(TABLE_CASE)->data($caseData)->autoCheck()->exec(); if(!dao::isError()) @@ -768,7 +768,7 @@ class testsuiteModel extends model $cases->pri[$i] = $pri; } - $forceReview = $this->testcase->forceReview(); + $forceNotReview = $this->testcase->forceNotReview(); for($i = 0; $i < $batchNum; $i++) { if($cases->type[$i] != '' and $cases->title[$i] != '') @@ -785,7 +785,7 @@ class testsuiteModel extends model $data[$i]->keywords = $cases->keywords[$i]; $data[$i]->openedBy = $this->app->user->account; $data[$i]->openedDate = $now; - $data[$i]->status = $forceReview ? 'wait' : 'normal'; + $data[$i]->status = $forceNotReview ? 'normal' : 'wait'; $data[$i]->version = 1; $this->dao->insert(TABLE_CASE)->data($data[$i])
    task->assignedTo;?>task->assignedTo;?> finishedBy, "class='form-control chosen'");?>