@@ -31,7 +28,11 @@ end != '2030-01-01' ? formatTime($plan->end) : '', 'class="form-control form-date"');?> - + productplan->desc;?> + desc, 'class="form-control"');?> + + + productplan->start);?> cancel, "data-dismiss='modal'", 'btn btn-wide');?> diff --git a/module/productplan/view/view.html.php b/module/productplan/view/view.html.php index d891801f4b..e966ae107a 100644 --- a/module/productplan/view/view.html.php +++ b/module/productplan/view/view.html.php @@ -59,11 +59,12 @@ common::printLink('productplan', 'finish', "planID=$plan->id", "{$lang->productplan->finishAB}", '', "class='btn btn-link {$class}' target='hiddenwin' title='{$lang->productplan->finish}'", '', false, $plan); $class = $plan->status == 'done' ? '' : 'disabled'; common::printLink('productplan', 'close', "planID=$plan->id", "{$lang->productplan->closeAB}", '', "class='btn btn-link {$class}' target='hiddenwin' title='{$lang->productplan->close}'", '', false, $plan); - $class = $plan->status == 'closed' ? '' : 'disabled'; + $class = in_array($plan->status, array('closed', 'done')) ? '' : 'disabled'; common::printLink('productplan', 'activate', "planID=$plan->id", "{$lang->productplan->activateAB}", '', "class='btn btn-link {$class}' target='hiddenwin' title='{$lang->productplan->activate}'", '', false, $plan); } - if(common::hasPriv('productplan', 'create', $plan) and $plan->parent <= '0') echo html::a($this->createLink('productplan', 'create', "product={$plan->product}&branch={$plan->branch}&parent={$plan->id}"), " " . $this->lang->productplan->children , '', "class='btn btn-link' title='{$this->lang->productplan->children}'"); + $class = in_array($plan->status, array('done', 'closed')) ? 'disabled' : ''; + if(common::hasPriv('productplan', 'create', $plan) and $plan->parent <= 0) echo html::a($this->createLink('productplan', 'create', "product={$plan->product}&branch={$plan->branch}&parent={$plan->id}"), " " . $this->lang->productplan->children , '', "class='btn btn-link {$class}' title='{$this->lang->productplan->children}'"); if(common::hasPriv('productplan', 'edit', $plan)) echo html::a($this->createLink('productplan', 'edit', "planID=$plan->id"), " " . $this->lang->edit, '', "class='btn btn-link' title='{$this->lang->edit}'"); if(common::hasPriv('productplan', 'delete', $plan) and $plan->parent >= 0) echo html::a($this->createLink('productplan', 'delete', "planID=$plan->id"), " " . $this->lang->delete, '', "class='btn btn-link' title='{$this->lang->delete}' target='hiddenwin'"); } diff --git a/module/programplan/control.php b/module/programplan/control.php index 8faba1e7c3..9eb751e67d 100644 --- a/module/programplan/control.php +++ b/module/programplan/control.php @@ -145,6 +145,7 @@ class programplan extends control $this->view->plans = $this->programplan->getStage($planID ? $planID : $projectID, $this->productID, 'parent'); $this->view->planID = $planID; $this->view->type = 'lists'; + $this->view->PMUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst', $project->PM); $this->display(); } diff --git a/module/programplan/js/create.js b/module/programplan/js/create.js index 62a08dbd0e..cd4322931a 100644 --- a/module/programplan/js/create.js +++ b/module/programplan/js/create.js @@ -5,6 +5,8 @@ function addItem(obj) var newItem = $('#names' + i).closest('tr'); newItem.find('.form-date').datepicker(); $("#output" + i).chosen(); + $("#PM_i__chosen").remove(); + $("#PM" + i).chosen(); $("#output_i__chosen").remove(); i ++; } diff --git a/module/programplan/lang/en.php b/module/programplan/lang/en.php index 5a6a4ed3ab..0d93fbccb9 100644 --- a/module/programplan/lang/en.php +++ b/module/programplan/lang/en.php @@ -21,6 +21,7 @@ $lang->programplan->createSubPlan = 'Create Sub Stage'; $lang->programplan->parent = 'Parent Stage'; $lang->programplan->emptyParent = 'N/A'; $lang->programplan->name = 'Stage Name'; +$lang->programplan->PM = 'Stage Manager'; $lang->programplan->subStageName = 'Sub Stage Name'; $lang->programplan->percent = 'Workload Ratio'; $lang->programplan->percentAB = 'Ratio'; diff --git a/module/programplan/lang/zh-cn.php b/module/programplan/lang/zh-cn.php index ef8951ee19..69bebee6ad 100644 --- a/module/programplan/lang/zh-cn.php +++ b/module/programplan/lang/zh-cn.php @@ -21,6 +21,7 @@ $lang->programplan->createSubPlan = '创建二级阶段'; $lang->programplan->parent = '父阶段'; $lang->programplan->emptyParent = '无'; $lang->programplan->name = '阶段名称'; +$lang->programplan->PM = '阶段负责人'; $lang->programplan->subStageName = '子阶段名称'; $lang->programplan->percent = '工作量占比'; $lang->programplan->percentAB = '工作量占比'; diff --git a/module/programplan/model.php b/module/programplan/model.php index 321c3b8309..6cac0425b7 100644 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -409,8 +409,6 @@ class programplanModel extends model $parentACL = $parentStage->acl; } - $attributes = array_values($attributes); - $milestone = array_values($milestone); $datas = array(); foreach($names as $key => $name) { @@ -431,6 +429,7 @@ class programplanModel extends model $plan->realEnd = empty($realEnd[$key]) ? '0000-00-00' : $realEnd[$key]; $plan->output = empty($output[$key]) ? '' : implode(',', $output[$key]); $plan->acl = empty($parentID) ? $acl[$key] : $parentACL; + $plan->PM = empty($PM[$key]) ? '' : $PM[$key]; $datas[] = $plan; } diff --git a/module/programplan/view/create.html.php b/module/programplan/view/create.html.php index 98dfed8df9..812f4b8d97 100644 --- a/module/programplan/view/create.html.php +++ b/module/programplan/view/create.html.php @@ -45,6 +45,7 @@ + programplan->PM;?> programplan->percent;?> @@ -69,20 +70,21 @@ - + +
- + %
stage->typeList, $stage->type, "class='form-control'");?> - project->aclList, 'open', "class='form-control' $class");?> + project->aclList, 'open', "class='form-control' $class");?> programplan->milestoneList, 0);?> - - - - + + + + config->qcVersion)):?> @@ -98,22 +100,23 @@ setMilestone ? '' : "disabled='disabled'"?> - id);?> + id);?> - + +
- + %
stage->typeList, $plan->attribute, "class='form-control'");?> - project->aclList, $plan->acl, "class='form-control' $class");?> + project->aclList, $plan->acl, "class='form-control' $class");?> programplan->milestoneList, $plan->milestone, $disabled);?> - - - - + + + + config->qcVersion)):?> output) ? 0 : explode(',', $plan->output);?> @@ -128,20 +131,21 @@ - + +
- + %
stage->typeList, '', "class='form-control'");?> - project->aclList, 'open', "class='form-control' $class");?> + project->aclList, 'open', "class='form-control' $class");?> programplan->milestoneList, 0);?> - - - - + + + + config->qcVersion)):?> @@ -167,21 +171,22 @@ - - + + + - + - - - - + + + + config->qcVersion)):?> diff --git a/module/project/config.php b/module/project/config.php index 524a86f476..071d385551 100644 --- a/module/project/config.php +++ b/module/project/config.php @@ -129,3 +129,7 @@ $config->project->removePriv['project'] = array('index', 'browse', 'kanban', ' $config->project->removePriv['bug'] = array('batchChangePlan'); $config->project->removePriv['doc'] = array('catalog', 'index'); $config->project->removePriv['auditplan'] = array('delete'); + +$config->project->checkList = new stdclass(); +$config->project->checkList->scrum = array('bug', 'execution', 'meeting', 'release', 'build', 'doc', 'testtask', 'risk', 'issue', 'case'); +$config->project->checkList->waterfall = array('execution', 'design', 'doc', 'bug', 'case', 'build', 'release', 'testtask', 'review', 'build', 'researchplan', 'issue', 'risk', 'opportunity', 'auditplan', 'gapanalysis', 'meeting'); diff --git a/module/project/control.php b/module/project/control.php index 3b138f6170..8bd948555d 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -593,6 +593,9 @@ class project extends control } } + $canChangeModel = $this->project->checkCanChangeModel($projectID, $project->model); + $disableModel = $canChangeModel == true ? '' : 'disabled'; + $this->view->title = $this->lang->project->edit; $this->view->position[] = $this->lang->project->edit; @@ -617,6 +620,8 @@ class project extends control $this->view->parentProgram = $this->program->getByID($project->parent); $this->view->availableBudget = $this->program->getBudgetLeft($parentProject) + (float)$project->budget; $this->view->budgetUnitList = $this->project->getBudgetUnitList(); + $this->view->model = $project->model; + $this->view->disableModel = $disableModel; $this->display(); } diff --git a/module/project/lang/en.php b/module/project/lang/en.php index b47bca0d24..7d276d2813 100644 --- a/module/project/lang/en.php +++ b/module/project/lang/en.php @@ -259,8 +259,8 @@ $lang->project->membersUnit = '%s men'; $lang->project->lastIteration = "Recent {$lang->executionCommon}"; $lang->project->ongoingStage = 'Ongoing stage'; $lang->project->scrum = 'Scrum'; -$lang->project->waterfall = 'CMMI'; -$lang->project->waterfallTitle = 'CMMI'; +$lang->project->waterfall = 'Waterfall'; +$lang->project->waterfallTitle = 'Waterfall project management'; $lang->project->cannotCreateChild = 'It is not empty, so you cannot add a child. You can add a parent for it, and then create a child.'; $lang->project->confirmDelete = "Do you want to delete [%s]?"; $lang->project->emptyPM = 'No manager'; diff --git a/module/project/model.php b/module/project/model.php index 5fe5637005..413dbc9f03 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -2086,4 +2086,52 @@ class projectModel extends model if(!$this->common->isOpenMethod($moduleName, $methodName) and !commonModel::hasPriv($moduleName, $methodName)) $this->common->deny($moduleName, $methodName, false); common::setMenuVars('project', $objectID); } + + /** + * Check if the project model can be changed. + * + * @param int $projectID + * @param string $model + * @access public + * @return bool + */ + public function checkCanChangeModel($projectID, $model) + { + $checkList = $this->config->project->checkList->$model; + foreach($checkList as $module) + { + if($module == '') continue; + + $type = ''; + $table = constant('TABLE_'. strtoupper($module)); + $object = new stdclass(); + + if($table == TABLE_EXECUTION) + { + $type = $model == 'scrum' ? 'sprint' : 'stage'; + } + + $object = $this->getDataByProject($table, $projectID, $type); + if(!empty($object)) return false; + } + return true; + } + + /** + * Get the objects under the project. + * + * @param constant $table + * @param int $projectID + * @param string $type + * @access public + * @return object + */ + public function getDataByProject($table, $projectID, $type = '') + { + $result = $this->dao->select('id')->from($table) + ->where('project')->eq($projectID) + ->beginIF(!empty($type))->andWhere('type')->eq($type)->fi() + ->fetch(); + return $result; + } } diff --git a/module/project/view/edit.html.php b/module/project/view/edit.html.php index bd007d5e87..c72e8566a5 100644 --- a/module/project/view/edit.html.php +++ b/module/project/view/edit.html.php @@ -34,6 +34,10 @@ + + + + - +
project->model;?>project->modelList, $model, "class='form-control chosen' required $disableModel");?>
program->parent;?> model); echo html::submitButton(); if(!isonlybody()) echo html::backButton(); ?> diff --git a/module/project/view/view.html.php b/module/project/view/view.html.php index 82cc615f3c..0285d8c651 100644 --- a/module/project/view/view.html.php +++ b/module/project/view/view.html.php @@ -193,7 +193,7 @@
execution->totalEstimate;?>totalEstimate . $lang->execution->workHour;?>totalEstimate . $lang->execution->workHour;?> execution->totalDays;?> days;?>