* Finish task#65782,65779

This commit is contained in:
zenggang
2022-08-24 03:24:03 +00:00
parent cc010cb7f6
commit 73c8091a82
16 changed files with 108 additions and 29 deletions

View File

@@ -1152,9 +1152,13 @@ class bug extends control
}
if($bug->status == 'closed') $assignedToList['closed'] = 'Closed';
$branch = $product->type == 'branch' ? ($bug->branch > 0 ? $bug->branch . ',0' : '0') : '';
$productBugs = $this->bug->getProductBugPairs($productID, $branch);
$this->view->bug = $bug;
$this->view->productID = $productID;
$this->view->product = $product;
$this->view->productBugs = $productBugs;
$this->view->productName = $this->products[$productID];
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, $bug->branch, '', true);
$this->view->projects = array(0 => '') + $this->product->getProjectPairsByProduct($productID, $bug->branch, $bug->project);
@@ -1301,6 +1305,7 @@ class bug extends control
$branchIdList = array();
$projectIdList = array();
$executionIdList = array();
$productBugList = array();
foreach($bugs as $bug)
{
$projectIdList[$bug->project] = $bug->project;
@@ -1309,6 +1314,10 @@ class bug extends control
$branchIdList[$bug->product][$bug->branch] = $bug->branch;
if(!isset($modules[$bug->product][$bug->branch]) and isset($modules[$bug->product])) $modules[$bug->product][$bug->branch] = $modules[$bug->product][0] + $this->tree->getModulesName($bug->module);
$bugProduct = isset($productList) ? $productList[$bug->product] : $product;
$branch = $bugProduct->type == 'branch' ? ($bug->branch > 0 ? $bug->branch . ',0' : '0') : '';
if(!isset($productBugList[$bug->product][$bug->branch])) $productBugList[$bug->product][$bug->branch] = $this->bug->getProductBugPairs($bug->product, $branch);
}
/* Get assigned to member. */
@@ -1388,6 +1397,7 @@ class bug extends control
$this->view->users = $users;
$this->view->modules = $modules;
$this->view->branchTagOption = $branchTagOption;
$this->view->productBugList = $productBugList;
$this->display();
}
@@ -1797,17 +1807,22 @@ class bug extends control
if(!isset($users[$assignedTo])) $assignedTo = $this->bug->getModuleOwner($bug->module, $productID);
unset($this->lang->bug->resolutionList['tostory']);
$product = $this->loadModel('product')->getById($productID);
$branch = $product->type == 'branch' ? ($bug->branch > 0 ? $bug->branch . ',0' : '0') : '';
$productBugs = $this->bug->getProductBugPairs($productID, $branch);
$this->bug->checkBugExecutionPriv($bug);
$this->qa->setMenu($this->products, $productID, $bug->branch);
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->resolve;
$this->view->bug = $bug;
$this->view->users = $users;
$this->view->assignedTo = $assignedTo;
$this->view->executions = $this->loadModel('product')->getExecutionPairsByProduct($productID, $bug->branch ? "0,{$bug->branch}" : 0, 'id_desc', $projectID);
$this->view->builds = $this->loadModel('build')->getBuildPairs($productID, $bug->branch, 'withbranch');
$this->view->actions = $this->action->getList('bug', $bugID);
$this->view->execution = isset($execution) ? $execution : '';
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->resolve;
$this->view->bug = $bug;
$this->view->users = $users;
$this->view->assignedTo = $assignedTo;
$this->view->productBugs = $productBugs;
$this->view->executions = $this->loadModel('product')->getExecutionPairsByProduct($productID, $bug->branch ? "0,{$bug->branch}" : 0, 'id_desc', $projectID);
$this->view->builds = $this->loadModel('build')->getBuildPairs($productID, $bug->branch, 'withbranch');
$this->view->actions = $this->action->getList('bug', $bugID);
$this->view->execution = isset($execution) ? $execution : '';
$this->display();
}

View File

@@ -77,4 +77,10 @@ $(function()
{
hiddenRequireFields();
});
$('select[id^="duplicateBugs"]').picker(
{
disableEmptySearch : true,
dropWidth : 'auto'
});
});

