* Code for task #36028.

This commit is contained in:
holan20180123
2021-03-03 11:09:34 +08:00
parent bc0c65f776
commit b5a16df369
3 changed files with 27 additions and 6 deletions
+13 -1
View File
@@ -509,7 +509,7 @@ class upgrade extends control
public function ajaxGetProjectPairsByProgram($programID = 0)
{
$projects = array('' => '') + $this->upgrade->getProjectPairsByProgram($programID);
die(html::select('projects', $projects, '', 'class="form-control prj-exist"'));
die(html::select('projects', $projects, '', 'class="form-control prj-exist" onchange="getPGMStatus(\'project\', this.value)"'));
}
/**
@@ -675,4 +675,16 @@ class upgrade extends control
{
die($this->dao->findByID($productID)->from(TABLE_PRODUCT)->fetch('name'));
}
/**
* Ajax get program status.
*
* @param int $projectID
* @access public
* @return void
*/
public function ajaxGetPGMStatus($programID)
{
die($this->dao->select('status')->from(TABLE_PROGRAM)->where('id')->eq($programID)->fetch('status'));
}
}
+13 -4
View File
@@ -152,6 +152,7 @@ function getProjectByProgram(obj)
})
getLineByProgram();
getPGMStatus('program', programID);
}
/**
@@ -598,12 +599,20 @@ function computeEndDate(delta)
computeWorkDays();
}
function getPGMStatus(objectType, programID)
/**
* Get program status.
*
* @param string $objectType
* @param int $objectID
* @access public
* @return void
*/
function getPGMStatus(objectType, objectID)
{
var link = createLink('upgrade', 'ajaxGetPGMStatus', 'programID=' + programID);
var link = createLink('upgrade', 'ajaxGetPGMStatus', 'objectID=' + objectID);
$.post(link, function(data)
{
if(objectType == 'program') $('#PGMStatus').val(data);
if(objectType == 'project') $('#PRJStatus').val(data);
if(objectType == 'program') $('#PGMStatus').val(data).trigger("chosen:updated");
if(objectType == 'project') $('#PRJStatus').val(data).trigger("chosen:updated");
})
}
+1 -1
View File
@@ -30,7 +30,7 @@
</th>
<td class='required'>
<div class='input-group'>
<?php echo html::select("projects", $projects, '', "class='form-control hidden prj-exist'");?>
<?php echo html::select("projects", $projects, '', "class='form-control hidden prj-exist' onchange='getPGMStatus(project, this.value)'");?>
<?php echo html::input("PRJName", isset($sprintName) ? $sprintName : '', "class='form-control prj-no-exist'");?>
<?php if(count($projects)):?>
<span class='input-group-addon'>