From baee1497210a76d97cdb041a3d3f568c1c08ffcf Mon Sep 17 00:00:00 2001 From: wangjianhua Date: Tue, 11 Oct 2022 17:23:55 +0800 Subject: [PATCH 1/8] * Add action logs and check privileges for linking project and Repos. --- module/action/lang/de.php | 1 + module/action/lang/en.php | 1 + module/action/lang/fr.php | 1 + module/action/lang/vi.php | 1 + module/action/lang/zh-cn.php | 1 + module/action/lang/zh-tw.php | 1 + module/project/control.php | 2 +- module/project/model.php | 3 +++ module/repo/model.php | 23 +++++++++++++++++++++++ 9 files changed, 33 insertions(+), 1 deletion(-) diff --git a/module/action/lang/de.php b/module/action/lang/de.php index d9ae130817..8ab3ea30d1 100644 --- a/module/action/lang/de.php +++ b/module/action/lang/de.php @@ -392,6 +392,7 @@ $lang->action->label->updatetolib = 'updated'; $lang->action->label->ganttmove = 'sorted'; $lang->action->label->submitreview = 'submitted'; $lang->action->label->switchtolean = 'switch from new mode to lean mode'; +$lang->action->label->managerepo = 'Linked Code Repo'; /* Dynamic information is grouped by object. */ $lang->action->dynamicAction = new stdclass; diff --git a/module/action/lang/en.php b/module/action/lang/en.php index 2f9aecbe2a..611d256cc0 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -392,6 +392,7 @@ $lang->action->label->updatetolib = 'updated'; $lang->action->label->ganttmove = 'sorted'; $lang->action->label->submitreview = 'submitted'; $lang->action->label->switchtolean = 'switch from new mode to lean mode'; +$lang->action->label->managerepo = 'Linked Code Repo'; /* Dynamic information is grouped by object. */ $lang->action->dynamicAction = new stdclass; diff --git a/module/action/lang/fr.php b/module/action/lang/fr.php index 1115ad45fc..5285b9e7c7 100644 --- a/module/action/lang/fr.php +++ b/module/action/lang/fr.php @@ -392,6 +392,7 @@ $lang->action->label->updatetolib = 'MàJ'; $lang->action->label->ganttmove = 'sorted'; $lang->action->label->submitreview = 'submitted'; $lang->action->label->switchtolean = 'switch from new mode to lean mode'; +$lang->action->label->managerepo = 'Linked Code Repo'; /* Dynamic information is grouped by object. */ $lang->action->dynamicAction = new stdclass(); diff --git a/module/action/lang/vi.php b/module/action/lang/vi.php index cc7eb8e729..8f676db7f9 100644 --- a/module/action/lang/vi.php +++ b/module/action/lang/vi.php @@ -306,6 +306,7 @@ $lang->action->label->syncproject = 'start'; $lang->action->label->syncexecution = 'start'; $lang->action->label->startProgram = '(The start of the project sets the status of the program as Ongoing)'; $lang->action->label->submitreview = 'submitted'; +$lang->action->label->managerepo = 'Linked Code Repo'; /* Dynamic information is grouped by object. */ $lang->action->dynamicAction = new stdclass; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index 4cfa4abfe3..46b8a4697f 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -392,6 +392,7 @@ $lang->action->label->updatetolib = '更新了'; $lang->action->label->ganttmove = '排序了'; $lang->action->label->submitreview = '提交了评审'; $lang->action->label->switchtolean = '从综合模式切换为迅捷模式'; +$lang->action->label->managerepo = '关联了代码库'; /* 动态信息按照对象分组 */ $lang->action->dynamicAction = new stdclass(); diff --git a/module/action/lang/zh-tw.php b/module/action/lang/zh-tw.php index f9785a8b16..7c3a37156e 100755 --- a/module/action/lang/zh-tw.php +++ b/module/action/lang/zh-tw.php @@ -324,6 +324,7 @@ $lang->action->label->importfromgitlab = '從Gitlab關聯創建了'; $lang->action->label->archived = '歸檔了'; $lang->action->label->restore = '還原了'; $lang->action->label->mergedbranch = '合併分支'; +$lang->action->label->managerepo = '關聯了代碼庫'; /* 動態信息按照對象分組 */ $lang->action->dynamicAction = new stdclass(); diff --git a/module/project/control.php b/module/project/control.php index b9e5ee4e3d..eef854f4bb 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -2297,7 +2297,7 @@ class project extends control } $this->view->title = $this->lang->project->manageRepo; - $this->view->allRepos = $this->dao->select('*')->from(TABLE_REPO)->where('deleted')->eq(0)->fetchPairs('id', 'name'); + $this->view->allRepos = $this->loadModel('repo')->repoPairsForCurrentUser(); $this->view->linkedRepos = $this->project->linkedRepoPairs($projectID); $this->view->unlinkedRepos = array(); diff --git a/module/project/model.php b/module/project/model.php index 8a1985aab0..6a9697a7ec 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -2900,6 +2900,9 @@ class projectModel extends model $this->dao->insert(TABLE_RELATION)->data($newRelation)->exec(); } + + $this->loadModel('action'); + $this->action->create('project', $projectID, 'manageRepo'); } /** diff --git a/module/repo/model.php b/module/repo/model.php index 77b8f92c71..db33da33d4 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -382,6 +382,29 @@ class repoModel extends model return $repoPairs; } + /** + * Get Repo pairs under current user privileges. + * + * @access public + * @return array + */ + public function repoPairsForCurrentUser() + { + $repos = $this->dao->select('*')->from(TABLE_REPO)->where('deleted')->eq(0)->fetchAll(); + + $repoPairs = array(); + foreach($repos as $repo) + { + $repo->acl = json_decode($repo->acl); + if($this->checkPriv($repo)) + { + $repoPairs[$repo->id] = $repo->name; + } + } + + return $repoPairs; + } + /** * Get repos group by repo type. * From 9cee91d4feaa333cb4ba3e41ceb129fea6eb851a Mon Sep 17 00:00:00 2001 From: wangjianhua Date: Tue, 11 Oct 2022 17:27:57 +0800 Subject: [PATCH 2/8] * Improve codes format. --- module/repo/model.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/module/repo/model.php b/module/repo/model.php index db33da33d4..b7cd37a99a 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -396,10 +396,7 @@ class repoModel extends model foreach($repos as $repo) { $repo->acl = json_decode($repo->acl); - if($this->checkPriv($repo)) - { - $repoPairs[$repo->id] = $repo->name; - } + if($this->checkPriv($repo)) $repoPairs[$repo->id] = $repo->name; } return $repoPairs; From dd5b88552e1e91390f89265dcae03908ba1eede9 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 11 Oct 2022 15:54:40 +0800 Subject: [PATCH 3/8] * code for task #71660.#71661,#71662,#71663,#71664,#71665. --- module/common/lang/menu.php | 2 +- module/my/control.php | 31 ++--- module/my/lang/de.php | 15 +++ module/my/lang/en.php | 15 +++ module/my/lang/fr.php | 15 +++ module/my/lang/zh-cn.php | 15 +++ module/my/model.php | 234 ++++++++++++++++++++++++++++++++++ module/my/view/audit.html.php | 163 +++++++++++++++-------- module/my/view/task.html.php | 4 +- 9 files changed, 417 insertions(+), 77 deletions(-) diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index ab5add374f..362136ace9 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -96,7 +96,7 @@ $lang->my->menu->work['subMenu']->story = "$lang->SRCommon|my|work|mode=st $lang->my->menu->work['subMenu']->bug = "{$lang->bug->common}|my|work|mode=bug"; $lang->my->menu->work['subMenu']->testcase = array('link' => "{$lang->testcase->common}|my|work|mode=testcase&type=assigntome", 'subModule' => 'testtask'); $lang->my->menu->work['subMenu']->testtask = "{$lang->testtask->common}|my|work|mode=testtask&type=wait"; -$lang->my->menu->work['subMenu']->audit = array('link' => "{$lang->review->common}|my|work|mode=audit", 'subModule' => 'review'); +$lang->my->menu->work['subMenu']->audit = array('link' => "{$lang->review->common}|my|work|mode=audit&type=all¶m=&orderBy=time_desc", 'subModule' => 'review'); $lang->my->menu->work['menuOrder'][5] = 'task'; $lang->my->menu->work['menuOrder'][10] = 'requirement'; diff --git a/module/my/control.php b/module/my/control.php index 358d63a930..0455646653 100755 --- a/module/my/control.php +++ b/module/my/control.php @@ -182,8 +182,7 @@ class my extends control $riskCount = $pager->recTotal; /* Get the number of reviews assigned to me. */ - $pendingList = $this->loadModel('approval')->getPendingReviews('review'); - $reviewList = $this->review->getByList($pendingList, 'id_desc', $pager); + $reviewList = $this->my->getReviewList('all', 'time_desc', $pager); $reviewCount = $pager->recTotal; /* Get the number of nc assigned to me. */ @@ -221,6 +220,7 @@ if(isMax !== 0) { var issueCount = $issueCount; var riskCount = $riskCount; + var qaCount = $qaCount; var meetingCount = $meetingCount; } @@ -939,6 +939,7 @@ EOF; * My audits. * * @param string $browseType + * @param string $param * @param string $orderBy * @param int $recTotal * @param int $recPerPage @@ -946,32 +947,22 @@ EOF; * @access public * @return void */ - public function audit($browseType = 'needreview', $orderBy = 't1.id_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1) + public function audit($browseType = 'all', $param = 0, $orderBy = 'time_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1) { $this->app->loadClass('pager', true); $pager = pager::init($recTotal, $recPerPage, $pageID); - $reviewList = array(); - if($this->config->edition == 'max') + if($this->config->edition == 'max' and ($browseType == 'reviewedbyme' or $browseType == 'createdbyme')) { - $this->loadModel('datatable'); - $this->loadModel('baseline'); - $this->app->loadLang('review'); $this->session->set('reviewList', $this->app->getURI(true)); - $pendingList = $this->loadModel('approval')->getPendingReviews('review'); - if($browseType == 'needreview') - { - $reviewList = $this->loadModel('review')->getByList($pendingList, $orderBy, $pager); - } - else - { - $reviewList = $this->loadModel('review')->getUserReviews($browseType, $orderBy, $pager); - } - $this->view->products = $this->my->getProductPairs(); - $this->view->pendingList = $pendingList; + $reviewList = $this->loadModel('review')->getUserReviews($browseType, $orderBy, $pager); + } + else + { + $reviewList = $this->my->getReviewList($browseType, $orderBy, $pager); } - $this->view->title = $this->lang->my->myReview; + $this->view->title = $this->lang->review->common; $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); $this->view->reviewList = $reviewList; $this->view->recTotal = $recTotal; diff --git a/module/my/lang/de.php b/module/my/lang/de.php index a20327ed31..01f7d19556 100644 --- a/module/my/lang/de.php +++ b/module/my/lang/de.php @@ -80,6 +80,20 @@ $lang->my->storyMenu->reviewedByMe = 'ReviewedByMe'; $lang->my->storyMenu->closedByMe = 'ClosedByMe'; $lang->my->storyMenu->assignedByMe = 'AssignedByMe'; +$lang->my->audit = new stdclass(); +$lang->my->audit->title = 'Title'; +$lang->my->audit->time = 'Time'; +$lang->my->audit->type = 'Type'; +$lang->my->audit->status = 'Status'; + +$lang->my->auditMenu = new stdclass(); +$lang->my->auditMenu->all = 'All'; +$lang->my->auditMenu->story = 'Story'; +$lang->my->auditMenu->testcase = 'Case'; +if($config->edition == 'max' and strpos(",$config->disabledFeatures,", ',waterfall,') === false) $lang->my->auditMenu->project = 'Project'; +if($config->edition != 'open') $lang->my->auditMenu->feedback = 'Feedback'; +if($config->edition != 'open') $lang->my->auditMenu->oa = 'OA'; + $lang->my->projectMenu = new stdclass(); $lang->my->projectMenu->doing = 'Doing'; $lang->my->projectMenu->wait = 'Waiting'; @@ -120,6 +134,7 @@ $lang->my->executionLinkList['execution-all'] = 'Enter the execution $lang->my->executionLinkList['execution-task'] = 'By default, enter the list of the most recently executed task, and you can view the task information under the current iteration'; $lang->my->executionLinkList['execution-executionkanban'] = 'By default, you can enter the execution Kanban to view the execution status of projects in progress'; +$lang->my->confirmReview = 'Do you want to pass it?'; $lang->my->guideChangeTheme = <<"Young Blue" theme is available now!

