* fix bug: Can not get correct data by 'byModule' or 'byProduct' browse type when browse tasks and stories in project module.

This commit is contained in:
chenfeiCF
2016-06-27 16:19:48 +08:00
parent dd1d6d1656
commit bfba4d244f
4 changed files with 15 additions and 10 deletions
+3 -3
View File
@@ -158,8 +158,8 @@ class project extends control
/* Set queryID, moduleID and productID. */
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
$moduleID = ($browseType == 'bymodule') ? (int)$param : ($browseType == 'bysearch' ? 0 : $this->cookie->moduleBrowseParam);
$productID = ($browseType == 'byproduct') ? (int)$param : ($browseType == 'bysearch' ? 0 : $this->cookie->productBrowseParam);
$moduleID = ($browseType == 'bymodule') ? (int)$param : (($browseType == 'bysearch' or $browseType == 'byproduct') ? 0 : $this->cookie->moduleBrowseParam);
$productID = ($browseType == 'byproduct') ? (int)$param : (($browseType == 'bysearch' or $browseType == 'bymodule') ? 0 : $this->cookie->productBrowseParam);
/* Save to session. */
$uri = $this->app->getURI(true);
@@ -249,7 +249,7 @@ class project extends control
/* Get tasks and group them. */
if(empty($groupBy))$groupBy = 'story';
$tasks = $this->loadModel('task')->getProjectTasks($projectID, $status = 'all', $modules = 0, $groupBy);
$tasks = $this->loadModel('task')->getProjectTasks($projectID, $productID = 0, $status = 'all', $modules = 0, $groupBy);
$groupBy = str_replace('`', '', $groupBy);
$taskLang = $this->lang->task;
$groupByList = array();
+9 -5
View File
@@ -766,9 +766,13 @@ class projectModel extends model
$this->loadModel('task');
/* Set modules and $browseType. */
$modules = 0;
if($productID) $modules = $this->loadModel('tree')->getProjectModule($projectID, $productID);
if($moduleID) $modules = $this->loadModel('tree')->getAllChildID($moduleID);
$modules = array();
if($productID)
{
$modules = $this->loadModel('tree')->getProjectModule($projectID, $productID);
$modules[0] = 0;
}
if($moduleID) $modules = $this->loadModel('tree')->getAllChildID($moduleID);
if($browseType == 'bymodule' or $browseType == 'byproduct')
{
if(($this->session->taskBrowseType) and ($this->session->taskBrowseType != 'bysearch')) $browseType = $this->session->taskBrowseType;
@@ -793,7 +797,7 @@ class projectModel extends model
unset($queryStatus['closed']);
$queryStatus = array_keys($queryStatus);
}
$tasks = $this->task->getProjectTasks($projectID, $queryStatus, $modules, $sort, $pager);
$tasks = $this->task->getProjectTasks($projectID, $productID, $queryStatus, $modules, $sort, $pager);
}
else
{
@@ -1234,7 +1238,7 @@ class projectModel extends model
$versions = $this->loadModel('story')->getVersions($this->post->stories);
foreach($this->post->stories as $key => $storyID)
{
$productID = $this->post->products[$key];
$productID = $this->post->products[$storyID];
$data = new stdclass();
$data->project = $projectID;
$data->product = $productID;
+1 -1
View File
@@ -45,7 +45,7 @@
<tr class='text-center'>
<td class='text-left'>
<input type='checkbox' name='stories[]' value='<?php echo $story->id;?>'/>
<input type='hidden' name='products[]' value='<?php echo $story->product;?>' />
<?php echo html::hidden("products[$story->id]", $story->product);?>
<?php echo html::a($storyLink, sprintf('%03d', $story->id));?>
</td>
<td><span class='<?php echo 'pri' . zget($lang->story->priList, $story->pri, $story->pri)?>'><?php echo zget($lang->story->priList, $story->pri, $story->pri);?></span></td>
+2 -1
View File
@@ -858,7 +858,7 @@ class taskModel extends model
* @access public
* @return array
*/
public function getProjectTasks($projectID, $type = 'all', $modules = 0, $orderBy = 'status_asc, id_desc', $pager = null)
public function getProjectTasks($projectID, $productID = 0, $type = 'all', $modules = 0, $orderBy = 'status_asc, id_desc', $pager = null)
{
if(is_string($type)) $type = strtolower($type);
$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')
@@ -867,6 +867,7 @@ class taskModel extends model
->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account')
->where('t1.project')->eq((int)$projectID)
->andWhere('t1.deleted')->eq(0)
->beginIF($productID)->andWhere('t2.product')->eq((int)$productID)->fi()
->beginIF($type == 'undone')->andWhere("(t1.status = 'wait' or t1.status ='doing')")->fi()
->beginIF($type == 'needconfirm')->andWhere('t2.version > t1.storyVersion')->andWhere("t2.status = 'active'")->fi()
->beginIF($type == 'assignedtome')->andWhere('t1.assignedTo')->eq($this->app->user->account)->fi()