* Fix project get pairs method.

This commit is contained in:
Yagami
2020-09-29 13:08:01 +08:00
parent 8e74ba9677
commit d4e8a1ba84
3 changed files with 10 additions and 4 deletions
+7 -2
View File
@@ -815,9 +815,14 @@ class programModel extends model
* @access public
* @return object
*/
public function getPRJPairs($projectID = 0)
public function getPRJPairs($programID = 0)
{
return $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch();
return $this->dao->select('id, name')->from(TABLE_PROJECT)
->where('type')->eq('project')
->andWhere('deleted')->eq(0)
->beginIF($programID)->andWhere('parent')->eq($programID)->fi()
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->programs)->fi()
->fetchPairs();
}
/**
+1 -1
View File
@@ -90,7 +90,7 @@ class repo extends control
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted');
$this->view->programs = $this->loadModel('program')->getPairs();
$this->view->programs = $this->loadModel('program')->getPRJPairs();
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->create;
$this->view->position[] = html::a(inlink('maintain'), $this->lang->repo->common);
+2 -1
View File
@@ -590,7 +590,8 @@ class todo extends control
public function ajaxGetProgramID($objectID, $objectType)
{
$table = $objectType == 'project' ? TABLE_PROJECT : TABLE_PRODUCT;
die($this->dao->select('program')->from($table)->where('id')->eq($objectID)->fetch('program'));
$field = $objectType == 'project' ? 'parent' : 'program';
die($this->dao->select($field)->from($table)->where('id')->eq($objectID)->fetch($field));
}
/**