diff --git a/module/my/lang/en.php b/module/my/lang/en.php index 185ad56a1a..21daaedf37 100644 --- a/module/my/lang/en.php +++ b/module/my/lang/en.php @@ -80,6 +80,20 @@ $lang->my->storyMenu->reviewedByMe = 'ReviewedByMe'; $lang->my->storyMenu->closedByMe = 'ClosedByMe'; $lang->my->storyMenu->assignedByMe = 'AssignedByMe'; +$lang->my->audit = new stdclass(); +$lang->my->audit->title = 'Title'; +$lang->my->audit->time = 'Time'; +$lang->my->audit->type = 'Type'; +$lang->my->audit->status = 'Status'; + +$lang->my->auditMenu = new stdclass(); +$lang->my->auditMenu->all = 'All'; +$lang->my->auditMenu->story = 'Story'; +$lang->my->auditMenu->testcase = 'Case'; +if($config->edition == 'max' and strpos(",$config->disabledFeatures,", ',waterfall,') === false) $lang->my->auditMenu->project = 'Project'; +if($config->edition != 'open') $lang->my->auditMenu->feedback = 'Feedback'; +if($config->edition != 'open') $lang->my->auditMenu->oa = 'OA'; + $lang->my->projectMenu = new stdclass(); $lang->my->projectMenu->doing = 'Doing'; $lang->my->projectMenu->wait = 'Waiting'; @@ -120,6 +134,7 @@ $lang->my->executionLinkList['execution-all'] = 'Enter the execution $lang->my->executionLinkList['execution-task'] = 'By default, enter the list of the most recently executed task, and you can view the task information under the current iteration'; $lang->my->executionLinkList['execution-executionkanban'] = 'By default, you can enter the execution Kanban to view the execution status of projects in progress'; +$lang->my->confirmReview = 'Do you want to pass it?'; $lang->my->guideChangeTheme = <<"Young Blue" theme is available now!

