* Fix bug#23821.

This commit is contained in:
leiyong
2022-06-16 11:16:17 +00:00
parent bb337fdc9c
commit 80c03beea7
3 changed files with 61 additions and 9 deletions
+29 -3
View File
@@ -1576,6 +1576,9 @@ class execution extends control
return print(js::confirm($this->lang->execution->importEditPlanStory, inlink('edit', "executionID=$executionID&action=edit&extra=&newPlans=$newPlans&confirm=yes"), inlink('view', "executionID=$executionID")));
}
/* Set menu. */
$this->execution->setMenu($executionID);
if(!empty($_POST))
{
$oldPlans = $this->dao->select('plan')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($executionID)->andWhere('plan')->ne(0)->fetchPairs('plan');
@@ -1638,9 +1641,6 @@ class execution extends control
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "executionID=$executionID")));
}
/* Set menu. */
$this->execution->setMenu($executionID);
$executions = array('' => '') + $this->executions;
$managers = $this->execution->getDefaultManagers($executionID);
@@ -3902,4 +3902,30 @@ class execution extends control
echo true;
}
/**
* AJAX: Gets the start date of the project to which the execution belongs.
*
* @param int $executionID
* @access public
* @return string
*/
public function ajaxGetProjectStartDate($executionID = 0)
{
if($this->config->systemMode == 'new')
{
$execution = $this->dao->select('id,project')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch();
$project = $this->dao->select('begin,end')->from(TABLE_PROJECT)->where('id')->eq($execution->project)->fetch();
if(empty($project))
{
echo '';
return false;
}
$date = array();
$date['begin'] = $project->begin;
$date['end'] = $project->end;
echo json_encode($date);
}
}
}
+27 -5
View File
@@ -144,8 +144,6 @@ js::set('emptyEnd', $lang->programplan->emptyEnd);
js::set('planFinishSmall', $lang->programplan->error->planFinishSmall);
js::set('errorBegin', $lang->execution->errorLetterProject);
js::set('errorEnd', $lang->execution->errorGreaterProject);
js::set('projectBeginDate', $project->begin);
js::set('projectEndDate', $project->end);
?>
<script>
@@ -157,8 +155,9 @@ $('#executionForm').submit(function()
var beginDate = $(this).val();
var beginDateID = $(this).attr('id');
var nameID = beginDateID.replace('begins', 'names');
var endDateID = beginDateID.replace('begins', 'ends');
var nameID = beginDateID.replace('begins', 'names');
var endDateID = beginDateID.replace('begins', 'ends');
var executionID = beginDateID.replace('begins', '');
$('#help' + beginDateID).remove();
$('#help' + endDateID).remove();
@@ -166,6 +165,25 @@ $('#executionForm').submit(function()
var nameVal = $('#' + nameID).val()
if(!nameVal) return;
var projectBeginDate = '0000-00-00';
var projectEndDate = '2059-12-31';
$.ajax(
{
url: createLink('execution', 'ajaxGetProjectStartDate', "executionID=" + executionID),
dataType: 'json',
method: 'post',
async: false,
success: function(data)
{
if(data)
{
projectBeginDate = data.begin;
projectEndDate = data.end;
}
}
});
// Check if the begin date is empty.
if(!beginDate)
{
@@ -216,7 +234,11 @@ $('#executionForm').submit(function()
}
});
if(!submitForm) return false;
if(!submitForm)
{
setTimeout(function(){$('#submit').removeAttr('disabled')}, 500);
return false;
}
});
</script>
<?php include '../../common/view/footer.html.php';?>
+5 -1
View File
@@ -285,7 +285,11 @@ $('#planForm').submit(function()
}
});
if(!submitForm) return false;
if(!submitForm)
{
setTimeout(function(){$('#submit').removeAttr('disabled')}, 500);
return false;
}
});
</script>
<?php include '../../common/view/footer.html.php';?>