* finish task #3310.

This commit is contained in:
wangyidong
2017-11-03 13:22:27 +08:00
parent 254cc9a5ef
commit 38073d2ad7
15 changed files with 101 additions and 65 deletions

View File

@@ -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')

View File

@@ -16,7 +16,7 @@
<strong><small class='text-muted'></small> <?php echo $lang->bug->common . $lang->colon . $lang->bug->batchActivate;?></strong>
</div>
</div>
<form class='form-condensed' method='post' target='hiddenwin' action="<?php echo inLink('batchActivate', "productID=$productID");?>">
<form class='form-condensed' method='post' target='hiddenwin'>
<table class='table table-fixed with-border'>
<thead>
<tr>

View File

@@ -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';

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -125,4 +125,8 @@ $lang->custom->menuTip = '点击显示或隐藏导航条目,拖拽来更改
$lang->custom->saveFail = '保存失败!';
$lang->custom->scoreList[0] = '关闭';
$lang->custom->scoreList[1] = '开启';
$lang->custom->scoreList[1] = '开启';
$lang->custom->moduleName['product'] = $lang->productCommon;
$lang->custom->moduleName['productplan'] = '计划';
$lang->custom->moduleName['project'] = $lang->projectCommon;

View File

@@ -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;
}

View File

@@ -16,7 +16,8 @@
<?php
foreach($config->custom->requiredModules as $requiredModule)
{
echo "<li class='list-group-item' id='{$requiredModule}Tab'>" . html::a(inlink('required', "module=$requiredModule"), $lang->$requiredModule->common) . "</li>";
$requiredModuleName = zget($lang->custom->moduleName, $requiredModule, $lang->$requiredModule->common);
echo "<li class='list-group-item' id='{$requiredModule}Tab'>" . html::a(inlink('required', "module=$requiredModule"), $requiredModuleName) . "</li>";
}
?>
</div>
@@ -32,17 +33,19 @@
<tr>
<th class='w-100px'>
<?php
$fieldList = $fields;
$fields = $this->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;
?>
</th>
<td><?php echo html::select("requiredFields[{$method}][]", $fieldList, $requiredField, "class='form-control chosen' multiple");?></td>
<td><?php echo html::select("requiredFields[{$method}][]", $fields, $requiredField, "class='form-control chosen' multiple");?></td>
<td></td>
</tr>
<?php endforeach;?>

View File

@@ -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();

View File

@@ -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')

View File

@@ -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';

View File

@@ -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);

View File

@@ -23,7 +23,7 @@
<form class='form-condensed' method='post' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th class='w-80px'><?php echo $lang->task->assignedTo;?></th>
<th class='w-70px'><?php echo $lang->task->assignedTo;?></th>
<td class='w-p25-f'><?php echo html::select('assignedTo', $members, $task->finishedBy, "class='form-control chosen'");?></td><td></td>
</tr>
<tr>

View File

@@ -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'];

View File

@@ -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])