From 2ba2e285873058a76a1de568dbb723af81f4acab Mon Sep 17 00:00:00 2001 From: daitingting Date: Tue, 14 Nov 2023 06:29:57 +0000 Subject: [PATCH] * Revert getRelatedObjects function. --- module/bug/model.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/module/bug/model.php b/module/bug/model.php index 84b602c4f2..216e7612da 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -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.