This commit is contained in:
tianshujie
2022-07-14 14:46:46 +08:00
parent b9859380ff
commit 711c0e9e8c
7 changed files with 61 additions and 15 deletions
+12
View File
@@ -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.
**
+7 -2
View File
@@ -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;
+27 -2
View File
@@ -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();
+6 -6
View File
@@ -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;
+5 -5
View File
@@ -45,7 +45,7 @@ $colspan = count($visibleFields) + 3;
<?php echo $lang->task->batchCreate;?>
<?php endif;?>
</h2>
<?php if($execution->type != 'ops'):?>
<?php if($execution->lifetime != 'ops'):?>
<a class="checkbox-primary pull-left" id='zeroTaskStory' href='javascript:toggleZeroTaskStory();'>
<label><?php echo $lang->story->zeroTask;?></label>
</a>
@@ -67,7 +67,7 @@ $colspan = count($visibleFields) + 3;
<tr>
<th class='c-id'><?php echo $lang->idAB;?></th>
<th class='c-module<?php echo zget($visibleFields, 'module', ' hidden') . zget($requiredFields, 'module', '', ' required');?> moduleBox'><?php echo $lang->task->module?></th>
<?php if($execution->type != 'ops'):?>
<?php if($execution->lifetime != 'ops'):?>
<th class='c-story<?php echo zget($visibleFields, 'story', ' hidden') . zget($requiredFields, 'story', '', ' required');?> storyBox'><?php echo $lang->task->story;?></th>
<?php endif;?>
<th class='c-name required has-btn'><?php echo $lang->task->name;?></span></th>
@@ -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;
?>
<?php for($i = 1; $i <= $config->task->batchCreate; $i++):?>
<?php
@@ -121,7 +121,7 @@ $colspan = count($visibleFields) + 3;
<?php echo html::select("module[$i]", $modules, $moduleID, "class='form-control chosen' onchange='setStories(this.value, $execution->id)'")?>
<?php echo html::hidden("parent[$i]", $parent);?>
</td>
<?php if($execution->type != 'ops'):?>
<?php if($execution->lifetime != 'ops'):?>
<td class="<?php echo zget($visibleFields, 'story', 'hidden');?> storyBox" style='overflow: visible'>
<div class='input-group'>
<?php echo html::select("story[$i]", $stories, $currentStory, "class='form-control chosen' onchange='setStoryRelated($i)'");?>
@@ -266,7 +266,7 @@ $colspan = count($visibleFields) + 3;
<?php echo html::select("module[$i]", $modules, $moduleID, "class='form-control chosen'")?>
<?php echo html::hidden("parent[$i]", $parent);?>
</td>
<?php if($execution->type != 'ops'):?>
<?php if($execution->lifetime != 'ops'):?>
<td class="<?php echo zget($visibleFields, 'story', 'hidden');?> storyBox" style='overflow: visible'>
<div class='input-group'>
<?php echo html::select("story[$i]", $stories, $currentStory, "class='form-control chosen' onchange='setStoryRelated($i)'");?>
+2
View File
@@ -19,6 +19,8 @@
<?php js::set('vision', $config->vision);?>
<?php js::set('requiredFields', $config->task->create->requiredFields);?>
<?php js::set('estimateNotEmpty', sprintf($lang->error->notempty, $lang->task->estimate))?>
<?php js::set('lifetime', $execution->lifetime);?>
<?php js::set('lifetimeList', $lifetimeList);?>
<?php if(!empty($storyID)):?>
<style> .title-group.required > .required:after {right: 110px;}</style>
<?php endif;?>
+2
View File
@@ -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');
}
}