From fb1a6baf9f97a3a9955d5a8f36f0ab21159bf1f2 Mon Sep 17 00:00:00 2001 From: Yagami Date: Tue, 9 May 2023 20:51:13 +0800 Subject: [PATCH] * Remove stage's output and put review points into gantt. --- module/programplan/model.php | 63 +++++++++++++++++++++++-- module/programplan/view/create.html.php | 16 ------- 2 files changed, 59 insertions(+), 20 deletions(-) diff --git a/module/programplan/model.php b/module/programplan/model.php index 253fd32dde..0960828a5c 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -152,7 +152,7 @@ class programplanModel extends model /** * Get gantt data. * - * @param int $executionID + * @param int $projectID * @param int $productID * @param int $baselineID * @param string $selectCustom @@ -160,12 +160,12 @@ class programplanModel extends model * @access public * @return string */ - public function getDataForGantt($executionID, $productID, $baselineID = 0, $selectCustom = '', $returnJson = true) + public function getDataForGantt($projectID, $productID, $baselineID = 0, $selectCustom = '', $returnJson = true) { $this->loadModel('stage'); $this->loadModel('execution'); - $plans = $this->getStage($executionID, $productID, 'all', 'order'); + $plans = $this->getStage($projectID, $productID, 'all', 'order'); if($baselineID) { $baseline = $this->loadModel('cm')->getByID($baselineID); @@ -182,6 +182,7 @@ class programplanModel extends model } } + $project = $this->loadModel('project')->getByID($projectID); $today = helper::today(); $datas = array(); $planIdList = array(); @@ -351,6 +352,57 @@ class programplanModel extends model } } + /* Build review points tree for ipd project. */ + if($project->model == 'ipd') + { + $reviewPoints = $this->dao->select('*')->from(TABLE_OBJECT) + ->where('deleted')->eq('0') + ->andWhere('project')->eq($projectID) + ->beginIF($productID)->andWhere('product')->eq($productID)->fi() + ->fetchAll('id'); + + foreach($datas['data'] as $plan) + { + if($plan->type != 'plan') continue; + + foreach($reviewPoints as $id => $point) + { + if(!isset($this->config->stage->ipdReviewPoint->{$plan->attribute})) continue; + + $categories = $this->config->stage->ipdReviewPoint->{$plan->attribute}; + if(in_array($point->category, $categories)) + { + $data = new stdclass(); + $data->id = $plan->id . '-' . $point->category . '-' . $point->id; + $data->type = 'point'; + $data->text = $point->title; + $data->name = $point->title; + $data->attribute = ''; + $data->milestone = ''; + $data->owner_id = ''; + $data->status = ''; + $data->begin = helper::today(); + $data->deadline = ''; + $data->realBegan = $point->createdDate; + $data->realEnd = '';; + $data->parent = $plan->id; + $data->open = true; + $data->start_date = helper::today(); + $data->endDate = helper::today(); + $data->duration = 1; + $data->color = '#FC913F'; + $data->progressColor = $this->lang->execution->gantt->stage->progressColor; + $data->textColor = $this->lang->execution->gantt->stage->textColor; + $data->bar_height = $this->lang->execution->gantt->bar_height; + + if($data->start_date) $data->start_date = date('d-m-Y', strtotime($data->start_date)); + + $datas['data'][$data->id] = $data; + } + } + } + } + /* Calculate the progress of the phase. */ foreach($stageIndex as $index => $stage) { @@ -878,7 +930,6 @@ class programplanModel extends model $data->days = helper::diffDate($data->end, $data->begin) + 1; $data->order = current($orders); - if($data->id) { $stageID = $data->id; @@ -954,6 +1005,10 @@ class programplanModel extends model if(!dao::isError()) { $stageID = $this->dao->lastInsertID(); + + /* Ipd project create default review points. */ + if($project->model == 'ipd' && $this->config->edition == 'ipd') $this->loadModel('review')->createDefaultPoint($projectID, $productID, $data->attribute); + if($data->type == 'kanban') { $execution = $this->execution->getByID($stageID); diff --git a/module/programplan/view/create.html.php b/module/programplan/view/create.html.php index 13094306e0..42c7bdcae8 100644 --- a/module/programplan/view/create.html.php +++ b/module/programplan/view/create.html.php @@ -100,9 +100,6 @@ '>programplan->realBegan;?> '>programplan->realEnd;?> '>programplan->desc;?> - config->edition == 'max' or $this->config->edition == 'ipd') and $executionType == 'stage'):?> - programplan->output;?> - actions;?> @@ -129,9 +126,6 @@ > > - config->edition == 'max' or $this->config->edition == 'ipd') and $executionType == 'stage'):?> - - @@ -166,10 +160,6 @@ > > '>desc, "rows='1' class='form-control autosize'");?> - config->edition == 'max' or $this->config->edition == 'ipd') and $executionType == 'stage'):?> - output) ? 0 : explode(',', $plan->output);?> - - @@ -202,9 +192,6 @@ > > '> - config->edition == 'max' or $this->config->edition == 'ipd') and $executionType == 'stage'):?> - - @@ -250,9 +237,6 @@ > > '> - config->edition == 'max' or $this->config->edition == 'ipd') and $executionType == 'stage'):?> - -