diff --git a/module/my/lang/fr.php b/module/my/lang/fr.php index a20327ed31..01f7d19556 100644 --- a/module/my/lang/fr.php +++ b/module/my/lang/fr.php @@ -80,6 +80,20 @@ $lang->my->storyMenu->reviewedByMe = 'ReviewedByMe'; $lang->my->storyMenu->closedByMe = 'ClosedByMe'; $lang->my->storyMenu->assignedByMe = 'AssignedByMe'; +$lang->my->audit = new stdclass(); +$lang->my->audit->title = 'Title'; +$lang->my->audit->time = 'Time'; +$lang->my->audit->type = 'Type'; +$lang->my->audit->status = 'Status'; + +$lang->my->auditMenu = new stdclass(); +$lang->my->auditMenu->all = 'All'; +$lang->my->auditMenu->story = 'Story'; +$lang->my->auditMenu->testcase = 'Case'; +if($config->edition == 'max' and strpos(",$config->disabledFeatures,", ',waterfall,') === false) $lang->my->auditMenu->project = 'Project'; +if($config->edition != 'open') $lang->my->auditMenu->feedback = 'Feedback'; +if($config->edition != 'open') $lang->my->auditMenu->oa = 'OA'; + $lang->my->projectMenu = new stdclass(); $lang->my->projectMenu->doing = 'Doing'; $lang->my->projectMenu->wait = 'Waiting'; @@ -120,6 +134,7 @@ $lang->my->executionLinkList['execution-all'] = 'Enter the execution $lang->my->executionLinkList['execution-task'] = 'By default, enter the list of the most recently executed task, and you can view the task information under the current iteration'; $lang->my->executionLinkList['execution-executionkanban'] = 'By default, you can enter the execution Kanban to view the execution status of projects in progress'; +$lang->my->confirmReview = 'Do you want to pass it?'; $lang->my->guideChangeTheme = <<"Young Blue" theme is available now!

