| - + | + | + |
-
+
%
|
stage->typeList, '', "class='form-control'");?> | -project->aclList, 'open', "class='form-control' $class");?> | +project->aclList, 'open', "class='form-control' $class");?> | programplan->milestoneList, 0);?> | -- | - | - | + | + | + | + | 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 @@ |