* fix for task #404

This commit is contained in:
wangyidong
2011-04-19 03:29:14 +00:00
parent 0dd6e1cc91
commit b1ebf9df91
4 changed files with 49 additions and 24 deletions
+4
View File
@@ -100,6 +100,9 @@ class product extends control
elseif($browseType == 'bymodule')
{
$childModuleIds = $this->tree->getAllChildID($moduleID);
$storyQuery = $this->dao->andWhere('product')->in($productID)->andWhere('module')->in($childModuleIds)->get();
$storyQuery = substr($storyQuery, strpos($storyQuery,'product'));
$this->session->set('storyReport', $storyQuery);
$stories = $this->story->getProductStories($productID, $childModuleIds, 'all', $orderBy, $pager);
}
elseif($browseType == 'bysearch')
@@ -121,6 +124,7 @@ class product extends control
{
if($this->session->storyQuery == false) $this->session->set('storyQuery', ' 1 = 1');
}
$this->session->set('storyReport', $this->session->storyQuery);
$stories = $this->story->getByQuery($productID, $this->session->storyQuery, $orderBy, $pager);
}
+15 -19
View File
@@ -736,7 +736,7 @@ class storyModel extends model
{
$datas = $this->dao->select('product as name, count(product) as value')->from(TABLE_STORY)
->where('deleted')->eq(0)
->beginIF($this->session->storyQuery != false)->andWhere($this->session->storyQuery)->fi()
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
->groupBy('product')->orderBy('value DESC')->fetchAll('name');
if(!$datas) return array();
$products = $this->loadModel('product')->getPairs();
@@ -754,7 +754,7 @@ class storyModel extends model
{
$datas = $this->dao->select('module as name, count(module) as value')->from(TABLE_STORY)
->where('deleted')->eq(0)
->beginIF($this->session->storyQuery != false)->andWhere($this->session->storyQuery)->fi()
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
->groupBy('module')->orderBy('value DESC')->fetchAll('name');
if(!$datas) return array();
$modules = $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in(array_keys($datas))->fetchPairs();
@@ -771,8 +771,7 @@ class storyModel extends model
{
$datas = $this->dao->select('plan as name, count(plan) as value')->from(TABLE_STORY)
->where('deleted')->eq(0)
->beginIF($this->session->storyQuery != false)->andWhere($this->session->storyQuery)->fi()
->andWhere('plan')->ne(0)
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
->groupBy('plan')->orderBy('value DESC')->fetchAll('name');
if(!$datas) return array();
$plans = $this->dao->select('id, title')->from(TABLE_PRODUCTPLAN)->where('id')->in(array_keys($datas))->fetchPairs();
@@ -789,7 +788,7 @@ class storyModel extends model
{
$datas = $this->dao->select('status as name, count(status) as value')->from(TABLE_STORY)
->where('deleted')->eq(0)
->beginIF($this->session->storyQuery != false)->andWhere($this->session->storyQuery)->fi()
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
->groupBy('status')->orderBy('value DESC')->fetchAll('name');
if(!$datas) return array();
foreach($datas as $status => $data) if(isset($this->lang->story->statusList[$status])) $data->name = $this->lang->story->statusList[$status];
@@ -805,11 +804,10 @@ class storyModel extends model
{
$datas = $this->dao->select('stage as name, count(stage) as value')->from(TABLE_STORY)
->where('deleted')->eq(0)
->beginIF($this->session->storyQuery != false)->andWhere($this->session->storyQuery)->fi()
->andWhere('stage')->ne('')
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
->groupBy('stage')->orderBy('value DESC')->fetchAll('name');
if(!$datas) return array();
foreach($datas as $stage => $data) if(isset($this->lang->story->stageList[$stage])) $data->name = $this->lang->story->stageList[$stage];
foreach($datas as $stage => $data) $data->name = $this->lang->story->stageList[$stage] != '' ? $this->lang->story->stageList[$stage] : $this->lang->report->undefined;
return $datas;
}
/**
@@ -822,7 +820,7 @@ class storyModel extends model
{
$datas = $this->dao->select('pri as name, count(pri) as value')->from(TABLE_STORY)
->where('deleted')->eq(0)
->beginIF($this->session->storyQuery != false)->andWhere($this->session->storyQuery)->fi()
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
->groupBy('pri')->orderBy('value DESC')->fetchAll('name');
if(!$datas) return array();
foreach($datas as $pri => $data) $data->name = $this->lang->story->priList[$pri] != '' ? $this->lang->story->priList[$pri] : $this->lang->report->undefined;
@@ -838,7 +836,7 @@ class storyModel extends model
{
return $this->dao->select('estimate as name, count(estimate) as value')->from(TABLE_STORY)
->where('deleted')->eq(0)
->beginIF($this->session->storyQuery != false)->andWhere($this->session->storyQuery)->fi()
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
->groupBy('estimate')->orderBy('value')->fetchAll();
}
/**
@@ -851,11 +849,11 @@ class storyModel extends model
{
$datas = $this->dao->select('openedBy as name, count(openedBy) as value')->from(TABLE_STORY)
->where('deleted')->eq(0)
->beginIF($this->session->storyQuery != false)->andWhere($this->session->storyQuery)->fi()
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
->groupBy('openedBy')->orderBy('value DESC')->fetchAll('name');
if(!$datas) return array();
if(!isset($this->users)) $this->users = $this->loadModel('user')->getPairs('noletter');
foreach($datas as $account => $data) if(isset($this->users[$account])) $data->name = $this->users[$account];
foreach($datas as $account => $data) $data->name = isset($this->users[$account]) ? $this->users[$account] : $this->lang->report->undefined;
return $datas;
}
/**
@@ -868,12 +866,11 @@ class storyModel extends model
{
$datas = $this->dao->select('assignedTo as name, count(assignedTo) as value')->from(TABLE_STORY)
->where('deleted')->eq(0)
->beginIF($this->session->storyQuery != false)->andWhere($this->session->storyQuery)->fi()
->andWhere('assignedTo')->ne('')
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
->groupBy('assignedTo')->orderBy('value DESC')->fetchAll('name');
if(!$datas) return array();
if(!isset($this->users)) $this->users = $this->loadModel('user')->getPairs('noletter');
foreach($datas as $account => $data) if(isset($this->users[$account])) $data->name = $this->users[$account];
foreach($datas as $account => $data) $data->name = $this->users[$account] != '' ? $this->users[$account] : $this->lang->report->undefined;
return $datas;
}
/**
@@ -886,11 +883,10 @@ class storyModel extends model
{
$datas = $this->dao->select('closedReason as name, count(closedReason) as value')->from(TABLE_STORY)
->where('deleted')->eq(0)
->beginIF($this->session->storyQuery != false)->andWhere($this->session->storyQuery)->fi()
->andWhere('closedReason')->ne('')
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
->groupBy('closedReason')->orderBy('value DESC')->fetchAll('name');
if(!$datas) return array();
foreach($datas as $reason => $data) if(isset($this->lang->story->reasonList[$reason])) $data->name = $this->lang->story->reasonList[$reason];
foreach($datas as $reason => $data) $data->name = $this->lang->story->reasonList[$reason] != '' ? $this->lang->story->reasonList[$reason] : $this->lang->report->undefined;
return $datas;
}
/**
@@ -903,7 +899,7 @@ class storyModel extends model
{
return $this->dao->select('(version-1) as name, count(*) as value')->from(TABLE_STORY)
->where('deleted')->eq(0)
->beginIF($this->session->storyQuery != false)->andWhere($this->session->storyQuery)->fi()
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
->groupBy('version')->orderBy('value')->fetchAll();
}
}
+24 -2
View File
@@ -15,7 +15,29 @@ function syncModule(rootID)
});
$.each(modules, function(key, value)
{
if(value) $('#moduleBox').append("<span><input name=modules[] value=" + value + " style=margin-bottom:5px class=text-3 /><br /><span>");
if(value) $('#sonModule').append("<span><input name=modules[] value=" + value + " style=margin-bottom:5px class=text-3 /><br /><span>");
})
})
}
function syncProductModule(rootID)
{
link = createLink('tree', 'ajaxGetSonModules', 'moduleID=' + $('#productModule').val() + '&rootID=' + rootID);
$.getJSON(link, function(modules)
{
$('.helplink').addClass('hidden');
$.each(modules, function(key, value)
{
moduleName = value;
$('.text-3').each(function()
{
if(this.value == moduleName) modules[key] = null;
if(!this.value) $(this).parent().addClass('hidden');
})
});
$('#sonModule').empty();
$.each(modules, function(key, value)
{
if(value) $('#sonModule').append("<span><input name=modules[] value=" + value + " style=margin-bottom:5px class=text-3 /><br /><span>");
})
})
}
@@ -31,7 +53,7 @@ function syncProduct(obj)
$('#productModule').append('<option value=' + key + '>' + value + '</option')
});
})
$('#copyModule').attr('onclick', 'syncModule('+obj.value+')');
$('#copyModule').attr('onclick', 'syncProductModule('+obj.value+')');
}
$(document).ready(function()
{
+6 -3
View File
@@ -60,19 +60,22 @@
else if($viewType == 'story')
{
echo html::select('allProduct', $allProduct, $rootID, 'class=select-3 onchange=syncProduct(this)');
echo '<br>';
echo html::select('productModule', $productModules, '', 'class=select-3');
echo html::commonButton($lang->tree->syncFromProduct, 'id=copyModule onclick=syncModule('.$rootID.')');
echo html::commonButton($lang->tree->syncFromProduct, 'id=copyModule onclick=syncProductModule('.$rootID.')');
echo '<br />';
echo '<br />';
echo '<br />';
}
$maxOrder = 0;
echo '<div id=sonModule>';
foreach($sons as $sonModule)
{
if($sonModule->order > $maxOrder) $maxOrder = $sonModule->order;
echo '<span>' . html::input("modules[id$sonModule->id]", $sonModule->name, 'class=text-3 style="margin-bottom:5px"') . '<br /></span>';
}
for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) echo '<span>' . html::input("modules[]", '', 'class=text-3 style="margin-bottom:5px"') . '<br /></span>';
?>
?>
</div>
</td>
</tr>
<tr>