From 97393330f9f039498a22db9c09473f0374d112cf Mon Sep 17 00:00:00 2001 From: leiyong <1549684884@qq.com> Date: Wed, 12 Oct 2022 02:28:12 +0000 Subject: [PATCH] * Finish story#37168. --- module/programplan/config.php | 2 +- module/programplan/lang/en.php | 9 +++++++++ module/programplan/lang/zh-cn.php | 9 +++++++++ module/programplan/model.php | 19 +++++++++++++++++++ module/programplan/view/gantt.html.php | 6 +++++- 5 files changed, 43 insertions(+), 2 deletions(-) diff --git a/module/programplan/config.php b/module/programplan/config.php index ce9a1594fa..e3938cd53d 100644 --- a/module/programplan/config.php +++ b/module/programplan/config.php @@ -58,6 +58,6 @@ $config->programplan->customCreateFields = 'PM,percent,attribute,acl,milestone,r $config->programplan->custom = new stdclass(); $config->programplan->custom->createFields = 'PM,percent,attribute,acl,milestone'; -$config->programplan->custom->customGanttFields = 'PM,deadline,status,realBegan,realEnd,progress,taskProgress,estimate,consumed'; +$config->programplan->custom->customGanttFields = 'PM,deadline,status,realBegan,realEnd,progress,taskProgress,estimate,consumed,delay,delayDays'; $config->programplan->ganttCustom = new stdclass(); $config->programplan->ganttCustom->ganttFields = 'PM,deadline'; diff --git a/module/programplan/lang/en.php b/module/programplan/lang/en.php index faf009d05a..e6add29179 100644 --- a/module/programplan/lang/en.php +++ b/module/programplan/lang/en.php @@ -60,6 +60,9 @@ $lang->programplan->exporting = 'Exporting'; $lang->programplan->exportFail = 'Failed'; $lang->programplan->hideCriticalPath = 'Hide Critical Path'; $lang->programplan->showCriticalPath = 'Show Critical Path'; +$lang->programplan->delay = 'Delay'; +$lang->programplan->delayDays = 'Delay days'; + $lang->programplan->errorBegin = "Project begin date: %s, begin date should be >= project begin date."; $lang->programplan->errorEnd = "Project end date: %s, end date should be <= project end date."; $lang->programplan->emptyBegin = '『Begin』should not be blank'; @@ -70,6 +73,10 @@ $lang->programplan->checkEnd = '『End』should be valid date'; $lang->programplan->milestoneList[1] = 'Yes'; $lang->programplan->milestoneList[0] = 'No'; +$lang->programplan->delayList = array(); +$lang->programplan->delayList[1] = 'Yes'; +$lang->programplan->delayList[0] = 'No'; + $lang->programplan->noData = 'No Data'; $lang->programplan->children = 'Sub Plan'; $lang->programplan->childrenAB = 'Child'; @@ -89,6 +96,8 @@ $lang->programplan->ganttCustom['progress'] ='Workload Ratio'; $lang->programplan->ganttCustom['taskProgress'] ='Task Progress'; $lang->programplan->ganttCustom['estimate'] ='Estimate'; $lang->programplan->ganttCustom['consumed'] ='Consumed'; +$lang->programplan->ganttCustom['delay'] = 'Delay'; +$lang->programplan->ganttCustom['delayDays'] = 'Delay days'; $lang->programplan->error = new stdclass(); $lang->programplan->error->percentNumber = '"Workload %" must be digits.'; diff --git a/module/programplan/lang/zh-cn.php b/module/programplan/lang/zh-cn.php index 52b3a1bcef..1e4fdfbacd 100644 --- a/module/programplan/lang/zh-cn.php +++ b/module/programplan/lang/zh-cn.php @@ -60,6 +60,9 @@ $lang->programplan->exporting = '导出'; $lang->programplan->exportFail = '导出失败'; $lang->programplan->hideCriticalPath = '隐藏关键路径'; $lang->programplan->showCriticalPath = '显示关键路径'; +$lang->programplan->delay = '是否延期'; +$lang->programplan->delayDays = '延期天数'; + $lang->programplan->errorBegin = '阶段的开始时间不能小于所属项目的开始时间%s'; $lang->programplan->errorEnd = '阶段的结束时间不能大于所属项目的结束时间%s'; $lang->programplan->emptyBegin = '『计划开始』日期不能为空'; @@ -70,6 +73,10 @@ $lang->programplan->checkEnd = '『计划完成』应当为合法的日 $lang->programplan->milestoneList[1] = '是'; $lang->programplan->milestoneList[0] = '否'; +$lang->programplan->delayList = array(); +$lang->programplan->delayList[1] = '是'; +$lang->programplan->delayList[0] = '否'; + $lang->programplan->noData = '暂无数据。'; $lang->programplan->children = '二级计划'; $lang->programplan->childrenAB = '子'; @@ -89,6 +96,8 @@ $lang->programplan->ganttCustom['progress'] ='工作量占比'; $lang->programplan->ganttCustom['taskProgress'] ='任务进度'; $lang->programplan->ganttCustom['estimate'] ='工时'; $lang->programplan->ganttCustom['consumed'] ='消耗工时'; +$lang->programplan->ganttCustom['delay'] = '是否延期'; +$lang->programplan->ganttCustom['delayDays'] = '延期天数'; $lang->programplan->error = new stdclass(); $lang->programplan->error->percentNumber = '"工作量比例"必须为数字'; diff --git a/module/programplan/model.php b/module/programplan/model.php index 4efccd5daa..a3d20ecfad 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -169,6 +169,7 @@ class programplanModel extends model } } + $today = helper::today(); $datas = array(); $planIdList = array(); $isMilestone = " "; @@ -205,6 +206,15 @@ class programplanModel extends model $data->textColor = $this->lang->execution->gantt->stage->textColor; $data->bar_height = $this->lang->execution->gantt->bar_height; + /* Determines if the object is delay. */ + $data->delay = $this->lang->programplan->delayList[0]; + $data->delayDays = 0; + if($today > $end) + { + $data->delay = $this->lang->programplan->delayList[1]; + $data->delayDays = helper::diffDate($today, substr($end, 0, 10)); + } + if($data->endDate > $data->start_date) $data->duration = helper::diffDate(substr($data->endDate, 0, 10), substr($data->start_date, 0, 10)) + 1; if($data->start_date) $data->start_date = date('d-m-Y', strtotime($data->start_date)); if($data->start_date == '' or $data->endDate == '') $data->duration = 1; @@ -285,6 +295,15 @@ class programplanModel extends model $data->textColor = zget($this->lang->execution->gantt->textColor, $task->pri, $this->lang->execution->gantt->defaultTextColor); $data->bar_height = $this->lang->execution->gantt->bar_height; + /* Determines if the object is delay. */ + $data->delay = $this->lang->programplan->delayList[0]; + $data->delayDays = 0; + if($today > $end) + { + $data->delay = $this->lang->programplan->delayList[1]; + $data->delayDays = helper::diffDate($today, substr($end, 0, 10)); + } + /* If multi task then show the teams. */ if($task->mode == 'multi' and !empty($taskTeams[$task->id])) { diff --git a/module/programplan/view/gantt.html.php b/module/programplan/view/gantt.html.php index 6100fdb039..6b1f88c074 100644 --- a/module/programplan/view/gantt.html.php +++ b/module/programplan/view/gantt.html.php @@ -560,7 +560,9 @@ $(function() if(showFields.indexOf('taskProgress') != -1) gantt.config.columns.push({name: 'taskProgress', align: 'center', resize: true, width: 60}); if(showFields.indexOf('realBegan') != -1) gantt.config.columns.push({name: 'realBegan', align: 'center', resize: true, width: 80}); if(showFields.indexOf('realEnd') != -1) gantt.config.columns.push({name: 'realEnd', align: 'center', resize: true, width: 80}); - if(showFields.indexOf('consumed') != -1) gantt.config.columns.push({name: 'consumed', align: 'center', resize: false, width: 60}); + if(showFields.indexOf('consumed') != -1) gantt.config.columns.push({name: 'consumed', align: 'center', resize: true, width: 60}); + if(showFields.indexOf('delay') != -1) gantt.config.columns.push({name: 'delay', align: 'center', resize: true, width: 60}); + if(showFields.indexOf('delayDays') != -1) gantt.config.columns.push({name: 'delayDays', align: 'center', resize: false, width: 60}); endField = gantt.config.columns.pop(); endField.resize = false; @@ -578,6 +580,8 @@ $(function() gantt.locale.labels.column_duration = "programplan->duration;?>"; gantt.locale.labels.column_estimate = "programplan->estimate;?>"; gantt.locale.labels.column_consumed = "programplan->consumed;?>"; + gantt.locale.labels.column_delay = "programplan->delay;?>"; + gantt.locale.labels.column_delayDays = "programplan->delayDays;?>"; if((module == 'review' && method == 'assess') || dateDetails) gantt.config.show_chart = false;