diff --git a/module/my/lang/zh-cn.php b/module/my/lang/zh-cn.php index 17feb11ba9..4a651dd083 100644 --- a/module/my/lang/zh-cn.php +++ b/module/my/lang/zh-cn.php @@ -80,6 +80,20 @@ $lang->my->storyMenu->reviewedByMe = '由我评审'; $lang->my->storyMenu->closedByMe = '由我关闭'; $lang->my->storyMenu->assignedByMe = '由我指派'; +$lang->my->audit = new stdclass(); +$lang->my->audit->title = '评审标题'; +$lang->my->audit->time = '提交时间'; +$lang->my->audit->type = '类型'; +$lang->my->audit->status = '状态'; + +$lang->my->auditMenu = new stdclass(); +$lang->my->auditMenu->all = '所有'; +$lang->my->auditMenu->story = '需求'; +$lang->my->auditMenu->testcase = '用例'; +if($config->edition == 'max' and strpos(",$config->disabledFeatures,", ',waterfall,') === false) $lang->my->auditMenu->project = '项目'; +if($config->edition != 'open') $lang->my->auditMenu->feedback = '反馈'; +if($config->edition != 'open') $lang->my->auditMenu->oa = '办公'; + $lang->my->projectMenu = new stdclass(); $lang->my->projectMenu->doing = '进行中'; $lang->my->projectMenu->wait = '未开始'; @@ -120,6 +134,7 @@ $lang->my->executionLinkList['execution-all'] = '默认进入执行 $lang->my->executionLinkList['execution-task'] = '默认进入最近一个执行的任务列表,可以查看当前迭代下的任务信息'; $lang->my->executionLinkList['execution-executionkanban'] = '默认进入执行看板,可以查看进行中项目的执行情况'; +$lang->my->confirmReview = '您确定要执行通过操作吗?'; $lang->my->guideChangeTheme = <<全新“青春蓝”主题上线了!

