* Revert getRelatedObjects function.

This commit is contained in:
daitingting
2023-11-14 06:29:57 +00:00
parent 744e0950f4
commit 2ba2e28587
+29
View File
@@ -1761,6 +1761,35 @@ class bugModel extends model
return $activatedBugs;
}
/**
* Get related objects id lists.
*
* @param int $object
* @param string $pairs
* @access public
* @return void
*/
public function getRelatedObjects(string $object, string $pairs = ''): array
{
/* Get bugs. */
$bugs = $this->loadModel('transfer')->getQueryDatas('bug');
/* Get related objects id lists. */
$relatedObjectIdList = array();
$relatedObjects = array();
foreach($bugs as $bug) $relatedObjectIdList[$bug->$object] = $bug->$object;
if($object == 'openedBuild' or $object == 'resolvedBuild') $object = 'build';
/* Get related objects title or names. */
$table = $this->config->objectTables[$object];
if($table) $relatedObjects = $this->dao->select($pairs)->from($table)->where('id')->in($relatedObjectIdList)->fetchPairs();
if(in_array($object, array('build','resolvedBuild'))) $relatedObjects = array('trunk' => $this->lang->trunk) + $relatedObjects;
return array('' => '', 0 => '') + $relatedObjects;
}
/**
* 判断当前动作是否可以点击。
* Adjust the action is clickable.