* [bug#51859,done,1h] fix bug.

This commit is contained in:
sunguangming
2024-07-02 13:10:36 +08:00
committed by 田淑杰
parent db84bc0476
commit ce798a834b
5 changed files with 14 additions and 8 deletions
+3 -2
View File
@@ -397,12 +397,13 @@ class epic extends control
* Batch change grade.
*
* @param int $grade
* @param string $storyType
* @access public
* @return void
*/
public function batchChangeGrade(int $grade)
public function batchChangeGrade(int $grade, string $storyType = 'epic')
{
echo $this->fetch('story', 'batchChangeGrade', "grade=$grade&storyType=requirement");
echo $this->fetch('story', 'batchChangeGrade', "grade=$grade&storyType=epic");
}
/**
+2 -2
View File
@@ -246,7 +246,7 @@ $fnGenerateFootToolbar = function() use ($lang, $product, $productID, $project,
$canBatchChangePlan = $canBeChanged && hasPriv($storyType, 'batchChangePlan') && $productID && $product && (($product->type != 'normal' && $branchID != 'all') || $product->type == 'normal');
}
$canBatchChangeGrade = $canBeChanged && hasPriv($storyType, 'batchChangeGrade');
$canBatchChangeGrade = $canBeChanged && hasPriv($storyType, 'batchChangeGrade') && count($gradePairs) > 1 && $config->{$storyType}->gradeRule == 'cross';
$canBatchChangeStage = $canBeChanged && hasPriv('story', 'batchChangeStage') && $storyType == 'story';
$canBatchChangeBranch = $canBeChanged && hasPriv($storyType, 'batchChangeBranch') && $product && $product->type != 'normal' && $productID;
$canBatchChangeModule = $canBeChanged && hasPriv($storyType, 'batchChangeModule') && $productID && (($product->type != 'normal' && $branchID != 'all') || $product->type == 'normal') && !$isProjectStory;
@@ -266,7 +266,7 @@ $fnGenerateFootToolbar = function() use ($lang, $product, $productID, $project,
$gradeItems = array();
$roadmapItems = array();
foreach($lang->story->reviewResultList as $key => $result) $reviewResultItems[$key] = array('text' => $result, 'class' => 'batch-btn', 'data-formaction' => $this->createLink($isProjectStory ? 'projectstory' : $storyType, 'batchReview', "result=$key"));
foreach($gradePairs as $key => $result) $gradeItems[] = array('text' => $result, 'class' => 'batch-btn', 'data-formaction' => $this->createLink($isProjectStory ? 'projectstory' : $storyType, 'batchChangeGrade', "result=$key"));
foreach($gradePairs as $key => $result) $gradeItems[] = array('text' => $result, 'class' => 'batch-btn', 'data-formaction' => $this->createLink($isProjectStory ? 'projectstory' : $storyType, 'batchChangeGrade', "result=$key&type=$storyType"));
foreach($lang->story->reasonList as $key => $reason) $reviewRejectItems[] = array('text' => $reason, 'class' => 'batch-btn', 'data-formaction' => $this->createLink($isProjectStory ? 'projectstory' : $storyType, 'batchReview', "result=reject&reason=$key"));
foreach($branchTagOption as $branchID => $branchName) $branchItems[] = array('text' => $branchName, 'class' => 'batch-btn', 'data-formaction' => $this->createLink($isProjectStory ? 'projectstory' : $storyType, 'batchChangeBranch', "branchID=$branchID"));
foreach($modules as $moduleID => $moduleName) $moduleItems[] = array('text' => $moduleName, 'class' => 'batch-btn', 'data-formaction' => $this->createLink($isProjectStory ? 'projectstory' : $storyType, 'batchChangeModule', "moduleID=$moduleID"));
+2 -1
View File
@@ -352,10 +352,11 @@ class requirement extends control
* Batch change grade.
*
* @param int $grade
* @param string $storyType requirement|story|epic
* @access public
* @return void
*/
public function batchChangeGrade(int $grade)
public function batchChangeGrade(int $grade, string $storyType = 'requirement')
{
echo $this->fetch('story', 'batchChangeGrade', "grade=$grade&storyType=requirement");
}
+3 -2
View File
@@ -1199,15 +1199,16 @@ class story extends control
* Batch change the grade of story.
*
* @param int $grade
* @param string $storyType story|requirement|epic
* @access public
* @return void
*/
public function batchChangeGrade(int $grade)
public function batchChangeGrade(int $grade, string $storyType = 'story')
{
if(empty($_POST['storyIdList'])) return $this->send(array('result' => 'success', 'load' => true));
$storyIdList = array_unique($this->post->storyIdList);
$message = $this->story->batchChangeGrade($storyIdList, $grade);
$message = $this->story->batchChangeGrade($storyIdList, $grade, $storyType);
$response = array();
$response['result'] = 'success';
+4 -1
View File
@@ -1837,11 +1837,12 @@ class storyModel extends model
*
* @param array $storyIdList
* @param int $grade
* @param string $storyType
*
* @access public
* @return string|null
*/
public function batchChangeGrade(array $storyIdList, int $grade): string|null
public function batchChangeGrade(array $storyIdList, int $grade, string $storyType = 'story'): string|null
{
$now = helper::now();
$account = $this->app->user->account;
@@ -1861,10 +1862,12 @@ class storyModel extends model
$sameRootList = '';
$gradeGtParentList = '';
$gradeOverflowList = '';
foreach($storyIdList as $storyID)
{
$oldStory = $oldStories[$storyID];
if($grade == $oldStory->grade) continue;
if($oldStory->type != $storyType) continue;
if($rootGroup[$oldStory->root] > 1)
{