View File

@@ -19,6 +19,12 @@ $(function()
}
});
}
$('#duplicateBug').picker(
{
disableEmptySearch : true,
dropWidth : 'auto'
});
});
/**

View File

@@ -45,4 +45,10 @@ $(function()
$('#newBuildExecutionBox').addClass('hidden');
}
})
$('#duplicateBug').picker(
{
disableEmptySearch : true,
dropWidth : 'auto'
});
})

View File

@@ -1998,12 +1998,13 @@ class bugModel extends model
* @access public
* @return void
*/
public function getProductBugPairs($productID)
public function getProductBugPairs($productID, $branch = '')
{
$bugs = array('' => '');
$data = $this->dao->select('id, title')->from(TABLE_BUG)
->where('product')->eq((int)$productID)
->beginIF(!$this->app->user->admin)->andWhere('execution')->in('0,' . $this->app->user->view->sprints)->fi()
->beginIF($branch !== '')->andWhere('branch')->in($branch)->fi()
->andWhere('deleted')->eq(0)
->orderBy('id desc')
->fetchAll();

View File

@@ -139,11 +139,11 @@
<td <?php echo zget($visibleFields, 'keywords', "class='hidden'")?>><?php echo html::input("keywords[$bugID]", $bug->keywords, 'class=form-control');?></td>
<td class='<?php echo zget($visibleFields, 'resolvedBy', ' hidden')?>' style='overflow:visible'><?php echo html::select("resolvedBys[$bugID]", $users, $bug->resolvedBy, "class='form-control picker-select' data-drop-width='auto'");?></td>
<td <?php echo zget($visibleFields, 'resolution', "class='hidden'")?>>
<table class='table-borderless table no-margin'>
<table class='table-borderless table no-margin table-form'>
<tr>
<td class='pd-0'><?php echo html::select("resolutions[$bugID]", $resolutionList, $bug->resolution, "class='form-control' onchange=setDuplicate(this.value,$bugID)");?></td>
<td class='pd-0 w-p50' id='<?php echo 'duplicateBugBox' . $bugID;?>' <?php if($bug->resolution != 'duplicate') echo "style='display:none'";?>>
<?php echo html::input("duplicateBugs[$bugID]", '', "class='form-control duplicate-input' placeholder='{$lang->bug->duplicateBug}'");?>
<?php echo html::select("duplicateBugs[$bugID]", $productBugList[$bug->product][$bug->branch], $bug->duplicateBug, "class='form-control' placeholder='{$lang->bug->duplicateBug}'");?>
</td>
</tr>
</table>

View File

@@ -265,7 +265,7 @@ if($this->app->tab == 'project') js::set('objectID', $bug->project);
</tr>
<tr id='duplicateBugBox' <?php if($bug->resolution != 'duplicate') echo "style='display:none'";?>>
<th><?php echo $lang->bug->duplicateBug;?></th>
<td><?php echo html::input('duplicateBug', $bug->duplicateBug, 'class=form-control');?></td>
<td><?php echo html::select('duplicateBug', $productBugs, $bug->duplicateBug, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->bug->closedBy;?></th>

View File

@@ -38,7 +38,7 @@ js::set('productID' , $bug->product);
</tr>
<tr id='duplicateBugBox' class='hide'>
<th><?php echo $lang->bug->duplicateBug;?></th>
<td class='required'><?php echo html::input('duplicateBug', '', "class='form-control'");?></td>
<td class='required'><?php echo html::select('duplicateBug', $productBugs, '', "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->bug->resolvedBuild;?></th>

View File

@@ -3652,7 +3652,8 @@ class executionModel extends model
->page($pager)
->fetchAll('id');
$tasks = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.product, t2.branch, t2.version AS latestStoryVersion, t2.status AS storyStatus, t3.realname AS assignedToRealName')
$orderBy = str_replace('pri_', 'priOrder_', $orderBy);
$tasks = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.product, t2.branch, t2.version AS latestStoryVersion, t2.status AS storyStatus, t3.realname AS assignedToRealName, IF(t1.`pri` = 0, 999, t1.`pri`) as priOrder')
->from(TABLE_TASK)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account')

View File

@@ -1023,7 +1023,8 @@ class story extends control
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? sprintf($this->lang->suhosinInfo, $countInputVars) : sprintf($this->lang->maxVarsInfo, $countInputVars);
/* Append module when change product type. */
$moduleList = array(0 => '/');
$moduleList = array(0 => '/');
$productStoryList = array();
foreach($stories as $story)
{
if(isset($modules[$story->product][$story->branch]))
@@ -1034,6 +1035,13 @@ class story extends control
{
$moduleList[$story->id] = $modules[$story->product][0] + $this->tree->getModulesName($story->module);
}
if($story->status == 'closed')
{
$storyProduct = $products[$story->product];
$branch = $storyProduct->type == 'branch' ? ($story->branch > 0 ? $story->branch : '0') : 'all';
if(!isset($productStoryList[$story->product][$story->branch])) $productStoryList[$story->product][$story->branch] = $this->story->getProductStoryPairs($story->product, $branch, 0, 'all', 'id_desc', 0, '');
}
}
$this->view->position[] = $this->lang->story->common;
@@ -1055,6 +1063,7 @@ class story extends control
$this->view->executionID = $executionID;
$this->view->branchTagOption = $branchTagOption;
$this->view->moduleList = $moduleList;
$this->view->productStoryList = $productStoryList;
$this->display();
}
@@ -1655,7 +1664,7 @@ class story extends control
}
/* Get story and product. */
$product = $this->dao->findById($story->product)->from(TABLE_PRODUCT)->fields('name, id')->fetch();
$product = $this->dao->findById($story->product)->from(TABLE_PRODUCT)->fields('name, id, type')->fetch();
$this->story->replaceURLang($story->type);
@@ -1666,16 +1675,20 @@ class story extends control
if($story->status == 'draft') unset($this->lang->story->reasonList['cancel']);
unset($this->lang->story->reasonList['subdivided']);
$branch = $product->type == 'branch' ? ($story->branch > 0 ? $story->branch : '0') : 'all';
$productStories = $this->story->getProductStoryPairs($story->product, $branch, 0, 'all', 'id_desc', 0, '');
$this->view->title = $this->lang->story->close . "STORY" . $this->lang->colon . $story->title;
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$story->branch"), $product->name);
$this->view->position[] = $this->lang->story->common;
$this->view->position[] = $this->lang->story->close;
$this->view->product = $product;
$this->view->story = $story;
$this->view->actions = $this->action->getList('story', $storyID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->reasonList = $this->lang->story->reasonList;
$this->view->product = $product;
$this->view->story = $story;
$this->view->productStories = $productStories;
$this->view->actions = $this->action->getList('story', $storyID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->reasonList = $this->lang->story->reasonList;
$this->display();
}
@@ -1697,6 +1710,8 @@ class story extends control
/* Get edited stories. */
$stories = $this->story->getByList($storyIdList);
$productStoryList = array();
$productList = array();
foreach($stories as $story)
{
if($story->parent == -1)
@@ -1709,6 +1724,10 @@ class story extends control
$closedStory[] = $story->id;
unset($stories[$story->id]);
}
$storyProduct = isset($productList[$story->product]) ? $productList[$story->product] : $this->product->getByID($story->product);
$branch = $storyProduct->type == 'branch' ? ($story->branch > 0 ? $story->branch : '0') : 'all';
if(!isset($productStoryList[$story->product][$story->branch])) $productStoryList[$story->product][$story->branch] = $this->story->getProductStoryPairs($story->product, $branch, 0, 'all', 'id_desc', 0, '');
}
if($this->post->comments)
@@ -1792,6 +1811,7 @@ class story extends control
$this->view->storyIdList = $storyIdList;
$this->view->storyType = $storyType;
$this->view->reasonList = $this->lang->story->reasonList;
$this->view->productStoryList = $productStoryList;
$this->display();
}

