* Add upgrade logic.
This commit is contained in:
@@ -307,7 +307,8 @@ class group extends control
|
||||
|
||||
list($programs, $projects, $products, $executions) = $this->group->getObject4AdminGroup();
|
||||
|
||||
$group = $this->group->getById($groupID);
|
||||
$group = $this->group->getById($groupID);
|
||||
$groupUsers = $this->dao->select('t1.account, t2.realname')->from(TABLE_PROJECTADMIN)->alias('t1')->leftJoin(TABLE_USER)->alias('t2')->on('t1.account = t2.account')->fetchPairs();
|
||||
|
||||
$title = $this->lang->company->common . $this->lang->colon . $group->name . $this->lang->colon . $this->lang->group->manageMember;
|
||||
$position[] = $group->name;
|
||||
@@ -315,7 +316,7 @@ class group extends control
|
||||
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->allUsers = array('' => '') + $this->loadModel('dept')->getDeptUserPairs($deptID);
|
||||
$this->view->allUsers = array('' => '') + $groupUsers + $this->loadModel('dept')->getDeptUserPairs($deptID);
|
||||
$this->view->deptID = $deptID;
|
||||
$this->view->programs = $programs;
|
||||
$this->view->projects = $projects;
|
||||
|
||||
@@ -515,6 +515,9 @@ class upgradeModel extends model
|
||||
$this->replaceSetLanePriv();
|
||||
$this->updateProjectData();
|
||||
break;
|
||||
case '17_1':
|
||||
$this->moveProjectAdmins();
|
||||
break;
|
||||
}
|
||||
|
||||
$this->deletePatch();
|
||||
@@ -6437,4 +6440,27 @@ class upgradeModel extends model
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function moveProjectAdmins()
|
||||
{
|
||||
$adminGroupID = $this->dao->select('id')->from(TABLE_GROUP)->where('role')->eq('projectAdmin')->fetch('id');
|
||||
$projectAdmins = $this->dao->select('account, project')->from(TABLE_USERGROUP)->where('`group`')->eq($adminGroupID)->fetchPairs();
|
||||
|
||||
$i = 1;
|
||||
foreach($projectAdmins as $account => $projects)
|
||||
{
|
||||
if(!$account or !$projects) continue;
|
||||
|
||||
$data = new stdclass();
|
||||
$data->group = $i;
|
||||
$data->account = $account;
|
||||
$data->projects = $projects;
|
||||
|
||||
$this->dao->replace(TABLE_PROJECTADMIN)->data($data)->exec();
|
||||
|
||||
$i ++;
|
||||
}
|
||||
|
||||
$this->dao->delete()->from(TABLE_USERGROUP)->where('`group`')->eq($adminGroupID)->exec();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user