* Code for task #119466.

This commit is contained in:
sunguangming
2024-05-29 09:02:31 +08:00
parent f126a6c751
commit 2ec4368de2
3 changed files with 11 additions and 9 deletions
+2 -2
View File
@@ -126,8 +126,8 @@ window.buildColCardActions = function(col)
if(priv.canBatchCreateEpic || priv.canBatchCreateRequirement)
{
let batchCreateItems = [];
if(priv.canBatchCreateRequirement) batchCreateItems.push({text: requirementLang.common, url: productCount > 1 ? '#batchCreateStory' : $.createLink('requirement', 'batchCreate', 'productID=' + productID + '&branch=0&executionID=' + executionID + '&module=0&extra=regionID=' + col.region + ',laneID=' + 0 + ',columnID=' + col.id), 'data-toggle': 'modal', 'data-size': 'lg', 'innerClass': 'requirement-batch-btn'});
if(priv.canBatchCreateEpic) batchCreateItems.push({text: epicLang.common, url: productCount > 1 ? '#batchCreateStory' : $.createLink('epic', 'batchCreate', 'productID=' + productID + '&branch=0&executionID=' + executionID + '&module=0&extra=regionID=' + col.region + ',laneID=' + 0 + ',columnID=' + col.id), 'data-toggle': 'modal', 'data-size': 'lg', 'innerClass': 'epic-batch-btn'});
if(priv.canBatchCreateRequirement) batchCreateItems.push({text: requirementLang.common, url: productCount > 1 ? '#batchCreateStory' : $.createLink('requirement', 'batchCreate', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&objectID=' + executionID + '&planID=0&storyType=requirement&extra=regionID=' + col.region + ',laneID=' + 0 + ',columnID=' + col.id), 'data-toggle': 'modal', 'data-size': 'lg', 'innerClass': 'requirement-batch-btn'});
if(priv.canBatchCreateEpic) batchCreateItems.push({text: epicLang.common, url: productCount > 1 ? '#batchCreateStory' : $.createLink('epic', 'batchCreate', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&objectID=' + executionID + '&planID=0&storyType=epic&extra=regionID=' + col.region + ',laneID=' + 0 + ',columnID=' + col.id), 'data-toggle': 'modal', 'data-size': 'lg', 'innerClass': 'epic-batch-btn'});
actions.push({text: storyLang.batchCreate, items: batchCreateItems});
}
if(priv.canLinkStory) actions.push({text: executionLang.linkStory, url: $.createLink('execution', 'linkStory', 'executionID=' + executionID + '&browseType=&param=0&orderBy=id_desc&recPerPage=50&pageID=1&extra=laneID=0,columnID=' + col.id), 'data-toggle': 'modal', 'data-size' : 'lg'});
+2 -2
View File
@@ -103,7 +103,7 @@ class story extends control
$initStory = $this->storyZen->initStoryForCreate($planID, $copyStoryID, $bugID, $todoID, $extra);
/* Get form fields. */
$this->storyZen->setViewVarsForKanban($objectID, $this->story->parseExtra($extra));
$this->storyZen->setViewVarsForKanban($objectID, $this->story->parseExtra($extra), $storyType);
$fields = $this->storyZen->getFormFieldsForCreate($productID, $branch, $objectID, $initStory, $storyType);
$fields = $this->storyZen->setModuleField($fields, $moduleID);
$fields = $this->storyZen->removeFormFieldsForCreate($fields, $storyType);
@@ -168,7 +168,7 @@ class story extends control
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locateLink));
}
$this->storyZen->setMenuForBatchCreate($productID, $branch, $executionID, $extra);
$this->storyZen->setMenuForBatchCreate($productID, $branch, $executionID, $extra, $storyType);
if($productID == 0 && $executionID != 0) return $this->sendError($this->lang->execution->errorNoLinkedProducts, $this->createLink('execution', 'manageproducts', "executionID=$executionID"));
+7 -5
View File
@@ -71,10 +71,11 @@ class storyZen extends story
* @param string $branch
* @param int $executionID
* @param string $extra
* @param string $storyType
* @access protected
* @return void
*/
protected function setMenuForBatchCreate(int $productID, string $branch = '', int $executionID = 0, string $extra = ''): void
protected function setMenuForBatchCreate(int $productID, string $branch = '', int $executionID = 0, string $extra = '', $storyType = 'story'): void
{
$this->view->hiddenProduct = false;
$this->view->hiddenPlan = false;
@@ -125,7 +126,7 @@ class storyZen extends story
$output = $this->story->parseExtra($extra);
$regionPairs = $this->kanban->getRegionPairs($executionID, 0, 'execution');
$regionID = !empty($output['regionID']) ? $output['regionID'] : key($regionPairs);
$lanePairs = $this->kanban->getLanePairsByRegion((int)$regionID, 'story');
$lanePairs = $this->kanban->getLanePairsByRegion((int)$regionID, $storyType);
$laneID = !empty($output['laneID']) ? $output['laneID'] : key($lanePairs);
$this->view->regionID = $regionID;
@@ -268,10 +269,11 @@ class storyZen extends story
*
* @param int $objectID
* @param array $kanbanSetting
* @param string $storyType
* @access protected
* @return void
*/
protected function setViewVarsForKanban(int $objectID, array $kanbanSetting): void
protected function setViewVarsForKanban(int $objectID, array $kanbanSetting, string $storyType = 'story'): void
{
if(empty($objectID)) return;
@@ -281,7 +283,7 @@ class storyZen extends story
/* 如果是看板执行,设置看板的view变量。 */
$regionPairs = $this->loadModel('kanban')->getRegionPairs($execution->id, 0, 'execution');
$regionID = !empty($kanbanSetting['regionID']) ? $kanbanSetting['regionID'] : key($regionPairs);
$lanePairs = $this->kanban->getLanePairsByRegion((int)$regionID, 'story');
$lanePairs = $this->kanban->getLanePairsByRegion((int)$regionID, $storyType);
$laneID = !empty($kanbanSetting['laneID']) ? $kanbanSetting['laneID'] : key($lanePairs);
$this->view->executionType = 'kanban';
@@ -1032,7 +1034,7 @@ class storyZen extends story
if($project->model !== 'scrum' or !$project->multiple) $hiddenPlan = true;
}
}
if($storyType != 'story') unset($fields['region'], $fields['lane'], $fields['branches'], $fields['modules'], $fields['plans']);
if($storyType != 'story') unset($fields['branches'], $fields['modules'], $fields['plans']);
if($hiddenPlan) unset($fields['plan']);
if($hiddenProduct)
{