View File

@@ -1,7 +1,7 @@
/**
* Set duplicate field.
*
* @param string $resolution
*
* @param string $resolution
* @param int $storyID
* @access public
* @return void
@@ -24,3 +24,12 @@ function setDuplicateAndChild(resolution, storyID)
$('#childStoryBox' + storyID).hide();
}
}
$(function()
{
$('select[id^="duplicateStoryIDList"]').picker(
{
disableEmptySearch : true,
dropWidth : 'auto'
});
});

View File

@@ -51,6 +51,12 @@ $(function()
{
hiddenRequireFields();
});
$('select[id^="duplicateStoryIDList"]').picker(
{
disableEmptySearch : true,
dropWidth : 'auto'
});
});
$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();})//Save old value.

View File

@@ -16,3 +16,12 @@ function setStory(reason)
$('#childStoriesBox').hide();
}
}
$(function()
{
$('#duplicateStory').picker(
{
disableEmptySearch : true,
dropWidth : 'auto'
});
});

View File

@@ -43,8 +43,8 @@
<td class='pd-0'>
<?php echo html::select("closedReasons[$storyID]", $reasonList, 'done', "class=form-control onchange=setDuplicateAndChild(this.value,$storyID) style='min-width: 80px'");?>
</td>
<td class='pd-0 required' id='<?php echo 'duplicateStoryBox' . $storyID;?>' <?php if($story->closedReason != 'duplicate') echo "style='display:none'";?>>
<?php echo html::input("duplicateStoryIDList[$storyID]", '', "class='form-control' placeholder='{$lang->idAB}'");?>
<td class='pd-0 w-p50 required' id='<?php echo 'duplicateStoryBox' . $storyID;?>' <?php if($story->closedReason != 'duplicate') echo "style='display:none'";?>>
<?php echo html::select("duplicateStoryIDList[$storyID]", $productStoryList[$story->product][$story->branch], $story->duplicateStory, "class='form-control' placeholder='{$lang->idAB}'");?>
</td>
<td class='pd-0' id='<?php echo 'childStoryBox' . $storyID;?>' <?php if($story->closedReason != 'subdivided') echo "style='display:none'";?>>
<?php echo html::input("childStoriesIDList[$storyID]", '', "class='form-control' placeholder='{$lang->idAB}'");?>

View File

@@ -123,13 +123,13 @@ foreach(explode(',', $showFields) as $field)
<?php if($story->status == 'closed'):?>
<td <?php echo zget($visibleFields, 'closedReason', "class='hidden'")?>>
<table class='w-p100'>
<table class='w-p100 table-form'>
<tr>
<td class='pd-0'>
<?php echo html::select("closedReasons[$storyID]", $reasonList, $story->closedReason, "class=form-control onchange=setDuplicateAndChild(this.value,$storyID) style='min-width: 70px'");?>
</td>
<td class='pd-0' id='<?php echo 'duplicateStoryBox' . $storyID;?>' <?php if($story->closedReason != 'duplicate') echo "style='display: none'";?>>
<?php echo html::input("duplicateStoryIDList[$storyID]", '', "class='form-control' placeholder='{$lang->idAB}'");?>
<td class='pd-0 w-p50' id='<?php echo 'duplicateStoryBox' . $storyID;?>' <?php if($story->closedReason != 'duplicate') echo "style='display: none'";?>>
<?php echo html::select("duplicateStoryIDList[$storyID]", $productStoryList[$story->product][$story->branch], $story->duplicateStory, "class='form-control' placeholder='{$lang->idAB}'");?>
</td>
<td class='pd-0' id='<?php echo 'childStoryBox' . $storyID;?>' <?php if($story->closedReason != 'subdivided') echo "style='display: none'";?>>
<?php echo html::input("childStoriesIDList[$storyID]", '', "class='form-control' placeholder='{$lang->idAB}'");?>

View File

@@ -30,7 +30,7 @@
</tr>
<tr id='duplicateStoryBox' style='display:none'>
<th><?php echo $lang->story->duplicateStory;?></th>
<td class='required'><?php echo html::input('duplicateStory', '', "class='form-control'");?></td><td></td>
<td class='required'><?php echo html::select('duplicateStory', $productStories, '', 'class="form-control"'); ?></td><td></td>
</tr>
<tr id='childStoriesBox' style='display:none'>
<th><?php echo $lang->story->childStories;?></th>