* finish task #40005.
This commit is contained in:
@@ -4,6 +4,7 @@ $config->execution->defaultWorkhours = '7.0';
|
||||
$config->execution->orderBy = 'isDone,status,order_desc';
|
||||
$config->execution->maxBurnDay = '31';
|
||||
$config->execution->weekend = '2';
|
||||
$config->execution->ownerFields = array('PO', 'PM', 'QD', 'RD');
|
||||
|
||||
$config->execution->list = new stdclass();
|
||||
$config->execution->list->exportFields = 'id,name,code,PM,end,status,totalEstimate,totalConsumed,totalLeft,progress';
|
||||
|
||||
@@ -1482,6 +1482,7 @@ class execution extends control
|
||||
$this->view->qdUsers = $qdUsers;
|
||||
$this->view->rdUsers = $rdUsers;
|
||||
$this->view->users = $this->user->getPairs('nodeleted|noclosed');
|
||||
$this->view->allProjects = $this->project->getPairsByModel();
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->allProducts = $allProducts;
|
||||
$this->view->linkedProducts = $linkedProducts;
|
||||
@@ -1521,6 +1522,7 @@ class execution extends control
|
||||
if($this->app->openApp == 'project')
|
||||
{
|
||||
$this->project->setMenu($this->session->project);
|
||||
$this->view->project = $this->project->getById($this->session->project);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1561,6 +1563,7 @@ class execution extends control
|
||||
$this->view->position[] = $this->lang->execution->batchEdit;
|
||||
$this->view->executionIDList = $executionIDList;
|
||||
$this->view->executions = $executions;
|
||||
$this->view->allProjects = $this->project->getPairsByModel();
|
||||
$this->view->pmUsers = $pmUsers;
|
||||
$this->view->poUsers = $poUsers;
|
||||
$this->view->qdUsers = $qdUsers;
|
||||
@@ -2736,7 +2739,7 @@ class execution extends control
|
||||
{
|
||||
foreach($estimateInfo->estimate as $account => $estimate)
|
||||
{
|
||||
if(!in_array($account, array_keys($team)))
|
||||
if(!in_array($account, array_keys($team)))
|
||||
{
|
||||
$team[$account] = new stdclass();
|
||||
$team[$account]->account = $account;
|
||||
|
||||
+108
-39
@@ -458,14 +458,13 @@ class executionModel extends model
|
||||
->setDefault('lastEditedDate', helper::now())
|
||||
->setIF(helper::isZeroDate($this->post->begin), 'begin', '')
|
||||
->setIF(helper::isZeroDate($this->post->end), 'end', '')
|
||||
->setIF($this->post->acl != 'custom', 'whitelist', '')
|
||||
->setDefault('team', $this->post->name)
|
||||
->join('whitelist', ',')
|
||||
->stripTags($this->config->execution->editor->edit['id'], $this->config->allowedTags)
|
||||
->remove('products, branch, uid, plans')
|
||||
->get();
|
||||
|
||||
if($this->config->systemMode == 'new') $this->checkBeginAndEndDate($oldExecution->project, $execution->begin, $execution->end);
|
||||
if($this->config->systemMode == 'new' and (empty($execution->project) or $execution->project == $oldExecution->project)) $this->checkBeginAndEndDate($oldExecution->project, $execution->begin, $execution->end);
|
||||
if(dao::isError()) return false;
|
||||
|
||||
/* Child stage inherits parent stage permissions. */
|
||||
@@ -497,25 +496,22 @@ class executionModel extends model
|
||||
->exec();
|
||||
|
||||
$changedAccounts = array();
|
||||
foreach($execution as $fieldName => $value)
|
||||
foreach($this->config->execution->ownerFields as $ownerField)
|
||||
{
|
||||
if($fieldName == 'PO' or $fieldName == 'PM' or $fieldName == 'QD' or $fieldName == 'RD' )
|
||||
{
|
||||
if(!empty($value) and !isset($team[$value]))
|
||||
{
|
||||
$member = new stdclass();
|
||||
$member->root = (int)$executionID;
|
||||
$member->account = $value;
|
||||
$member->join = helper::today();
|
||||
$member->role = $this->lang->execution->$fieldName;
|
||||
$member->days = zget($execution, 'days', 0);
|
||||
$member->type = 'execution';
|
||||
$member->hours = $this->config->execution->defaultWorkhours;
|
||||
$this->dao->replace(TABLE_TEAM)->data($member)->exec();
|
||||
$owner = zget($execution, $ownerField, '');
|
||||
if(empty($owner) or isset($team[$owner])) continue;
|
||||
|
||||
$changedAccounts[] = $value;
|
||||
}
|
||||
}
|
||||
$member = new stdclass();
|
||||
$member->root = (int)$executionID;
|
||||
$member->account = $owner;
|
||||
$member->join = helper::today();
|
||||
$member->role = $this->lang->execution->$ownerField;
|
||||
$member->days = zget($execution, 'days', 0);
|
||||
$member->type = 'execution';
|
||||
$member->hours = $this->config->execution->defaultWorkhours;
|
||||
$this->dao->replace(TABLE_TEAM)->data($member)->exec();
|
||||
|
||||
$changedAccounts[$owner] = $owner;
|
||||
}
|
||||
|
||||
$whitelist = explode(',', $execution->whitelist);
|
||||
@@ -526,6 +522,13 @@ class executionModel extends model
|
||||
|
||||
if(!dao::isError())
|
||||
{
|
||||
if(isset($execution->project) and $execution->project != $oldExecution->project)
|
||||
{
|
||||
$execution->parent = $execution->project;
|
||||
$execution->path = ",{$execution->project},{$executionID},";
|
||||
$this->changeProject($execution->project, $oldExecution->project, $executionID);
|
||||
}
|
||||
|
||||
$this->file->updateObjectID($this->post->uid, $executionID, 'execution');
|
||||
return common::createChanges($oldExecution, $execution);
|
||||
}
|
||||
@@ -578,16 +581,16 @@ class executionModel extends model
|
||||
$executions[$executionID]->QD = $data->QDs[$executionID];
|
||||
$executions[$executionID]->RD = $data->RDs[$executionID];
|
||||
$executions[$executionID]->lifetime = $data->lifetimes[$executionID];
|
||||
$executions[$executionID]->attribute = $data->attributes[$executionID];
|
||||
$executions[$executionID]->status = $data->statuses[$executionID];
|
||||
$executions[$executionID]->begin = $data->begins[$executionID];
|
||||
$executions[$executionID]->end = $data->ends[$executionID];
|
||||
$executions[$executionID]->team = $data->teams[$executionID];
|
||||
$executions[$executionID]->desc = htmlspecialchars_decode($data->descs[$executionID]);
|
||||
$executions[$executionID]->days = $data->dayses[$executionID];
|
||||
$executions[$executionID]->order = $data->orders[$executionID];
|
||||
$executions[$executionID]->lastEditedBy = $this->app->user->account;
|
||||
$executions[$executionID]->lastEditedDate = helper::now();
|
||||
if(isset($data->projects)) $executions[$executionID]->project = zget($data->projects, $executionID, 0);
|
||||
if(isset($data->attributes)) $executions[$executionID]->attribute = zget($data->attributes, $executionID, '');
|
||||
|
||||
/* Check unique name for edited executions. */
|
||||
if(isset($nameList[$executionName])) dao::$errors['name'][] = 'execution#' . $executionID . sprintf($this->lang->error->unique, $this->lang->execution->name, $executionName);
|
||||
@@ -624,26 +627,30 @@ class executionModel extends model
|
||||
->exec();
|
||||
if(dao::isError()) die(js::error('execution#' . $executionID . dao::getError(true)));
|
||||
|
||||
$changedAccounts = array();
|
||||
foreach($execution as $fieldName => $value)
|
||||
if(!empty($execution->project) and $oldExecution->project != $execution->project)
|
||||
{
|
||||
if($fieldName == 'PO' or $fieldName == 'PM' or $fieldName == 'QD' or $fieldName == 'RD' )
|
||||
{
|
||||
if(!empty($value) and !isset($team[$value]))
|
||||
{
|
||||
$member = new stdClass();
|
||||
$member->root = (int)$executionID;
|
||||
$member->type = 'execution';
|
||||
$member->account = $value;
|
||||
$member->join = helper::today();
|
||||
$member->role = $this->lang->execution->$fieldName;
|
||||
$member->days = 0;
|
||||
$member->hours = $this->config->execution->defaultWorkhours;
|
||||
$this->dao->replace(TABLE_TEAM)->data($member)->exec();
|
||||
$execution->parent = $execution->project;
|
||||
$execution->path = ",{$execution->project},{$executionID},";
|
||||
$this->changeProject($execution->project, $oldExecution->project, $executionID);
|
||||
}
|
||||
|
||||
$changedAccounts[] = $value;
|
||||
}
|
||||
}
|
||||
$changedAccounts = array();
|
||||
foreach($this->config->execution->ownerFields as $ownerField)
|
||||
{
|
||||
$owner = zget($execution, $ownerField, '');
|
||||
if(empty($owner) or isset($team[$owner])) continue;
|
||||
|
||||
$member = new stdclass();
|
||||
$member->root = (int)$executionID;
|
||||
$member->account = $owner;
|
||||
$member->join = helper::today();
|
||||
$member->role = $this->lang->execution->$ownerField;
|
||||
$member->days = zget($execution, 'days', 0);
|
||||
$member->type = 'execution';
|
||||
$member->hours = $this->config->execution->defaultWorkhours;
|
||||
$this->dao->replace(TABLE_TEAM)->data($member)->exec();
|
||||
|
||||
$changedAccounts[] = $owner;
|
||||
}
|
||||
if(!empty($changedAccounts)) $this->updateUserView($executionID, 'sprint', $changedAccounts);
|
||||
|
||||
@@ -2062,6 +2069,68 @@ class executionModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change execution project.
|
||||
*
|
||||
* @param int $newProject
|
||||
* @param int $oldProject
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function changeProject($newProject, $oldProject, $executionID)
|
||||
{
|
||||
if($newProject == $oldProject) return;
|
||||
|
||||
$this->dao->update(TABLE_EXECUTION)->set('parent')->eq($newProject)->set('path')->eq(",$newProject,$executionID,")->where('id')->eq($executionID)->exec();
|
||||
|
||||
$this->dao->update(TABLE_BUILD)->set('project')->eq($newProject)->where('project')->eq($oldProject)->andWhere('execution')->eq($executionID)->exec();
|
||||
$this->dao->update(TABLE_BUG)->set('project')->eq($newProject)->where('project')->eq($oldProject)->andWhere('execution')->eq($executionID)->exec();
|
||||
$this->dao->update(TABLE_CASE)->set('project')->eq($newProject)->where('project')->eq($oldProject)->andWhere('execution')->eq($executionID)->exec();
|
||||
$this->dao->update(TABLE_DOC)->set('project')->eq($newProject)->where('project')->eq($oldProject)->andWhere('execution')->eq($executionID)->exec();
|
||||
$this->dao->update(TABLE_DOCLIB)->set('project')->eq($newProject)->where('project')->eq($oldProject)->andWhere('execution')->eq($executionID)->exec();
|
||||
$this->dao->update(TABLE_TASK)->set('project')->eq($newProject)->where('project')->eq($oldProject)->andWhere('execution')->eq($executionID)->exec();
|
||||
$this->dao->update(TABLE_TESTREPORT)->set('project')->eq($newProject)->where('project')->eq($oldProject)->andWhere('execution')->eq($executionID)->exec();
|
||||
|
||||
$executionTeam = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution');
|
||||
$projectTeam = $this->user->getTeamMemberPairs($newProject, 'project');
|
||||
$addedAccounts = array();
|
||||
foreach($executionTeam as $account => $realname)
|
||||
{
|
||||
if(isset($projectTeam[$account])) continue;
|
||||
|
||||
$member = new stdclass();
|
||||
$member->root = (int)$newProject;
|
||||
$member->type = 'project';
|
||||
$member->account = $account;
|
||||
$member->join = helper::today();
|
||||
$member->days = 0;
|
||||
$member->hours = $this->config->execution->defaultWorkhours;
|
||||
$this->dao->replace(TABLE_TEAM)->data($member)->exec();
|
||||
|
||||
$addedAccounts[$account] = $account;
|
||||
}
|
||||
|
||||
$executionWhitelist = $this->loadModel('personnel')->getWhitelistAccount($executionID, 'sprint');
|
||||
$projectWhitelist = $this->personnel->getWhitelistAccount($newProject, 'project');
|
||||
foreach($executionWhitelist as $account)
|
||||
{
|
||||
if(isset($projectWhitelist[$account])) continue;
|
||||
|
||||
$whitelist = new stdclass();
|
||||
$whitelist->account = $account;
|
||||
$whitelist->objectType = 'project';
|
||||
$whitelist->objectID = (int)$newProject;
|
||||
$whitelist->type = 'whitelist';
|
||||
$whitelist->source = 'sync';
|
||||
$this->dao->replace(TABLE_ACL)->data($whitelist)->exec();
|
||||
|
||||
$addedAccounts[$account] = $account;
|
||||
}
|
||||
|
||||
if($addedAccounts) $this->loadModel('user')->updateUserView($newProject, 'project', $addedAccounts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Link story.
|
||||
*
|
||||
|
||||
@@ -50,6 +50,9 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='w-50px'><?php echo $lang->idAB;?></th>
|
||||
<?php if($config->systemMode == 'new' and isset($project) and $project->model == 'scrum'):?>
|
||||
<th class='required' style="width:100%"><?php echo $lang->execution->project;?></th>
|
||||
<?php endif;?>
|
||||
<th class='required <?php echo $minWidth?>' style="width:100%"><?php echo $lang->execution->$name;?></th>
|
||||
<th class='w-150px required'><?php echo $lang->execution->$code;?></th>
|
||||
<th class='w-150px<?php echo zget($visibleFields, 'PM', ' hidden') . zget($requiredFields, 'PM', '', ' required');?>'><?php echo $lang->execution->$PM;?></th>
|
||||
@@ -62,7 +65,7 @@
|
||||
<th class='w-110px required'><?php echo $lang->execution->end;?></th>
|
||||
<th class='w-150px<?php echo zget($visibleFields, 'desc', ' hidden') . zget($requiredFields, 'desc', '', ' required');?>'><?php echo $lang->execution->$desc;?></th>
|
||||
<th class='w-150px<?php echo zget($visibleFields, 'teamname', ' hidden') . zget($requiredFields, 'teamname', '', ' required');?>'><?php echo $lang->execution->teamname;?></th>
|
||||
<th class='w-150px<?php echo zget($visibleFields, 'days', ' hidden') . zget($requiredFields, 'days', '', ' required');?>'><?php echo $lang->execution->days;?></th>
|
||||
<th class='w-120px<?php echo zget($visibleFields, 'days', ' hidden') . zget($requiredFields, 'days', '', ' required');?>'><?php echo $lang->execution->days;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -75,6 +78,9 @@
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo sprintf('%03d', $executionID) . html::hidden("executionIDList[$executionID]", $executionID);?></td>
|
||||
<?php if($config->systemMode == 'new' and isset($project) and $project->model == 'scrum'):?>
|
||||
<td class='text-left' style='overflow:visible'><?php echo html::select("projects[$executionID]", $allProjects, $executions[$executionID]->project, "class='form-control chosen'");?></td>
|
||||
<?php endif;?>
|
||||
<td title='<?php echo $executions[$executionID]->name?>'><?php echo html::input("names[$executionID]", $executions[$executionID]->name, "class='form-control'");?></td>
|
||||
<td><?php echo html::input("codes[$executionID]", $executions[$executionID]->code, "class='form-control'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'PM', ' hidden')?>' style='overflow:visible'><?php echo html::select("PMs[$executionID]", $pmUsers, $executions[$executionID]->PM, "class='form-control chosen'");?></td>
|
||||
|
||||
@@ -25,6 +25,12 @@
|
||||
</div>
|
||||
<form class='load-indicator main-form form-ajax' method='post' target='hiddenwin' id='dataform'>
|
||||
<table class='table table-form'>
|
||||
<?php if($config->systemMode == 'new'):?>
|
||||
<tr>
|
||||
<th class='w-120px'><?php echo $lang->execution->project;?></th>
|
||||
<td><?php echo html::select('project', $allProjects, $execution->project, "class='form-control chosen' required");?></td><td></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th class='w-120px'><?php echo $lang->execution->name;?></th>
|
||||
<td><?php echo html::input('name', $execution->name, "class='form-control' required");?></td><td></td>
|
||||
|
||||
@@ -558,14 +558,37 @@ class projectModel extends model
|
||||
*/
|
||||
public function getPairsByModel($model = 'all', $programID = 0)
|
||||
{
|
||||
return $this->dao->select('id, name')->from(TABLE_PROJECT)
|
||||
$projects = $this->dao->select('id, name, path')->from(TABLE_PROJECT)
|
||||
->where('type')->eq('project')
|
||||
->beginIF($programID)->andWhere('parent')->eq($programID)->fi()
|
||||
->beginIF($model != 'all')->andWhere('model')->eq($model)->fi()
|
||||
->andWhere('deleted')->eq('0')
|
||||
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects)->fi()
|
||||
->orderBy('id_desc')
|
||||
->fetchPairs();
|
||||
->fetchAll();
|
||||
|
||||
$programIdList = array();
|
||||
$projectProgram = array();
|
||||
foreach($projects as $project)
|
||||
{
|
||||
list($programID) = explode(',', trim($project->path, ','));
|
||||
$programIdList[$programID] = $programID;
|
||||
$projectProgram[$project->id] = $programID;
|
||||
}
|
||||
|
||||
$programs = $this->dao->select('id, name')->from(TABLE_PROGRAM)->where('id')->in($programIdList)->fetchPairs('id', 'name');
|
||||
$pairs = array();
|
||||
foreach($projects as $project)
|
||||
{
|
||||
$projectName = $project->name;
|
||||
|
||||
$programID = zget($projectProgram, $project->id, '');
|
||||
if($programID != $project->id) $projectName = zget($programs, $programID, '') . ' / ' . $projectName;
|
||||
|
||||
$pairs[$project->id] = $projectName;
|
||||
}
|
||||
|
||||
return $pairs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user