From c3da65ea4ed6b1d16652d90fb8e473d53014d1a2 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Tue, 21 Nov 2023 21:29:01 -0500 Subject: [PATCH] * Merge 18.8 project module into Merge184. --- module/project/config.php | 2 ++ module/project/config/dtable.php | 0 module/project/config/form.php | 0 module/project/control.php | 13 +++++++------ module/project/model.php | 17 ++++++++++++----- module/project/tao.php | 11 +++++++---- module/project/test/model/create.php | 1 + module/project/zen.php | 0 8 files changed, 29 insertions(+), 15 deletions(-) mode change 100644 => 100755 module/project/config.php mode change 100644 => 100755 module/project/config/dtable.php mode change 100644 => 100755 module/project/config/form.php mode change 100644 => 100755 module/project/control.php mode change 100644 => 100755 module/project/zen.php diff --git a/module/project/config.php b/module/project/config.php old mode 100644 new mode 100755 index 1dca50df85..e50f14fb9d --- a/module/project/config.php +++ b/module/project/config.php @@ -52,6 +52,7 @@ $config->project->checkList->waterfall = array('execution', 'design', 'doc', $config->project->checkList->kanban = array('execution', 'build'); $config->project->checkList->agileplus = $config->project->checkList->scrum; $config->project->checkList->waterfallplus = $config->project->checkList->waterfall; +$config->project->checkList->ipd = $config->project->checkList->waterfall; $config->project->maxCheckList = new stdclass(); $config->project->maxCheckList->scrum = array('bug', 'execution', 'build', 'doc', 'release', 'testtask', 'case', 'issue', 'risk', 'meeting'); @@ -59,6 +60,7 @@ $config->project->maxCheckList->waterfall = array('execution', 'design', 'do $config->project->maxCheckList->kanban = array('execution', 'build'); $config->project->maxCheckList->agileplus = $config->project->maxCheckList->scrum; $config->project->maxCheckList->waterfallplus = $config->project->maxCheckList->waterfall; +$config->project->maxCheckList->ipd = $config->project->maxCheckList->waterfall; $config->project->scrumList = array('scrum', 'agileplus'); $config->project->waterfallList = array('waterfall', 'waterfallplus'); diff --git a/module/project/config/dtable.php b/module/project/config/dtable.php old mode 100644 new mode 100755 diff --git a/module/project/config/form.php b/module/project/config/form.php old mode 100644 new mode 100755 diff --git a/module/project/control.php b/module/project/control.php old mode 100644 new mode 100755 index 129d1ca6dc..f8544ce4f6 --- a/module/project/control.php +++ b/module/project/control.php @@ -567,7 +567,7 @@ class project extends control $projectID = $this->project->setMenu($projectID); $project = $this->project->getById($projectID); - if(empty($project) || strpos('scrum,waterfall,kanban,agileplus,waterfallplus', $project->model) === false) + if(empty($project) || strpos('scrum,waterfall,kanban,agileplus,waterfallplus,ipd', $project->model) === false) { if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'code' => 404, 'message' => '404 Not found')); return $this->send(array('result' => 'fail', 'message' => $this->lang->notFound, 'load' => $this->createLink('project', 'browse'))); @@ -748,6 +748,11 @@ class project extends control $this->project->setMenu($projectID); if(!$projectID) return $this->send(array('result' => 'fail', 'locate' => inlink('browse'))); + if(!$project->multiple) + { + $executionID = $this->execution->getNoMultipleID($projectID); + return print(js::locate($this->createLink('execution', 'task', "executionID=$executionID"))); + } if(!empty($project->model) and $project->model == 'kanban' and !(defined('RUN_MODE') and RUN_MODE == 'api')) return $this->send(array('result' => 'fail', 'locate' => inlink('index', "projectID=$projectID"))); /* Load pager and get tasks. */ @@ -1508,11 +1513,7 @@ class project extends control public function ajaxGetExecutions(int $projectID, string $mode = '', string $type = 'all') { $executions = array(); - if($projectID) - { - $project = $this->project->getByID($projectID); - $executions = (array)$this->loadModel('execution')->getPairs($projectID, $type, $mode); - } + if($projectID) $executions = (array)$this->loadModel('execution')->getPairs($projectID, $type, $mode); $items = array(); foreach($executions as $id => $name) diff --git a/module/project/model.php b/module/project/model.php index cc4c104447..10d076d69b 100755 --- a/module/project/model.php +++ b/module/project/model.php @@ -285,10 +285,11 @@ class projectModel extends model * Get waterfall project progress. * * @param array $projectIdList + * @param string $mode waterfall|research * @access public * @return array */ - public function getWaterfallProgress(array $projectIdList): array + public function getWaterfallProgress(array $projectIdList, string $mode = 'waterfall'): array { /* Get stage list. */ $stageGroup = $this->dao->select('t1.*')->from(TABLE_EXECUTION)->alias('t1') @@ -297,7 +298,7 @@ class projectModel extends model ->andWhere('t1.deleted')->eq('0') ->andWhere('t1.vision')->eq($this->config->vision) ->andWhere('t1.project')->in($projectIdList) - ->andWhere('t2.model')->eq('waterfall') + ->andWhere('t2.model')->eq($mode) ->fetchGroup('project', 'id'); /* Get hours information. */ @@ -1729,7 +1730,9 @@ class projectModel extends model public function updateProducts(int $projectID, array $products = array()): bool { $this->loadModel('user'); - $members = array_keys($this->getTeamMembers($projectID)); + $teams = array_keys($this->getTeamMembers($projectID)); + $stakeholders = array_keys($this->loadModel('stakeholder')->getStakeHolderPairs($projectID)); + $members = array_merge($teams, $stakeholders); /* Link products of other programs. */ if(!empty($_POST['otherProducts'])) return $this->linkOtherProducts($projectID, $members); @@ -2001,7 +2004,11 @@ class projectModel extends model /* Get execution of the status is doing. */ $executions = $this->loadModel('execution')->getStatData(0, 'doing', 0, 0, false, 'hasParentName|skipParent'); $projectExecutions = array(); - foreach($executions as $execution) $projectExecutions[$execution->project][$execution->id] = $execution; + foreach($executions as $execution) + { + if(!empty($execution->projectName)) $execution->projectName = htmlspecialchars_decode($execution->projectName); + $doingExecutions[$execution->project][$execution->id] = $execution; + } /* The execution is sorted in reverse order by execution ID. */ $ongoingExecutions = array(); @@ -2194,7 +2201,7 @@ class projectModel extends model { foreach($planStory as $id => $story) { - if($story->status == 'draft' or $story->status == 'reviewing') + if($story->status != 'active') { unset($planStory[$id]); continue; diff --git a/module/project/tao.php b/module/project/tao.php index 91e1511a4a..4eb9442807 100755 --- a/module/project/tao.php +++ b/module/project/tao.php @@ -110,8 +110,8 @@ class projectTao extends projectModel $this->dao->update(TABLE_PROJECT)->data($project) ->autoCheck('begin,end') ->check('end', 'gt', $project->begin) - ->check('name', 'unique', "id != $projectID and `type` = 'project' and `parent` = '{$project->parent}' and `model` = '{$project->model}' and `deleted` = '0'") - ->check('code', 'unique', "id != $projectID and `type` = 'project' and `model` = '{$project->model}' and `deleted` = '0'") + ->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type` = 'project' and `parent` = '$project->parent' and `model` = " . $this->dao->sqlobj->quote($project->model) . " and `deleted` = '0'") + ->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and `type` = 'project' and `model` = " . $this->dao->sqlobj->quote($project->model) . " and `deleted` = '0'") ->checkFlow() ->where('id')->eq($projectID) ->exec(); @@ -133,8 +133,8 @@ class projectTao extends projectModel $this->dao->insert(TABLE_PROJECT)->data($project) ->autoCheck() ->batchCheck($this->config->project->create->requiredFields, 'notempty') - ->checkIF(!empty($project->name), 'name', 'unique', "`type`='project' and `parent` = $project->parent and `model` = '{$project->model}' and `deleted` = '0'") - ->checkIF(!empty($project->code), 'code', 'unique', "`type`='project' and `model` = '{$project->model}' and `deleted` = '0'") + ->checkIF(!empty($project->name), 'name', 'unique', "`type`='project' and `parent` = " . $this->dao->sqlobj->quote($project->parent) . " and `model` = " . $this->dao->sqlobj->quote($project->model) . " and `deleted` = '0'") + ->checkIF(!empty($project->code), 'code', 'unique', "`type`='project' and `model` = " . $this->dao->sqlobj->quote($project->model) . " and `deleted` = '0'") ->checkIF($project->end != '', 'end', 'gt', $project->begin) ->checkFlow() ->exec(); @@ -639,6 +639,9 @@ class projectTao extends projectModel { if(!str_contains('wait,doing,closed', $project->status)) continue; + /* Convert predefined HTML entities to characters. */ + $project->name = htmlspecialchars_decode($project->name, ENT_QUOTES); + $projectPath = explode(',', trim($project->path, ',')); $topProgram = !empty($project->parent) ? $projectPath[0] : $project->parent; diff --git a/module/project/test/model/create.php b/module/project/test/model/create.php index 1ef1eb08de..969c9e10a1 100755 --- a/module/project/test/model/create.php +++ b/module/project/test/model/create.php @@ -47,6 +47,7 @@ $project->PM = 'admin'; $project->type = 'project'; $project->model = 'scrum'; $project->multiple = 1; +$project->openedBy = 'user1'; $project->hasProduct = 1; $postData = new stdclass(); diff --git a/module/project/zen.php b/module/project/zen.php old mode 100644 new mode 100755