diff --git a/module/my/model.php b/module/my/model.php index 52b5a6f647..8871e363df 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -968,4 +968,238 @@ class myModel extends model return $requirements; } + /** + * Get review list for me. + * + * @param string $browseType + * @param string $orderBy + * @param object $pager + * @access public + * @return array + */ + public function getReviewList($browseType, $orderBy = 'time_desc', $pager = null) + { + if($this->app->rawMethod != 'work') return array(); + $reviewList = array(); + if($browseType == 'all' or $browseType == 'story') $reviewList = array_merge($reviewList, $this->getReviewingStories()); + if($browseType == 'all' or $browseType == 'testcase') $reviewList = array_merge($reviewList, $this->getReviewingCases()); + if($browseType == 'all' or $browseType == 'project') $reviewList = array_merge($reviewList, $this->getReviewingApprovals()); + if($browseType == 'all' or $browseType == 'feedback') $reviewList = array_merge($reviewList, $this->getReviewingFeedbacks()); + if($browseType == 'all' or $browseType == 'oa') $reviewList = array_merge($reviewList, $this->getReviewingOA()); + + if(empty($reviewList)) return array(); + + $field = $orderBy; + $direction = 'asc'; + if(strpos($orderBy, '_') !== false) list($field, $direction) = explode('_', $orderBy); + + /* Sort review. */ + $reviewGroup = array(); + foreach($reviewList as $review) + { + if(!isset($review->$field)) $field = 'time'; + $reviewGroup[$review->$field][] = $review; + } + if($direction == 'asc') ksort($reviewGroup); + if($direction == 'desc') krsort($reviewGroup); + + $reviewList = array(); + foreach($reviewGroup as $reviews) $reviewList = array_merge($reviewList, $reviews); + + /* Pager. */ + $pager->setRecTotal(count($reviewList)); + $pager->setPageTotal(); + $pager->setPageID($pager->pageID); + $reviewList = array_chunk($reviewList, $pager->recPerPage); + $reviewList = $reviewList[$pager->pageID - 1]; + + return $reviewList; + } + + /** + * Get reviewing stories. + * + * @param string $orderBy + * @access public + * @return array + */ + public function getReviewingStories($orderBy = 'id_desc') + { + if(!common::hasPriv('story', 'review')) return array(); + + $this->app->loadLang('story'); + $stmt = $this->dao->select("t1.*")->from(TABLE_STORY)->alias('t1') + ->leftJoin(TABLE_STORYREVIEW)->alias('t2')->on('t1.id = t2.story and t1.version = t2.version') + ->where('t1.deleted')->eq(0) + ->beginIF(!$this->app->user->admin)->andWhere('t1.product')->in($this->app->user->view->products)->fi() + ->andWhere('t2.reviewer')->eq($this->app->user->account) + ->andWhere('t2.result')->eq('') + ->andWhere('t1.status')->eq('reviewing') + ->orderBy($orderBy) + ->query(); + + $stories = array(); + while($data = $stmt->fetch()) + { + $story = new stdclass(); + $story->id = $data->id; + $story->title = $data->title; + $story->type = 'story'; + $story->time = $data->openedDate; + $story->status = $data->status; + $stories[$story->id] = $story; + } + + $actions = $this->dao->select('objectID,`date`')->from(TABLE_ACTION)->where('objectType')->eq('story')->andWhere('objectID')->in(array_keys($stories))->andWhere('action')->eq('submitreview')->orderBy('`date`')->fetchPairs('objectID', 'date'); + foreach($actions as $storyID => $date) $stories[$storyID]->time = $date; + return array_values($stories); + } + + /** + * Get reviewing cases. + * + * @param string $orderBy + * @access public + * @return array + */ + public function getReviewingCases($orderBy = 'id_desc') + { + if(!common::hasPriv('testcase', 'review')) return array(); + + $this->app->loadLang('testcase'); + $stmt = $this->dao->select('*')->from(TABLE_CASE) + ->where('deleted')->eq('0') + ->andWhere('status')->eq('wait') + ->beginIF(!$this->app->user->admin)->andWhere('product')->in($this->app->user->view->products)->fi() + ->orderBy($orderBy) + ->query(); + + $cases = array(); + while($data = $stmt->fetch()) + { + $case = new stdclass(); + $case->id = $data->id; + $case->title = $data->title; + $case->type = 'testcase'; + $case->time = $data->openedDate; + $case->status = $data->status; + $cases[$case->id] = $case; + } + + return array_values($cases); + } + + /** + * Get reviewing approvals. + * + * @param string $orderBy + * @access public + * @return array + */ + public function getReviewingApprovals($orderBy = 'id_desc') + { + if(!common::hasPriv('review', 'assess')) return array(); + if($this->config->edition != 'max') return array(); + + $pendingList = $this->loadModel('approval')->getPendingReviews('review'); + $projectReviews = $this->loadModel('review')->getByList($pendingList, $orderBy); + + $this->app->loadLang('project'); + $this->session->set('reviewList', $this->app->getURI(true)); + + $reviewList = array(); + foreach($projectReviews as $review) + { + if(!isset($pendingList[$review->id])) continue; + + $data = new stdclass(); + $data->id = $review->id; + $data->title = $review->title; + $data->type = 'project'; + $data->time = $review->createdDate; + $data->status = $review->status; + $reviewList[] = $data; + } + return $reviewList; + } + + /** + * Get reviewing feedbacks. + * + * @param string $orderBy + * @access public + * @return array + */ + public function getReviewingFeedbacks($orderBy = 'id_desc') + { + if(!common::hasPriv('feedback', 'review')) return array(); + if($this->config->edition == 'open') return array(); + + $feedbacks = $this->loadModel('feedback')->getList('review', $orderBy); + $reviewList = array(); + foreach($feedbacks as $feedback) + { + $data = new stdclass(); + $data->id = $feedback->id; + $data->title = $feedback->title; + $data->type = 'feedback'; + $data->time = $feedback->openedDate; + $data->status = $feedback->status; + $reviewList[] = $data; + } + return $reviewList; + } + + /** + * Get reviewing OA. + * + * @param string $orderBy + * @access public + * @return array + */ + public function getReviewingOA($orderBy = 'status') + { + if($this->config->edition == 'open') return array(); + + $users = $this->loadModel('user')->getPairs('noletter'); + $account = $this->app->user->account; + + /* Get dept info. */ + $allDeptList = $this->loadModel('dept')->getPairs('', 'dept'); + $allDeptList['0'] = '/'; + $managedDeptList = array(); + $tmpDept = $this->dept->getDeptManagedByMe($account); + foreach($tmpDept as $d) $managedDeptList[$d->id] = $d->name; + + $oa = array(); + if(common::hasPriv('attend', 'review')) $oa['attend'] = $this->getReviewingAttends($allDeptList, $managedDeptList); + if(common::hasPriv('leave', 'review')) $oa['leave'] = $this->getReviewingLeaves($allDeptList, $managedDeptList, $orderBy); + if(common::hasPriv('overtime', 'review')) $oa['overtime'] = $this->getReviewingOvertimes($allDeptList, $managedDeptList, $orderBy); + if(common::hasPriv('makeup', 'review')) $oa['makeup'] = $this->getReviewingMakeups($allDeptList, $managedDeptList, $orderBy); + if(common::hasPriv('lieu', 'review')) $oa['lieu'] = $this->getReviewingLieus($allDeptList, $managedDeptList, $orderBy); + + $reviewList = array(); + foreach($oa as $type => $reviewings) + { + foreach($reviewings as $object) + { + $review = new stdclass(); + $review->id = $object->id; + $review->type = $type; + $review->time = $type == 'attend' ? $object->date : $object->createdDate; + $review->status = $type == 'attend' ? $object->reviewStatus : $object->status; + if($type == 'attend') + { + $review->title = zget($users, $object->account) . ': ' . $object->date . $this->lang->attend->statusList[$object->status ]; + } + else + { + $review->title = zget($users, $object->createdBy) . ': ' . $object->begin . ' ' . substr($object->start, 0, 5) . ' ~ ' . $object->end . ' ' . substr($object->finish, 0, 5); + } + $reviewList[] = $review; + } + } + + return $reviewList; + } } diff --git a/module/my/view/audit.html.php b/module/my/view/audit.html.php index 276eae79b1..f531608fd7 100644 --- a/module/my/view/audit.html.php +++ b/module/my/view/audit.html.php @@ -4,69 +4,124 @@ rawMethod);?> -
-
- -
-

