This commit is contained in:
liumengyi
2022-06-15 15:04:31 +08:00
parent 023eaedf83
commit f75c14ea54
+7 -18
View File
@@ -2454,7 +2454,7 @@ class executionModel extends model
parse_str($extra, $output);
foreach($stories as $key => $storyID)
{
$notAllowedStatus = $this->app->rawMethod == 'batchcreate' ? 'closed' : 'draft,closed';
$notAllowedStatus = 'closed';
if(strpos($notAllowedStatus, $storyList[$storyID]->status) !== false) continue;
if(isset($linkedStories[$storyID])) continue;
@@ -2529,35 +2529,25 @@ class executionModel extends model
*/
public function linkStories($executionID)
{
$plans = $this->dao->select('product,plan')->from(TABLE_PROJECTPRODUCT)
$plans = $this->dao->select('plan')->from(TABLE_PROJECTPRODUCT)
->where('project')->eq($executionID)
->fetchPairs('product', 'plan');
->fetchAll();
$planStories = array();
$planProducts = array();
$count = 0;
$this->loadModel('story');
if(!empty($plans))
{
foreach($plans as $productID => $planIDList)
foreach($plans as $plan)
{
if(empty($planIDList)) continue;
$planIDList = explode(',', $planIDList);
if(empty($plan)) continue;
$planIDList = explode(',', $plan->plan);
foreach($planIDList as $planID)
{
$planStory = $this->story->getPlanStories($planID);
if(!empty($planStory))
{
foreach($planStory as $id => $story)
{
if($story->status == 'draft')
{
$count++;
unset($planStory[$id]);
continue;
}
$planProducts[$story->id] = $story->product;
}
foreach($planStory as $id => $story) $planProducts[$story->id] = $story->product;
$planStories = array_merge($planStories, array_keys($planStory));
}
}
@@ -2567,7 +2557,6 @@ class executionModel extends model
$projectID = $this->dao->select('project')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch('project');
$this->linkStory($executionID, $planStories, $planProducts);
if($this->config->systemMode == 'new') $this->linkStory($projectID, $planStories, $planProducts);
if($count != 0) echo js::alert(sprintf($this->lang->execution->haveDraft, $count)) . js::locate(helper::createLink('execution', 'create', "projectID=$projectID&executionID=$executionID"));
}
/**