+ Finished importing issue to story.
This commit is contained in:
@@ -285,6 +285,7 @@ class gitlab extends control
|
||||
$object = $this->gitlab->issueToZentaoObject($issue, $gitlabID);
|
||||
$object->product = $productList[$issueID];
|
||||
$object->execution = $executionID;
|
||||
|
||||
if($objectType == 'task')
|
||||
{
|
||||
$objectID = $this->loadModel('task')->createTaskFromGitlabIssue($object, $executionID);
|
||||
@@ -302,7 +303,7 @@ class gitlab extends control
|
||||
|
||||
if($objectID)
|
||||
{
|
||||
$object->id = $objectID;
|
||||
$object->id = $objectID;
|
||||
$this->gitlab->saveImportedIssue($gitlabID, $projectID, $objectType, $objectID, $issue, $object);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -4,10 +4,10 @@ $config->story = new stdclass();
|
||||
$config->story->batchCreate = 10;
|
||||
$config->story->affectedFixedNum = 7;
|
||||
$config->story->needReview = 1;
|
||||
$config->story->removeFields = 'objectTypeList,productList,executionList,gitlabID,gitlabProjectID,execution';
|
||||
|
||||
$config->story->batchClose = new stdclass();
|
||||
$config->story->batchClose->columns = 10;
|
||||
|
||||
$config->story->create = new stdclass();
|
||||
$config->story->edit = new stdclass();
|
||||
$config->story->change = new stdclass();
|
||||
|
||||
+51
-1
@@ -216,7 +216,7 @@ class storyModel extends model
|
||||
|
||||
/* Check repeat story. */
|
||||
$result = $this->loadModel('common')->removeDuplicate('story', $story, "product={$story->product}");
|
||||
if($result['stop']) return array('status' => 'exists', 'id' => $result['duplicate']);
|
||||
if(isset($result['stop']) and $result['stop']) return array('status' => 'exists', 'id' => $result['duplicate']);
|
||||
|
||||
if($this->checkForceReview()) $story->status = 'draft';
|
||||
if($story->status == 'draft') $story->stage = $this->post->plan > 0 ? 'planned' : 'wait';
|
||||
@@ -348,6 +348,56 @@ class storyModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create story from gitlab issue.
|
||||
*
|
||||
* @param object $story
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function createStoryFromGitlabIssue($story, $executionID)
|
||||
{
|
||||
foreach($story as $feild => $value) $_POST[$feild] = $value;
|
||||
$now = helper::now();
|
||||
$story = fixer::input('post')
|
||||
->cleanInt('product,module,pri,plan')
|
||||
->callFunc('title', 'trim')
|
||||
->add('assignedDate', 0)
|
||||
->add('version', 1)
|
||||
->add('status', 'draft')
|
||||
->setDefault('plan,verify', '')
|
||||
->setDefault('openedBy', $this->app->user->account)
|
||||
->setDefault('openedDate', $now)
|
||||
->setIF($story->assignedTo != '', 'assignedDate', $now)
|
||||
->setIF($executionID > 0, 'status', 'active')
|
||||
->setIF($executionID > 0, 'stage', 'projected')
|
||||
->join('mailto', ',')
|
||||
->stripTags($this->config->story->editor->create['id'], $this->config->allowedTags)
|
||||
->remove('files,labels,reviewer,needNotReview,newStory,uid,contactListMenu,URS')
|
||||
->remove($this->config->story->removeFields)
|
||||
->get();
|
||||
|
||||
$requiredFields = $this->config->story->create->requiredFields;
|
||||
$this->dao->insert(TABLE_STORY)->data($story, 'spec,verify,gitlab,gitlabProject')->autoCheck()->batchCheck($requiredFields, 'notempty')->exec();
|
||||
if(!dao::isError())
|
||||
{
|
||||
$storyID = $this->dao->lastInsertID();
|
||||
|
||||
$data = new stdclass();
|
||||
$data->story = $storyID;
|
||||
$data->version = 1;
|
||||
$data->title = $story->title;
|
||||
$data->spec = $story->spec;
|
||||
$data->verify = $story->spec;
|
||||
$this->dao->insert(TABLE_STORYSPEC)->data($data)->exec();
|
||||
|
||||
return $storyID;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch create stories.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user