- noData;?> -

-
- -
-
- -
- getModuleRoot() . 'common/view/datatable.html.php'; - - $setting = $this->datatable->getSetting('review'); - foreach($setting as $key => $value) - { - if($value->id == 'actions') $setting[$key]->width = 80; - } - - $widths = $this->datatable->setFixedFieldWidth($setting); - ?> - ' data-fixed-right-width=''> - - - show) - { - $this->datatable->printHead($value, $orderBy, $vars, false); - } - } - ?> - - - - - - my->reviewPrintCell($value, $review, $users, $products, $pendingList);?> - - - -
- -
+
+ +
+

+ noData;?> +

+
+ +
+ + + recTotal&recPerPage=$pager->recPerPage&pageID=$pager->pageID";?> + + + + + + + + + + + + type; + $typeName = $lang->$type->common; + if($type == 'project') $type = 'review'; + + $statusList = $lang->$type->statusList; + if($type == 'attend') $statusList = $lang->attend->reviewStatusList; + ?> + + + + + + + + + + +
idAB);?> my->audit->title);?> my->audit->type);?> my->audit->time);?>my->audit->status);?>actions?>
id?> title?> time?>status, '')?> + id"; + + $reviewIcon = ''; + $passIcon = ''; + $rejectIcon = ''; + + if($module == 'review') + { + $method = 'assess'; + $params = "reviewID=$review->id&from={$this->app->rawMethod}"; + common::printLink($module, $method, $params, $reviewIcon, '', "class='btn' title='{$lang->review->common}'"); + } + elseif($module == 'attend') + { + extCommonModel::printLink('attend', 'review', "attendID={$review->id}&status=pass", $passIcon, "class='btn' title='{$lang->attend->reviewStatusList['pass']}' data-status='pass' data-toggle='ajax'"); + extCommonModel::printLink('attend', 'review', "attendID={$review->id}&status=reject", $rejectIcon, "class='btn' title='{$lang->attend->reviewStatusList['reject']}' data-toggle='modal'"); + } + elseif($module == 'leave') + { + $leaveMode = $review->status == 'pass' ? 'back' : ''; + extCommonModel::printLink('leave', 'review', "id={$review->id}&status=pass&mode=$leaveMode", $passIcon, "class='btn' title='{$lang->$module->statusList['pass']}' data-status='pass' data-toggle='ajax'"); + extCommonModel::printLink('leave', 'review', "id={$review->id}&status=reject&mode=$leaveMode", $rejectIcon, "class='btn' title='{$lang->$module->statusList['reject']}' data-toggle='modal'"); + } + elseif(strpos('|makeup|overtime|lieu|', "|$module|") !== false) + { + extCommonModel::printLink($module, $method, "id={$review->id}&status=pass", $passIcon, "class='btn' title='{$lang->$module->statusList['pass']}' data-status='pass' data-toggle='ajax'"); + extCommonModel::printLink($module, $method, "id={$review->id}&status=reject", $rejectIcon, "class='btn' title='{$lang->$module->statusList['reject']}' data-toggle='modal'"); + } + else + { + common::printLink($module, $method, $params, $reviewIcon, '', "class='btn iframe' title='{$lang->review->common}'", true, true); + } + ?> +
+ +
+ +
+my->confirmReview);?> getModuleRoot() . 'common/view/footer.html.php'?> diff --git a/module/my/view/task.html.php b/module/my/view/task.html.php index 932f6125f5..2e5ebe192e 100644 --- a/module/my/view/task.html.php +++ b/module/my/view/task.html.php @@ -36,8 +36,8 @@ my->byQuery;?>
-rawMethod == 'work' ? 'workTask' : 'contributeTask';?> -
>
+ rawMethod == 'work' ? 'workTask' : 'contributeTask';?> +
>

