diff --git a/module/programplan/control.php b/module/programplan/control.php index 63182f84cf..15ad376701 100644 --- a/module/programplan/control.php +++ b/module/programplan/control.php @@ -326,26 +326,26 @@ class programplan extends control } /** - * AJAX: Get attributes. + * ajax请求:获取阶段ID的属性。 + * AJAX: Get stageID attributes. * * @param int $stageID * @param string $attribute * @access public * @return int */ - public function ajaxGetAttribute($stageID, $attribute) + public function ajaxGetAttribute(int $stageID, string $attribute): int { $this->app->loadLang('stage'); - $parentAttribute = $this->dao->select('attribute')->from(TABLE_EXECUTION)->where('id')->eq($stageID)->fetch('attribute'); - if(empty($parentAttribute) or $parentAttribute == 'mix') + $stageAttribute = $this->programplan->getStageAttribute($stageID); + + if(empty($stageAttribute) || $stageAttribute == 'mix') { return print(html::select('attribute', $this->lang->stage->typeList, $attribute, "class='form-control chosen'")); } - else - { - return print(zget($this->lang->stage->typeList, $parentAttribute)); - } + + return print(zget($this->lang->stage->typeList, $stageAttribute)); } /** diff --git a/module/programplan/model.php b/module/programplan/model.php index 3ffe74188b..8f5e8c4c82 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -1724,4 +1724,22 @@ class programplanModel extends model return true; } + + /** + * 获取阶段ID的属性。 + * Get stageID attribute. + * + * @param int $stageID + * @access public + * @return false|string + */ + public function getStageAttribute(int $stageID): false|string + { + $stageAttribute = $this->dao->select('attribute')->from(TABLE_EXECUTION)->where('id')->eq($stageID)->fetch('attribute'); + + if(dao::isError()) return false; + + return $stageAttribute; + } + }