* Fix bug #47166,47157.
This commit is contained in:
+1
-84
@@ -3168,6 +3168,7 @@ class storyModel extends model
|
||||
$stories = $this->dao->select('t1.id, t1.title, t1.module, t1.pri, t1.estimate, t2.name AS product')
|
||||
->from(TABLE_STORY)->alias('t1')->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
|
||||
->where('1=1')
|
||||
->andWhere('t1.vision')->like("%{$this->config->vision}%")
|
||||
->beginIF($productID)->andWhere('t1.product')->in($productID)->fi()
|
||||
->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi()
|
||||
->beginIF($branch !== 'all')->andWhere('t1.branch')->in("0,$branch")->fi()
|
||||
@@ -7050,88 +7051,4 @@ class storyModel extends model
|
||||
|
||||
return !dao::isError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get affect objects.
|
||||
*
|
||||
* @param mixed $objects
|
||||
* @param string $objectType
|
||||
* @param string $object
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getAffectObject($objects = '', $objectType = '', $objectInfo = '')
|
||||
{
|
||||
if(empty($objects) and empty($objectInfo)) return $objects;
|
||||
if(empty($objects) and $objectInfo) $objects = array($objectInfo->id => $objectInfo);
|
||||
|
||||
$objectIDList = array();
|
||||
$storyIDList = array();
|
||||
foreach($objects as $object)
|
||||
{
|
||||
if($this->app->rawModule == 'testtask') $object->id = $object->case;
|
||||
|
||||
$objectIDList[] = $object->id;
|
||||
$storyIDList[] = $objectType == 'story' ? $object->id : $object->story;
|
||||
$object->confirmeObject = array();
|
||||
$object->URs = '';
|
||||
}
|
||||
|
||||
/* 获取需要确认的用户需求id。 */
|
||||
$URs = $this->getStoryRelationByIds($storyIDList, 'story');
|
||||
$URIds = implode(',', $URs);
|
||||
if(!$URIds) return $objectInfo ? $objectInfo : $objects;
|
||||
|
||||
/* 查询最近一次撤回/移除操作。 */
|
||||
$lastActions = $this->dao->select('*')->from(TABLE_ACTION)
|
||||
->where('objectType')->eq('story')
|
||||
->andWhere('objectID')->in($URIds)
|
||||
->andWhere('action')->in('retractclosed,unlinkedfromroadmap')
|
||||
->orderBy('id_asc')
|
||||
->fetchAll('objectID');
|
||||
|
||||
/* 获取已经确认过的对象。*/
|
||||
$confirmedActions = $this->dao->select('*')->from(TABLE_ACTION)
|
||||
->where('objectType')->eq($objectType)
|
||||
->andWhere('objectID')->in($objectIDList)
|
||||
->andWhere('action')->in('confirmedretract,confirmedunlink')
|
||||
->orderBy('id_asc')
|
||||
->fetchAll('objectID');
|
||||
|
||||
/* 将确认信息插入到objects中并且过滤掉已经确认的用户需求。*/
|
||||
foreach($objects as $objectID => $object)
|
||||
{
|
||||
if($this->app->rawModule == 'testtask') $object->id = $object->case;
|
||||
$objectID = $object->id;
|
||||
$storyID = $objectType == 'story' ? $object->id : $object->story;
|
||||
$object->URs = isset($URs[$storyID]) ? $URs[$storyID] : '';
|
||||
if(!$object->URs) continue;
|
||||
|
||||
$objectURs = explode(',', $object->URs);
|
||||
$URAction = $objectAction = array();
|
||||
|
||||
foreach($objectURs as $URID)
|
||||
{
|
||||
if(!isset($lastActions[$URID])) continue;
|
||||
if($object->openedDate > $lastActions[$URID]->date) continue;
|
||||
|
||||
if(empty($URAction)) $URAction = $lastActions[$URID];
|
||||
if($URAction->date < $lastActions[$URID]->date) $URAction = $lastActions[$URID];
|
||||
|
||||
if(!isset($confirmedActions[$objectID])) continue;
|
||||
|
||||
$objectAction = $confirmedActions[$objectID];
|
||||
if($objectAction and $objectAction->date > $URAction->date) $URAction = array();
|
||||
}
|
||||
|
||||
if($URAction)
|
||||
{
|
||||
$actionType = $URAction->action == 'retractclosed' ? 'confirmedretract' : 'confirmedunlink';
|
||||
$object->confirmeObject = array('id' => $URAction->objectID, 'type' => $actionType);
|
||||
}
|
||||
}
|
||||
|
||||
if($objectInfo) return $objects[$objectInfo->id];
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user