task->noTask;?>

From 613fa5f478d34c9a28c071b23f2591800469ea01 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 11 Oct 2022 16:09:53 +0800 Subject: [PATCH 4/8] * fix for task #71610. --- module/testtask/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/testtask/model.php b/module/testtask/model.php index 3b4161a3d7..a239cc87a8 100755 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -296,7 +296,7 @@ class testtaskModel extends model */ public function getByUser($account, $pager = null, $orderBy = 'id_desc', $type = '') { - return $this->dao->select("t1.*, t2.name AS executionName, t2.multiple as executionMultiple, t4.name as projectName, t3.name AS buildName") + return $this->dao->select("t1.*, t2.name AS executionName, t2.multiple as executionMultiple, t5.name as projectName, t3.name AS buildName") ->from(TABLE_TESTTASK)->alias('t1') ->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id') ->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build = t3.id') From 93247d33a7f17be8172e4d009b33561da1932f61 Mon Sep 17 00:00:00 2001 From: liugang Date: Tue, 11 Oct 2022 15:57:02 +0800 Subject: [PATCH 5/8] * Hide the link and unlink buttons if the execution is a none-product and single one. --- module/execution/view/story.html.php | 31 +++++++++++++++++++++++----- module/story/model.php | 2 +- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/module/execution/view/story.html.php b/module/execution/view/story.html.php index 8960abebac..e1f2bd7d83 100644 --- a/module/execution/view/story.html.php +++ b/module/execution/view/story.html.php @@ -78,6 +78,7 @@ id", " " . $lang->story->export, '', "class='btn btn-link export iframe'"); + $canLinkStory = $execution->hasProduct or $execution->multiple; if(common::canModify('execution', $execution)) { $this->lang->story->create = $this->lang->execution->createStory; @@ -122,7 +123,7 @@ $wizardParams = helper::safe64Encode("execution=$execution->id"); echo html::a($this->createLink('tutorial', 'wizard', "module=execution&method=linkStory¶ms=$wizardParams"), " {$lang->execution->linkStory}",'', "class='btn btn-link link-story-btn'"); } - else + elseif($canLinkStory) // The none-product and single execution cann't link stories. { echo " createLink('execution', 'batchUnlinkStory', "executionID=$execution->id"); echo html::commonButton($lang->execution->unlinkStoryAB, "data-form-action='$actionLink'"); diff --git a/module/story/model.php b/module/story/model.php index aba40461bf..58dc081063 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -4415,7 +4415,7 @@ class storyModel extends model $canBatchCreateTask = common::hasPriv('task', 'batchCreate'); $canCreateCase = ($hasDBPriv and common::hasPriv('testcase', 'create')); $canEstimate = common::hasPriv('execution', 'storyEstimate', $execution); - $canUnlinkStory = common::hasPriv('execution', 'unlinkStory', $execution); + $canUnlinkStory = (common::hasPriv('execution', 'unlinkStory', $execution) and ($execution->hasProduct or $execution->multiple)); if(strpos('draft,changing', $story->status) !== false) { From 9de83383022dcf2ae746245d8be662f90145fac9 Mon Sep 17 00:00:00 2001 From: daitingting Date: Tue, 11 Oct 2022 05:17:07 +0000 Subject: [PATCH 6/8] * Fix bugs of mutual_test. --- module/bug/control.php | 7 ++----- module/bug/view/create.html.php | 2 +- module/build/view/create.html.php | 6 +----- module/execution/model.php | 19 +++++++++++++++---- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index d8c58534e6..697abc4ce9 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -165,7 +165,7 @@ class bug extends control $pager = new pager($recTotal, $recPerPage, $pageID); /* Get executios. */ - $executions = $this->loadModel('execution')->getPairs($this->projectID, 'all', 'empty|withdelete'); + $executions = $this->loadModel('execution')->getPairs($this->projectID, 'all', 'empty|withdelete|hideMultiple'); /* Get product id list. */ $productIDList = $productID ? $productID : array_keys($this->products); @@ -341,10 +341,7 @@ class bug extends control } else if($this->app->tab == 'project') { - if(isset($output['projectID'])) - { - $this->loadModel('project')->setMenu($output['projectID']); - } + if(isset($output['projectID'])) $this->loadModel('project')->setMenu($output['projectID']); } else { diff --git a/module/bug/view/create.html.php b/module/bug/view/create.html.php index bf2bc755a2..a580ad1429 100644 --- a/module/bug/view/create.html.php +++ b/module/bug/view/create.html.php @@ -116,7 +116,7 @@ if($this->app->tab == 'project') js::set('objectID', $projectID);
- multiple) ? 'hidden' : '';?> + multiple) ? 'hidden' : '';?>
bug->kanban : $lang->bug->execution;?> diff --git a/module/build/view/create.html.php b/module/build/view/create.html.php index ae4da00315..afec7286f9 100644 --- a/module/build/view/create.html.php +++ b/module/build/view/create.html.php @@ -20,14 +20,10 @@
tab == 'project'):?> - - + - - - diff --git a/module/execution/model.php b/module/execution/model.php index 0f0bfbb56b..8f38b465b3 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1304,16 +1304,27 @@ class executionModel extends model { if(strpos($mode, 'noclosed') !== false and ($execution->status == 'done' or $execution->status == 'closed')) continue; if(strpos($mode, 'stagefilter') !== false and isset($executionModel) and $executionModel == 'waterfall' and in_array($execution->attribute, array('request', 'design', 'review'))) continue; // Some stages of waterfall not need. + if(empty($execution->multiple)) $noMultiples[$execution->id] = $execution->project; + $pairs[$execution->id] = $execution->name; } + if($noMultiples) { - $this->app->loadLang('project'); - $noMultipleProjects = $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->in($noMultiples)->fetchPairs('id', 'name'); - foreach($noMultiples as $executionID => $projectID) + if(strpos($mode, 'hideMultiple') !== false) { - if(isset($noMultipleProjects[$projectID])) $pairs[$executionID] = $noMultipleProjects[$projectID] . "({$this->lang->project->disableExecution})"; + foreach($noMultiples as $executionID => $projectID) $pairs[$executionID] = ''; + } + else + { + $this->app->loadLang('project'); + $noMultipleProjects = $this->dao->select('id, name')->from(TABLE_PROJECT)->where('id')->in($noMultiples)->fetchPairs('id', 'name'); + + foreach($noMultiples as $executionID => $projectID) + { + if(isset($noMultipleProjects[$projectID])) $pairs[$executionID] = $noMultipleProjects[$projectID] . "({$this->lang->project->disableExecution})"; + } } } From 45d3e79858cc3829af2396c56cb3a919a9b54a1a Mon Sep 17 00:00:00 2001 From: sunguangming Date: Tue, 11 Oct 2022 16:33:46 +0800 Subject: [PATCH 7/8] * Change project hasproduct to execution hasproduct. --- module/execution/control.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 1bacc279f2..7f4b14c3e3 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -979,7 +979,7 @@ class execution extends control $executionID = $execution->id; $products = $this->product->getProducts($execution->id); - if($execution->project and !$project->hasProduct) + if($execution->hasProduct) { unset($this->config->bug->search['fields']['product']); if($project->model != 'scrum') @@ -990,7 +990,7 @@ class execution extends control $productPairs = array('0' => $this->lang->product->all); foreach($products as $productData) $productPairs[$productData->id] = $productData->name; - if($project->hasProduct) $this->lang->modulePageNav = $this->product->select($productPairs, $productID, 'execution', 'bug', $executionID, $branch); + if($execution->hasProduct) $this->lang->modulePageNav = $this->product->select($productPairs, $productID, 'execution', 'bug', $executionID, $branch); /* Header and position. */ $title = $execution->name . $this->lang->colon . $this->lang->execution->bug; From 186f0b2828b0af977f23ed7ec045418ce9b723c6 Mon Sep 17 00:00:00 2001 From: wangjianhua Date: Thu, 13 Oct 2022 11:41:28 +0800 Subject: [PATCH 8/8] * Remove repeated codes. --- module/project/control.php | 2 +- module/project/model.php | 11 +++++++++-- module/repo/model.php | 20 -------------------- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/module/project/control.php b/module/project/control.php index eef854f4bb..cda4730ab6 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -2297,7 +2297,7 @@ class project extends control } $this->view->title = $this->lang->project->manageRepo; - $this->view->allRepos = $this->loadModel('repo')->repoPairsForCurrentUser(); + $this->view->allRepos = $this->loadModel('repo')->getRepoPairs(''); $this->view->linkedRepos = $this->project->linkedRepoPairs($projectID); $this->view->unlinkedRepos = array(); diff --git a/module/project/model.php b/module/project/model.php index 6a9697a7ec..4378a63135 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -2923,8 +2923,15 @@ class projectModel extends model $repos = $this->dao->select('*')->from(TABLE_REPO) ->where('deleted')->eq(0) ->andWhere('id')->in($repoIDList) - ->fetchPairs('id', 'name'); + ->fetchAll(); - return $repos; + $repoPairs = array(); + foreach($repos as $repo) + { + $scm = $repo->SCM == 'Subversion' ? 'svn' : strtolower($repo->SCM); + $repoPairs[$repo->id] = "[{$scm}] " . $repo->name; + } + + return $repoPairs; } } diff --git a/module/repo/model.php b/module/repo/model.php index b7cd37a99a..77b8f92c71 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -382,26 +382,6 @@ class repoModel extends model return $repoPairs; } - /** - * Get Repo pairs under current user privileges. - * - * @access public - * @return array - */ - public function repoPairsForCurrentUser() - { - $repos = $this->dao->select('*')->from(TABLE_REPO)->where('deleted')->eq(0)->fetchAll(); - - $repoPairs = array(); - foreach($repos as $repo) - { - $repo->acl = json_decode($repo->acl); - if($this->checkPriv($repo)) $repoPairs[$repo->id] = $repo->name; - } - - return $repoPairs; - } - /** * Get repos group by repo type. *
executionCommon;?>
build->product;?>