diff --git a/module/execution/model.php b/module/execution/model.php index 8d8fe2e4d0..bd90f23b59 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -4441,6 +4441,18 @@ class executionModel extends model return $productpairs; } + /** + * Get lifetime by id list. + * + * @param string $idList + * @access public + * @return array + */ + public function getLifetimeByIdList($idList = '') + { + return $this->dao->select('id,lifetime')->from(TABLE_EXECUTION)->where('id')->in($idList)->fetchPairs(); + } + /** ** Set stage tree path. ** diff --git a/module/task/control.php b/module/task/control.php index 27419d0dbd..f4dc863008 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -290,7 +290,8 @@ class task extends control /* Set Custom*/ foreach(explode(',', $this->config->task->customCreateFields) as $field) $customFields[$field] = $this->lang->task->$field; - if($execution->type == 'ops') unset($customFields['story']); + + $executions = $this->config->systemMode == 'classic' ? $executions : $this->execution->getByProject($projectID, !common::canModify('execution', $execution) ? 'noclosed' : 'all', 0, true); $this->view->customFields = $customFields; $this->view->showFields = $this->config->task->custom->createFields; @@ -300,7 +301,8 @@ class task extends control $this->view->position = $position; $this->view->gobackLink = (isset($output['from']) and $output['from'] == 'global') ? $this->createLink('execution', 'task', "executionID=$executionID") : ''; $this->view->execution = $execution; - $this->view->executions = $this->config->systemMode == 'classic' ? $executions : $this->execution->getByProject($projectID, !common::canModify('execution', $execution) ? 'noclosed' : 'all', 0, true); + $this->view->executions = $executions; + $this->view->lifetimeList = $this->execution->getLifetimeByIdList(array_keys($executions)); $this->view->task = $task; $this->view->users = $users; $this->view->storyID = $storyID; @@ -435,6 +437,9 @@ class task extends control if($execution->type == 'stage' and strpos('estStarted,deadline', $field) !== false) continue; $customFields[$field] = $this->lang->task->$field; } + + if($execution->lifetime == 'ops') unset($customFields['story']); + $this->view->customFields = $customFields; $this->view->showFields = $this->config->task->custom->batchCreateFields; diff --git a/module/task/js/create.js b/module/task/js/create.js index fa6378c063..ab94beed36 100644 --- a/module/task/js/create.js +++ b/module/task/js/create.js @@ -3,6 +3,17 @@ $(function() $('#customField').click(function() { hiddenRequireFields(); + + var fieldList = showFields + ','; + var requiredList = ',' + requiredFields + ','; + if(lifetime == 'ops') + { + $('#fieldsstory').parent('div').addClass('hidden'); + } + else if(fieldList.indexOf('story') >= 0 && requiredList.indexOf('story') < 0) + { + $('#fieldsstory').parent('div').removeClass('hidden'); + } }); /* Implement a custom form without feeling refresh. */ @@ -22,6 +33,17 @@ $(function() */ function loadAll(executionID) { + lifetime = lifetimeList[executionID]; + var fieldList = showFields + ','; + if(lifetime == 'ops') + { + $('.storyBox').addClass('hidden'); + } + else if(fieldList.indexOf('story') >= 0) + { + $('.storyBox').removeClass('hidden'); + } + loadModuleMenu(executionID); loadExecutionStories(executionID); loadExecutionMembers(executionID); @@ -408,8 +430,11 @@ $(document).ready(function() }); $('#type').change(function() { - $('#selectTestStoryBox').toggleClass('hidden', $(this).val() != 'test'); - toggleSelectTestStory(); + if(lifetime != 'ops') + { + $('#selectTestStoryBox').toggleClass('hidden', $(this).val() != 'test'); + toggleSelectTestStory(); + } }); setStoryRelated(); diff --git a/module/task/model.php b/module/task/model.php index b2284e7174..56696f7409 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -116,8 +116,8 @@ class taskModel extends model $task = $this->loadModel('file')->processImgURL($task, $this->config->task->editor->create['id'], $this->post->uid); /* Fix Bug #1525 */ - $executionType = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($executionID)->fetch('type'); - if($executionType == 'ops') + $executionLifetime = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($executionID)->fetch('lifetime'); + if($executionLifetime == 'ops') { $requiredFields = str_replace(",story,", ',', "$requiredFields"); $task->story = 0; @@ -381,9 +381,9 @@ class taskModel extends model } /* Fix bug #1525*/ - $executionType = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($executionID)->fetch('type'); + $executionLifetime = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($executionID)->fetch('lifetime'); $requiredFields = ',' . $this->config->task->create->requiredFields . ','; - if($executionType == 'ops') $requiredFields = str_replace(',story,', ',', $requiredFields); + if($executionLifetime == 'ops') $requiredFields = str_replace(',story,', ',', $requiredFields); $requiredFields = trim($requiredFields, ','); /* check data. */ @@ -1036,9 +1036,9 @@ class taskModel extends model $task->mode = ''; } - $executionType = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($task->execution)->fetch('type'); + $executionLifetime = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($task->execution)->fetch('lifetime'); $requiredFields = "," . $this->config->task->edit->requiredFields . ","; - if($executionType == 'ops') + if($executionLifetime == 'ops') { $requiredFields = str_replace(",story,", ',', "$requiredFields"); $task->story = 0; diff --git a/module/task/view/batchcreate.html.php b/module/task/view/batchcreate.html.php index b2329a7667..9a5684e1e3 100755 --- a/module/task/view/batchcreate.html.php +++ b/module/task/view/batchcreate.html.php @@ -45,7 +45,7 @@ $colspan = count($visibleFields) + 3; task->batchCreate;?> - type != 'ops'):?> + lifetime != 'ops'):?> @@ -67,7 +67,7 @@ $colspan = count($visibleFields) + 3; idAB;?> moduleBox'>task->module?> - type != 'ops'):?> + lifetime != 'ops'):?> storyBox'>task->story;?> task->name;?> @@ -99,7 +99,7 @@ $colspan = count($visibleFields) + 3; $lang->task->typeList['ditto'] = $lang->task->ditto; $members['ditto'] = $lang->task->ditto; $modules['ditto'] = $lang->task->ditto; - if($execution->type == 'ops') $colspan = $colspan - 1; + if($execution->lifetime == 'ops') $colspan = $colspan - 1; ?> task->batchCreate; $i++):?> id)'")?> - type != 'ops'):?> + lifetime != 'ops'):?>
@@ -266,7 +266,7 @@ $colspan = count($visibleFields) + 3; - type != 'ops'):?> + lifetime != 'ops'):?>
diff --git a/module/task/view/create.html.php b/module/task/view/create.html.php index ff4ce54b29..139676690b 100644 --- a/module/task/view/create.html.php +++ b/module/task/view/create.html.php @@ -19,6 +19,8 @@ vision);?> task->create->requiredFields);?> error->notempty, $lang->task->estimate))?> +lifetime);?> + diff --git a/www/js/my.full.js b/www/js/my.full.js index 0c0db4fc4b..0482f92a3c 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -1237,6 +1237,8 @@ function showCheckedFields(fields) if(!$('.borderBox').hasClass('hidden')) $('.borderBox').addClass('hidden'); if(!$('.datePlanBox').hasClass('hidden')) $('.datePlanBox').addClass('hidden'); } + + if(typeof lifetime != 'undefined' && lifetime == 'ops') $('.storyBox').addClass('hidden'); } }