* Fix link story bug.

This commit is contained in:
tianshujie98
2021-03-10 11:30:22 +08:00
parent 42ae2394a7
commit 16f043f693
3 changed files with 44 additions and 43 deletions
+32 -32
View File
@@ -152,16 +152,16 @@ class custom extends control
{
if(strlen($key) > 10) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStrlen['ten']));
}
/* The length of sourceList in story module and typeList in task module is less than 20, check it when saved. */
if($field == 'sourceList' or $module == 'task' and $field == 'typeList')
{
if(strlen($key) > 20) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStrlen['twenty']));
}
/* The length of stageList in testcase module is less than 255, check it when saved. */
if($module == 'testcase' and $field == 'stageList' and strlen($key) > 255) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->invalidStrlen['twoHundred']));
/* The length of field that in bug and testcase module and reasonList in story and task module is less than 30, check it when saved. */
if($module == 'bug' or $field == 'reasonList' or $module == 'testcase')
{
@@ -174,7 +174,7 @@ class custom extends control
foreach($data->keys as $index => $key)
{
//if(!$system and (!$value or !$key)) continue; //Fix bug #951.
$value = $data->values[$index];
$system = $data->systems[$index];
$this->custom->setItem("{$lang}.{$module}.{$field}.{$key}.{$system}", $value);
@@ -217,10 +217,10 @@ class custom extends control
/**
* Restore the default lang. Delete the related items.
*
* @param string $module
* @param string $field
* @param string $confirm
*
* @param string $module
* @param string $field
* @param string $confirm
* @access public
* @return void
*/
@@ -241,7 +241,7 @@ class custom extends control
/**
* Set working mode function.
*
*
* @access public
* @return void
*/
@@ -260,8 +260,8 @@ class custom extends control
/**
* Set Required.
*
* @param string $moduleName
*
* @param string $moduleName
* @access public
* @return void
*/
@@ -318,7 +318,7 @@ class custom extends control
/**
* Timezone.
*
*
* @access public
* @return void
*/
@@ -341,7 +341,7 @@ class custom extends control
/**
* Browse story concept.
*
*
* @access public
* @return void
*/
@@ -364,20 +364,20 @@ class custom extends control
/**
* Set story concept.
*
*
* @access public
* @return void
*/
public function setStoryConcept()
{
{
if($_POST)
{
{
$result = $this->custom->setURAndSR();
if(!$result) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->URSREmpty));
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
}
$this->view->title = $this->lang->custom->setStoryConcept;
$this->view->position[] = $this->lang->custom->setStoryConcept;
@@ -388,20 +388,20 @@ class custom extends control
/**
* Edit story concept.
* @param int $key
*
*
* @access public
* @return void
*/
public function editStoryConcept($key = 0)
{
if($_POST)
{
{
$result = $this->custom->updateURAndSR($key);
if(!$result) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->URSREmpty));
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
}
$lang = $this->app->getClientLang();
$URSR = $this->dao->select('`value`')->from(TABLE_LANG)
@@ -528,7 +528,7 @@ class custom extends control
/**
* Set Mode.
*
*
* @access public
* @return void
*/
@@ -561,10 +561,10 @@ class custom extends control
/**
* Ajax save custom fields.
*
* @param string $module
* @param string $section
* @param string $key
*
* @param string $module
* @param string $section
* @param string $key
* @access public
* @return void
*/
@@ -601,7 +601,7 @@ class custom extends control
/**
* Ajax set menu
*
*
* @param string $module
* @param string $method
* @param string $menus
@@ -690,8 +690,8 @@ class custom extends control
/**
* Ajax restore menu.
*
* @param string $confirm
*
* @param string $confirm
* @access public
* @return void
*/
@@ -707,7 +707,7 @@ class custom extends control
/**
* Ajax set doc setting.
*
*
* @access public
* @return void
*/
@@ -724,9 +724,9 @@ class custom extends control
/**
* Reset required.
*
* @param srting $module
* @param string $confirm
*
* @param srting $module
* @param string $confirm
* @access public
* @return void
*/
+3 -2
View File
@@ -2178,9 +2178,10 @@ class execution extends control
$this->loadModel('product');
/* Get executions and products. */
$execution = $this->execution->getById($executionID);
$execution = $this->execution->getById($executionID);
$products = $this->execution->getProducts($executionID);
$browseLink = $this->createLink('execution', 'story', "executionID=$executionID");
$module = $execution->type == 'execution' ? 'execution' : 'projectstory';
$browseLink = $this->createLink($module, 'story', "executionID=$executionID");
if($execution->type == 'execution') $browseLink = $this->createLink('executionstory', 'story', "productID={$this->session->product}");
$this->session->set('storyList', $this->app->getURI(true)); // Save session.
+9 -9
View File
@@ -1771,12 +1771,12 @@ class executionModel extends model
/* Link stories. */
$executionStories = $this->loadModel('story')->getExecutionStoryPairs($executionID);
$lastOrder = (int)$this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('execution')->eq($executionID)->orderBy('order_desc')->limit(1)->fetch('order');
$lastOrder = (int)$this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($executionID)->orderBy('order_desc')->limit(1)->fetch('order');
foreach($stories as $storyID)
{
if(!isset($executionStories[$storyID]))
{
$story = $this->dao->findById($storyID)->fields("$executionID as execution, id as story, product, version")->from(TABLE_STORY)->fetch();
$story = $this->dao->findById($storyID)->fields("$executionID as project, id as story, product, version")->from(TABLE_STORY)->fetch();
$story->order = ++$lastOrder;
$this->dao->insert(TABLE_PROJECTSTORY)->data($story)->exec();
$this->action->create('story', $storyID, 'linked2execution', '', $executionID);
@@ -1994,7 +1994,7 @@ class executionModel extends model
$this->loadModel('action');
$versions = $this->loadModel('story')->getVersions($stories);
$linkedStories = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('execution')->eq($executionID)->orderBy('order_desc')->fetchPairs('story', 'order');
$linkedStories = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($executionID)->orderBy('order_desc')->fetchPairs('story', 'order');
$lastOrder = reset($linkedStories);
$statusPairs = $this->dao->select('id, status')->from(TABLE_STORY)->where('id')->in(array_values($stories))->fetchPairs();
foreach($stories as $key => $storyID)
@@ -2003,7 +2003,7 @@ class executionModel extends model
if(isset($linkedStories[$storyID])) continue;
$data = new stdclass();
$data->execution = $executionID;
$data->project = $executionID;
$data->product = (int)$products[$storyID];
$data->story = $storyID;
$data->version = $versions[$storyID];
@@ -2025,7 +2025,7 @@ class executionModel extends model
public function linkStories($executionID)
{
$plans = $this->dao->select('plan,product')->from(TABLE_PROJECTPRODUCT)
->where('execution')->eq($executionID)
->where('project')->eq($executionID)
->fetchPairs('plan', 'product');
$planStories = array();
@@ -2072,16 +2072,16 @@ class executionModel extends model
if($execution->type == 'execution')
{
$executions = $this->dao->select('*')->from(TABLE_EXECUTION)->where('parent')->eq($executionID)->fetchAll('id');
$executionStories = $this->dao->select('execution,story')->from(TABLE_PROJECTSTORY)->where('story')->eq($storyID)->andWhere('execution')->in(array_keys($executions))->fetchAll();
$executionStories = $this->dao->select('project,story')->from(TABLE_PROJECTSTORY)->where('story')->eq($storyID)->andWhere('project')->in(array_keys($executions))->fetchAll();
if(!empty($executionStories)) die(js::alert($this->lang->execution->notAllowedUnlinkStory));
}
$this->dao->delete()->from(TABLE_PROJECTSTORY)->where('execution')->eq($executionID)->andWhere('story')->eq($storyID)->limit(1)->exec();
$this->dao->delete()->from(TABLE_PROJECTSTORY)->where('project')->eq($executionID)->andWhere('story')->eq($storyID)->limit(1)->exec();
$order = 1;
$stories = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('execution')->eq($executionID)->orderBy('order')->fetchAll();
$stories = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($executionID)->orderBy('order')->fetchAll();
foreach($stories as $executionstory)
{
if($executionstory->order != $order) $this->dao->update(TABLE_PROJECTSTORY)->set('`order`')->eq($order)->where('execution')->eq($executionID)->andWhere('story')->eq($executionstory->story)->exec();
if($executionstory->order != $order) $this->dao->update(TABLE_PROJECTSTORY)->set('`order`')->eq($order)->where('project')->eq($executionID)->andWhere('story')->eq($executionstory->story)->exec();
$order++;
}