From 760b816acde790e25b7a670cb2877342826efb15 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Thu, 31 Mar 2022 11:02:27 +0800 Subject: [PATCH 01/25] * Fix bug #14928. --- module/story/control.php | 15 ++++++++++----- module/story/model.php | 24 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/module/story/control.php b/module/story/control.php index 8a5e3f18eb..d82522d498 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -2329,9 +2329,10 @@ class story extends control } } - /* Get users, products and executions. */ - $users = $this->loadModel('user')->getPairs('noletter'); - $products = $this->product->getPairs('nocode'); + /* Get users, products and relations. */ + $users = $this->loadModel('user')->getPairs('noletter'); + $products = $this->product->getPairs('nocode'); + $relations = $this->story->getStoryRelationByIDs($storyIdList, $type); /* Get related objects id lists. */ $relatedProductIdList = array(); @@ -2347,6 +2348,8 @@ class story extends control $relatedBranchIdList[$story->branch] = $story->branch; $relatedStoryIDs[$story->id] = $story->id; + if(isset($relations[$story->id])) $story->linkStories = $story->linkStories . ',' . $relations[$story->id]; + /* Process related stories. */ $relatedStories = $story->childStories . ',' . $story->linkStories . ',' . $story->duplicateStory; $relatedStories = explode(',', $relatedStories); @@ -2363,7 +2366,7 @@ class story extends control /* Get related objects title or names. */ $productsType = $this->dao->select('id, type')->from(TABLE_PRODUCT)->where('id')->in($relatedProductIdList)->fetchPairs(); $relatedPlans = $this->dao->select('id, title')->from(TABLE_PRODUCTPLAN)->where('id')->in(join(',', $relatedPlanIdList))->fetchPairs(); - $relatedStories = $this->dao->select('id,title')->from(TABLE_STORY) ->where('id')->in($relatedStoryIdList)->fetchPairs(); + $relatedStories = $this->dao->select('id,title')->from(TABLE_STORY)->where('id')->in($relatedStoryIdList)->fetchPairs(); $relatedFiles = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('objectType')->eq('story')->andWhere('objectID')->in($storyIdList)->andWhere('extra')->ne('editor')->fetchGroup('objectID'); $relatedSpecs = $this->dao->select('*')->from(TABLE_STORYSPEC)->where('`story`')->in($storyIdList)->orderBy('version desc')->fetchGroup('story'); $relatedBranch = array('0' => $this->lang->branch->main) + $this->dao->select('id, name')->from(TABLE_BRANCH)->where('id')->in($relatedBranchIdList)->fetchPairs(); @@ -2432,10 +2435,12 @@ class story extends control if($story->linkStories) { - $tmpLinkStories = array(); + $tmpLinkStories = array(); $linkStoriesIdList = explode(',', $story->linkStories); foreach($linkStoriesIdList as $linkStoryID) { + if(empty($linkStoryID)) continue; + $linkStoryID = trim($linkStoryID); $tmpLinkStories[] = isset($relatedStories[$linkStoryID]) ? $relatedStories[$linkStoryID] : $linkStoryID; } diff --git a/module/story/model.php b/module/story/model.php index eab6a9657c..b1733f8b60 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -4388,6 +4388,30 @@ class storyModel extends model return $story; } + /** + * Get story relation by IDs. + * + * @param array $storyIdList + * @param string $storyType + * @access public + * @return array + */ + public function getStoryRelationByIDs($storyIdList, $storyType) + { + $conditionField = $storyType == 'story' ? 'BID' : 'AID'; + $storyType = $storyType == 'story' ? 'BID, GROUP_CONCAT(`AID` SEPARATOR ",")' : 'AID, GROUP_CONCAT(`BID` SEPARATOR ",")'; + + $relations = $this->dao->select($storyType)->from(TABLE_RELATION) + ->where('AType')->eq('requirement') + ->andWhere('BType')->eq('story') + ->andWhere('relation')->eq('subdivideinto') + ->andWhere($conditionField)->in($storyIdList) + ->groupBy($conditionField) + ->fetchPairs(); + + return $relations; + } + /** * Link a story. * From 77caa6c8c5bef85e932deb0aee7e7ac210c7ac7f Mon Sep 17 00:00:00 2001 From: liyuchun Date: Thu, 31 Mar 2022 13:43:35 +0800 Subject: [PATCH 02/25] * Fix bug #13324. --- module/misc/lang/en.php | 9 --------- module/misc/lang/zh-cn.php | 2 -- 2 files changed, 11 deletions(-) diff --git a/module/misc/lang/en.php b/module/misc/lang/en.php index f215b3e610..6e426afc9a 100644 --- a/module/misc/lang/en.php +++ b/module/misc/lang/en.php @@ -28,27 +28,18 @@ $lang->misc->zentao->icons['service'] = 'heart'; $lang->misc->zentao->about['bizversion'] = 'ZenTao Biz'; $lang->misc->zentao->about['official'] = "Official Website"; -$lang->misc->zentao->about['changelog'] = "Change Log"; $lang->misc->zentao->about['license'] = "License"; - - $lang->misc->zentao->support['vip'] = "VIP Support"; $lang->misc->zentao->support['manual'] = "User Manual"; - - - - $lang->misc->zentao->cowin['reportbug'] = "Report Bug "; $lang->misc->zentao->cowin['feedback'] = "Feedback"; $lang->misc->zentao->cowin['translate'] = "Translate"; $lang->misc->zentao->cowin['recommend'] = "More"; - $lang->misc->zentao->service['idc'] = 'ZenTao Cloud'; $lang->misc->zentao->service['custom'] = 'ZenTao Custom'; -$lang->misc->zentao->service['servicemore']= 'More'; global $config; $lang->misc->zentao->others['chanzhi'] = " Zsite"; diff --git a/module/misc/lang/zh-cn.php b/module/misc/lang/zh-cn.php index 7fdcc84c52..48c663e480 100644 --- a/module/misc/lang/zh-cn.php +++ b/module/misc/lang/zh-cn.php @@ -42,13 +42,11 @@ $lang->misc->zentao->support['qqgroup'] = "官方QQ群"; $lang->misc->zentao->cowin['reportbug'] = "汇报Bug"; $lang->misc->zentao->cowin['feedback'] = "反馈需求"; -$lang->misc->zentao->cowin['translate'] = "参与翻译"; $lang->misc->zentao->cowin['recommend'] = "推荐给朋友"; $lang->misc->zentao->service['zentaotrain']= '禅道使用培训'; $lang->misc->zentao->service['idc'] = '禅道在线托管'; $lang->misc->zentao->service['custom'] = '禅道定制开发'; -$lang->misc->zentao->service['servicemore']= '更多服务...'; global $config; $lang->misc->zentao->others['chanzhi'] = " 蝉知门户"; From 2fcabdfc3f89fd3be3f5350c6f6aa02284fdeef7 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Thu, 31 Mar 2022 17:08:28 +0800 Subject: [PATCH 03/25] * Modify api function for createLink. --- framework/api/helper.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/api/helper.class.php b/framework/api/helper.class.php index 393952e38d..e14d9edc95 100644 --- a/framework/api/helper.class.php +++ b/framework/api/helper.class.php @@ -153,16 +153,16 @@ class helper extends baseHelper * @access public * @return string */ - static public function createLink($moduleName, $methodName = 'index', $vars = '', $viewType = '', $onlyBody = false) + static public function createLink($moduleName, $methodName = 'index', $vars = '', $viewType = 'json', $onlyBody = false) { global $config; - $link = parent::createLink($moduleName, $methodName, $vars, 'html'); + $link = parent::createLink($moduleName, $methodName, $vars, $viewType); $pos = strpos($link, '.php'); /* The requestTypes are: GET, PATH_INFO2, PATH_INFO */ if($config->requestType == 'GET') { - $link = '/index' . substr($link, $pos); + $link = $config->webRoot . 'index' . substr($link, $pos); } elseif($config->requestType == 'PATH_INFO2') { From 4240b563c91707dd47397aa6d0a66f437e30978f Mon Sep 17 00:00:00 2001 From: liyuchun Date: Fri, 1 Apr 2022 10:27:27 +0800 Subject: [PATCH 04/25] * Fix bug #21061. --- module/todo/control.php | 6 ++++++ module/todo/view/view.html.php | 4 ---- module/user/view/todo.html.php | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/module/todo/control.php b/module/todo/control.php index 902196ed9a..4badd94c1f 100644 --- a/module/todo/control.php +++ b/module/todo/control.php @@ -375,6 +375,12 @@ class todo extends control if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'message' => '404 Not found')); return print(js::error($this->lang->notFound) . js::locate('back')); } + + if($todo->private and $todo->account != $this->app->user->account) + { + return print(js::error($this->lang->todo->thisIsPrivate) . js::locate('back')); + } + /* Save the session. */ if(!isonlybody()) { diff --git a/module/todo/view/view.html.php b/module/todo/view/view.html.php index 185a5daf75..f7540d8330 100644 --- a/module/todo/view/view.html.php +++ b/module/todo/view/view.html.php @@ -13,7 +13,6 @@ systemMode);?> -private or ($todo->private and $todo->account == $app->user->account)):?>