Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -181,7 +181,7 @@ class caselibModel extends model
|
||||
* @access public
|
||||
* @return int|false
|
||||
*/
|
||||
public function create(object $lib, $uid = ''): int|false
|
||||
public function create(object $lib, string $uid = ''): int|false
|
||||
{
|
||||
$this->lang->testsuite->name = $this->lang->caselib->name;
|
||||
$this->lang->testsuite->desc = $this->lang->caselib->desc;
|
||||
|
||||
@@ -18,6 +18,6 @@ $lib_noname = array('name' => '');
|
||||
$lib_normal = array('name' => 'lib name', 'desc' => 'lib desc');
|
||||
$lib_repeat = array('name' => 'lib_name');
|
||||
|
||||
r($caselib->createTest($lib_noname)) && p('name:0') && e('『名称』不能为空。'); //测试名称是空时候添加
|
||||
r($caselib->createTest($lib_normal)) && p('name') && e('lib name'); //测试添加的名称信息
|
||||
r($caselib->createTest($lib_repeat)) && p('name:0') && e('『名称』已经有『lib name』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。'); //测试名称是空时候添加
|
||||
r($caselib->createTest($lib_noname)) && p('name:0') && e('『名称』不能为空。'); // 测试名称是空时候添加
|
||||
r($caselib->createTest($lib_normal)) && p('name') && e('lib name'); // 测试添加的名称信息
|
||||
r($caselib->createTest($lib_repeat)) && p('name:0') && e('『名称』已经有『lib name』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。'); // 测试名称是空时候添加
|
||||
|
||||
@@ -133,7 +133,7 @@ js::set('flow', $config->global->flow);
|
||||
<th class='c-user'> <?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->openedByAB);?></th>
|
||||
<?php
|
||||
$extendFields = $this->caselib->getFlowExtendFields();
|
||||
foreach($extendFields as $extendField) {echo "<th>{$extendField->name}</th>"};
|
||||
foreach($extendFields as $extendField) echo "<th>{$extendField->name}</th>";
|
||||
?>
|
||||
<th class='c-actions-3 text-center'><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
@@ -157,7 +157,7 @@ js::set('flow', $config->global->flow);
|
||||
<td><?php echo $lang->testcase->typeList[$case->type];?></td>
|
||||
<td class='<?php if(isset($run)) echo $run->status;?> testcase-<?php echo $case->status?>'> <?php echo $this->processStatus('testcase', $case);?></td>
|
||||
<td title="<?php echo zget($users, $case->openedBy);?>"><?php echo zget($users, $case->openedBy);?></td>
|
||||
<?php foreach($extendFields as $extendField) {echo "<td>" . $this->loadModel('flow')->getFieldValue($extendField, $case) . "</td>";}?>
|
||||
<?php foreach($extendFields as $extendField) echo "<td>" . $this->loadModel('flow')->getFieldValue($extendField, $case) . "</td>";?>
|
||||
<td class='c-actions'>
|
||||
<?php echo $this->caselib->buildOperateMenu($case, 'browse');?>
|
||||
</td>
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
<span class='input-group-addon step-item-id'></span>
|
||||
<?php echo html::textarea('steps[]', $step->desc, "rows='1' class='form-control autosize step-steps'") ?>
|
||||
<span class='input-group-addon step-type-toggle'>
|
||||
<?php if(!isset($step->type)) and $step->type = 'step';?>
|
||||
<?php if(!isset($step->type)) $step->type = 'step';?>
|
||||
<input type='hidden' name='stepType[]' value='<?php echo $step->type;?>' class='step-type'>
|
||||
<div class='checkbox-primary'>
|
||||
<input tabindex='-1' type="checkbox" class='step-group-toggle'<?php if($step->type === 'group') echo ' checked' ?>>
|
||||
|
||||
@@ -9,7 +9,7 @@ class caselibZen extends caselib
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function setCreateMenu()
|
||||
protected function setCreateMenu(): void
|
||||
{
|
||||
$libraries = $this->caselib->getLibraries();
|
||||
$libID = $this->caselib->saveLibState(0, $libraries);
|
||||
@@ -23,7 +23,7 @@ class caselibZen extends caselib
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function buildCreateForm()
|
||||
protected function buildCreateForm(): void
|
||||
{
|
||||
$this->view->title = $this->lang->caselib->common . $this->lang->colon . $this->lang->caselib->create;
|
||||
$this->display();
|
||||
|
||||
@@ -4863,9 +4863,18 @@ class executionModel extends model
|
||||
$chartData['baseLine'] = $baselineJSON;
|
||||
|
||||
$execution = $this->getById($executionID);
|
||||
if((strpos('closed,suspended', $execution->status) === false and helper::today() > $execution->end)
|
||||
or ($execution->status == 'closed' and substr($execution->closedDate, 0, 10) > $execution->end)
|
||||
or ($execution->status == 'suspended' and $execution->suspendedDate > $execution->end))
|
||||
|
||||
/*
|
||||
* 1. Execution status is not closed and suspended, end date less than today;
|
||||
* 2. Execution status is closed, end date less than closed date;
|
||||
* 3. Execution status is suspended, end date less than suspended date;
|
||||
* Processing burn down chart Information.
|
||||
*/
|
||||
$endDate = helper::today();
|
||||
if($execution->status == 'closed') $endDate = substr($execution->closedDate, 0, 10);
|
||||
if($execution->status == 'suspended') $endDate = $execution->suspendedDate;
|
||||
|
||||
if($endDate > $execution->end)
|
||||
{
|
||||
$delaySets = $this->getBurnDataFlot($executionID, $burnBy, true, $dateList);
|
||||
$chartData['delayLine'] = $this->report->createSingleJSON($delaySets, $dateList);
|
||||
@@ -5599,6 +5608,9 @@ class executionModel extends model
|
||||
common::printIcon('execution', 'delete', "stageID=$execution->id&confirm=no", $execution, 'list', 'trash', 'hiddenwin' , $disabled, '', '', $this->lang->programplan->delete);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
echo $execution->$id;
|
||||
break;
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
+32
-49
@@ -174,41 +174,38 @@ class task extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑任务。
|
||||
* 编辑一个任务。
|
||||
* Edit a task.
|
||||
*
|
||||
* @param string $taskID
|
||||
* @param string $comment
|
||||
* @param string $from ''|taskkanban
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function edit(string $taskID, string $comment = '', string $from = '')
|
||||
public function edit(string $taskID, string $from = '')
|
||||
{
|
||||
$taskID = (int)$taskID;
|
||||
$this->commonAction($taskID);
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->loadModel('action');
|
||||
$changes = array();
|
||||
|
||||
$changes = array();
|
||||
$postDataFixer = form::data($this->config->task->form->edit);
|
||||
$rawData = $postDataFixer->rawdata;
|
||||
|
||||
/* Prepare and check data. */
|
||||
$task = $this->taskZen->prepareEdit($postDataFixer, $taskID);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
/* Update task. */
|
||||
if(empty($comment))
|
||||
{
|
||||
$task = $this->taskZen->prepareEdit($postDataFixer, $taskID);
|
||||
$changes = $this->task->update($task, $rawData);
|
||||
if(dao::isError()) return print(js::error(dao::getError()));
|
||||
}
|
||||
$changes = $this->task->update($task, $rawData);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
/* Record log. */
|
||||
if($rawData->comment != '' or !empty($changes))
|
||||
{
|
||||
$action = !empty($changes) ? 'Edited' : 'Commented';
|
||||
$actionID = $this->action->create('task', $taskID, $action, $rawData->comment);
|
||||
$actionID = $this->loadModel('action')->create('task', $taskID, $action, $rawData->comment);
|
||||
if(!empty($changes)) $this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
|
||||
@@ -216,8 +213,8 @@ class task extends control
|
||||
$this->executeHooks($taskID);
|
||||
if($task->status == 'doing') $this->loadModel('common')->syncPPEStatus($taskID);
|
||||
|
||||
$reponse = $this->taskZen->reponseAfterEdit($taskID, $from, $changes);
|
||||
return is_array($reponse) ? $this->send($reponse) : $reponse;
|
||||
$response = $this->taskZen->responseAfterEdit($taskID, $from, $changes);
|
||||
return $this->send($response);
|
||||
}
|
||||
|
||||
$this->taskZen->buildEditForm($taskID);
|
||||
@@ -384,12 +381,8 @@ class task extends control
|
||||
|
||||
/* Assign task. */
|
||||
$task = $this->taskZen->prepareAssignTo($postDataFixer, $taskID);
|
||||
$changes = $this->task->assign($task, $this->post->uid);
|
||||
if(dao::isError())
|
||||
{
|
||||
if($this->viewType == 'json' or (defined('RUN_MODE') && RUN_MODE == 'api')) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
return print(js::error(dao::getError()));
|
||||
}
|
||||
$changes = $this->task->assign($task);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
/* Record log. */
|
||||
$actionID = $this->loadModel('action')->create('task', $taskID, 'Assigned', $this->post->comment, $task->assignedTo);
|
||||
@@ -397,8 +390,8 @@ class task extends control
|
||||
|
||||
$this->executeHooks($taskID);
|
||||
|
||||
$reponse = $this->taskZen->reponseAfterAssignTo($taskID, $from);
|
||||
return is_array($reponse) ? $this->send($reponse) : $reponse;
|
||||
$response = $this->taskZen->responseAfterAssignTo($taskID, $from);
|
||||
return $this->send($response);
|
||||
}
|
||||
|
||||
$this->taskZen->buildAssignToForm($executionID, $taskID);
|
||||
@@ -432,37 +425,33 @@ class task extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量指派任务。
|
||||
* Batch update assign of task.
|
||||
*
|
||||
* @param int $execution
|
||||
* @param string $execution
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchAssignTo($execution)
|
||||
public function batchAssignTo(string $executionID)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->loadModel('action');
|
||||
$taskIDList = $this->post->taskIDList;
|
||||
$taskIDList = array_unique($taskIDList);
|
||||
unset($_POST['taskIDList']);
|
||||
if(!is_array($taskIDList)) return print(js::locate($this->createLink('execution', 'task', "executionID=$execution"), 'parent'));
|
||||
$taskIDList = array_unique($taskIDList);
|
||||
$executionID = (int)$executionID;
|
||||
if(!is_array($this->post->taskIDList)) return print(js::locate($this->createLink('execution', 'task', "executionID={$executionID}"), 'parent'));
|
||||
|
||||
$muletipleTasks = $this->dao->select('task, account')->from(TABLE_TASKTEAM)->where('task')->in($taskIDList)->fetchGroup('task', 'account');
|
||||
$tasks = $this->task->getByList($taskIDList);
|
||||
$this->loadModel('action');
|
||||
$tasks = $this->taskZen->prepareBatchAssignedTasks($this->post->taskIDList, $this->post->assignedTo);
|
||||
foreach($tasks as $taskID => $task)
|
||||
{
|
||||
if(isset($muletipleTasks[$taskID]) and $task->assignedTo != $this->app->user->account and $task->mode == 'linear') continue;
|
||||
if(isset($muletipleTasks[$taskID]) and !isset($muletipleTasks[$taskID][$this->post->assignedTo])) continue;
|
||||
if($task->status == 'closed') continue;
|
||||
|
||||
$changes = $this->task->assign($taskID);
|
||||
/* Assign task. */
|
||||
$changes = $this->task->assign($task);
|
||||
if(dao::isError()) return print(js::error(dao::getError()));
|
||||
|
||||
/* Record log. */
|
||||
$actionID = $this->action->create('task', $taskID, 'Assigned', $this->post->comment, $this->post->assignedTo);
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
|
||||
if(!dao::isError()) $this->loadModel('score')->create('ajax', 'batchOther');
|
||||
return print(js::reload('parent'));
|
||||
}
|
||||
@@ -1921,32 +1910,26 @@ class task extends control
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->loadModel('action');
|
||||
|
||||
/* Update assign of multi task. */
|
||||
$postData = form::data($this->config->task->form->manageTeam);
|
||||
$task = $this->taskZen->prepareManageTeam($postData, $taskID);
|
||||
$changes = $this->task->updateTeam($task, $this->post->team, $this->post->teamSouce, $this->post->teamEstimate, $this->post->teamConsumed, $this->post->teamLeft);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
if($this->viewType == 'json' or (defined('RUN_MODE') && RUN_MODE == 'api')) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
return print(js::error(dao::getError()));
|
||||
}
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
/* Record log. */
|
||||
$actionID = $this->action->create('task', $taskID, 'Edited');
|
||||
$actionID = $this->loadModel('action')->create('task', $taskID, 'Edited');
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
|
||||
$this->executeHooks($taskID);
|
||||
|
||||
$reponse = $this->taskZen->reponseAfterAssignTo($taskID, $from);
|
||||
return is_array($reponse) ? $this->send($reponse) : $reponse;
|
||||
$response = $this->taskZen->responseAfterAssignTo($taskID, $from);
|
||||
return $this->send($response);
|
||||
}
|
||||
|
||||
$this->view->members = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution', 'nodeleted');
|
||||
$this->view->users = $this->loadModel('user')->getPairs();
|
||||
$this->display('', 'editteam');
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -90,7 +90,7 @@ class taskModel extends model
|
||||
if(!empty($team))
|
||||
{
|
||||
/* Get members, old team and current task. */
|
||||
$members = array_map(function($member){return $member->account;}, $team);
|
||||
$members = array_column($team, 'account');
|
||||
$oldTeam = zget($oldTask, 'team', array());
|
||||
$currentTask = !empty($task) ? $task : new stdclass();
|
||||
if(!isset($currentTask->status)) $currentTask->status = $oldTask->status;
|
||||
@@ -474,7 +474,7 @@ class taskModel extends model
|
||||
{
|
||||
/* Get old team member, and delete old task team. */
|
||||
$oldTeams = $this->dao->select('*')->from(TABLE_TASKTEAM)->where('task')->eq($task->id)->fetchAll();
|
||||
$oldMembers = array_map(function($team){return $team->account;}, $oldTeams);
|
||||
$oldMembers = array_column($oldTeams, 'account');
|
||||
$this->dao->delete()->from(TABLE_TASKTEAM)->where('task')->eq($task->id)->exec();
|
||||
|
||||
/* If status of the task is doing, get the person who did not complete the task. */
|
||||
@@ -1157,19 +1157,20 @@ class taskModel extends model
|
||||
* @access public
|
||||
* @return array|false
|
||||
*/
|
||||
public function assign(object $task, string $uid): array|false
|
||||
public function assign(object $task): array|false
|
||||
{
|
||||
$oldTask = $this->getById($task->id);
|
||||
|
||||
/* Check task left. */
|
||||
if($oldTask->status != 'done' and $oldTask->status != 'closed' and isset($task->left) and $task->left == 0)
|
||||
{
|
||||
dao::$errors[] = sprintf($this->lang->error->notempty, $this->lang->task->left);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Update parent task status. */
|
||||
if($oldTask->parent > 0) $this->updateParentStatus($task->id);
|
||||
|
||||
$task = $this->loadModel('file')->processImgURL($task, $this->config->task->editor->assignto['id'], $uid);
|
||||
$this->dao->update(TABLE_TASK)
|
||||
->data($task)
|
||||
->autoCheck()
|
||||
@@ -1216,6 +1217,7 @@ class taskModel extends model
|
||||
}
|
||||
if(empty($teams)) $task->mode = '';
|
||||
|
||||
/* Update parent task status. */
|
||||
if($oldTask->parent > 0) $this->updateParentStatus($taskID);
|
||||
|
||||
$this->dao->update(TABLE_TASK)
|
||||
@@ -2311,7 +2313,7 @@ class taskModel extends model
|
||||
/* Check for add effort. */
|
||||
if(empty($effort))
|
||||
{
|
||||
$members = array_map(function($member){ return $member->account; }, $task->team);
|
||||
$members = array_column($task->team, 'account');
|
||||
if(!in_array($this->app->user->account, $members)) return false;
|
||||
if($task->mode == 'linear' and $this->app->user->account != $task->assignedTo) return false;
|
||||
return true;
|
||||
@@ -2707,6 +2709,7 @@ class taskModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取执行任务的报表数据。
|
||||
* Get report data of tasks per execution.
|
||||
*
|
||||
* @access public
|
||||
@@ -2719,6 +2722,7 @@ class taskModel extends model
|
||||
|
||||
$datas = $this->processData4Report($tasks, '', 'execution');
|
||||
|
||||
/* Get execution names for these tasks. */
|
||||
$executions = $this->loadModel('execution')->getPairs(0, 'all', 'all');
|
||||
foreach($datas as $executionID => $data) $data->name = isset($executions[$executionID]) ? $executions[$executionID] : $this->lang->report->undefined;
|
||||
return $datas;
|
||||
|
||||
+1
-1
@@ -451,7 +451,7 @@ class taskTao extends taskModel
|
||||
/* Format task team members. */
|
||||
if(!is_array($members)) $members = explode(',', trim($members, ','));
|
||||
$members = array_values($members);
|
||||
if(is_object($members[0])) $members = array_map(function($member){return $member->account;}, $members);
|
||||
if(is_object($members[0])) $members = array_column($members, 'account');
|
||||
|
||||
/* Get the member of the first unfinished task. */
|
||||
$teamHours = array_values($task->team);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/task.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +24,8 @@ cid=1
|
||||
- 第0条的old属性 @old2
|
||||
- 第0条的new属性 @user93
|
||||
|
||||
- doing状态任务指派,预计剩余为0 @『预计剩余』不能为空。
|
||||
|
||||
- done状态任务指派
|
||||
- 第0条的field属性 @assignedTo
|
||||
- 第0条的old属性 @old3
|
||||
@@ -40,49 +41,39 @@ cid=1
|
||||
- 第0条的old属性 @old5
|
||||
- 第0条的new属性 @user96
|
||||
|
||||
- closed状态任务指派
|
||||
- 第0条的field属性 @assignedTo
|
||||
- 第0条的old属性 @old6
|
||||
- 第0条的new属性 @user97
|
||||
|
||||
*/
|
||||
|
||||
function initData()
|
||||
{
|
||||
$task = zdTable('task');
|
||||
$task->id->range('1-6');
|
||||
$task->execution->range('2,3,3,4');
|
||||
$task->name->prefix("任务")->range('1-6');
|
||||
$task->left->range('0');
|
||||
$task->assignedTo->prefix("old")->range('1-6');
|
||||
$task->status->range("wait,doing,done,pause,cancel,closed");
|
||||
$task = zdTable('task');
|
||||
$task->id->range('1-6');
|
||||
$task->execution->range('2,3,3,4');
|
||||
$task->name->prefix("任务")->range('1-6');
|
||||
$task->left->range('0');
|
||||
$task->assignedTo->prefix("old")->range('1-6');
|
||||
$task->status->range("wait,doing,done,pause,cancel,closed");
|
||||
$task->gen(6);
|
||||
|
||||
$task->gen(6);
|
||||
$user = zdTable('user');
|
||||
$user->id->range('1-100');
|
||||
$user->account->range('1-100')->prefix('user');
|
||||
$user->password->range('f8e41d6c31824c01e5d67c61a8ae49e9,e10adc3949ba59abbe56e057f20f883e');
|
||||
$user->realname->range('1-100')->prefix("开发");
|
||||
$user->gen(50);
|
||||
|
||||
$user = zdTable('user');
|
||||
$user->id->range('1-100');
|
||||
$user->account->range('1-100')->prefix('user');
|
||||
$user->password->range('f8e41d6c31824c01e5d67c61a8ae49e9,e10adc3949ba59abbe56e057f20f883e');
|
||||
$user->realname->range('1-100')->prefix("开发");
|
||||
$user->gen(50);
|
||||
}
|
||||
|
||||
initData();
|
||||
$taskIDlist = array('1','2','3','4','5','6');
|
||||
|
||||
$waitTask = array('assignedTo' => 'user92','status' => 'wait');
|
||||
$waitTaskLeft = array('assignedTo' => 'user91','status' => 'wait', 'left' => '1');
|
||||
$doingTask = array('assignedTo' => 'user93','status' => 'doing');
|
||||
$doneTask = array('assignedTo' => 'user94','status' => 'done');
|
||||
$pauseTask = array('assignedTo' => 'user95','status' => 'pause');
|
||||
$cancelTask = array('assignedTo' => 'user96','status' => 'cancel');
|
||||
$closedTask = array('assignedTo' => 'user97','status' => 'closed');
|
||||
$waitTask = array('assignedTo' => 'user92','status' => 'wait');
|
||||
$waitTaskLeft = array('assignedTo' => 'user91','status' => 'wait', 'left' => 1);
|
||||
$doingTask = array('assignedTo' => 'user93','status' => 'doing');
|
||||
$doingTaskLeft = array('assignedTo' => 'user90','status' => 'doing', 'left' => 0);
|
||||
$doneTask = array('assignedTo' => 'user94','status' => 'done');
|
||||
$pauseTask = array('assignedTo' => 'user95','status' => 'pause');
|
||||
$cancelTask = array('assignedTo' => 'user96','status' => 'cancel');
|
||||
|
||||
$task = new taskTest();
|
||||
r($task->assignTest($taskIDlist[0],$waitTask)) && p('0:field,old,new') && e('assignedTo,old1,user92'); // wait状态任务指派
|
||||
r($task->assignTest($taskIDlist[0],$waitTaskLeft)) && p('1:field,old,new') && e('left,0,1'); // wait状态任务指派修改预计剩余
|
||||
r($task->assignTest($taskIDlist[0],$waitTaskLeft)) && p('1:field,old,new') && e('left,0,1'); // wait状态任务指派修改预计剩余
|
||||
r($task->assignTest($taskIDlist[1],$doingTask)) && p('0:field,old,new') && e('assignedTo,old2,user93'); // doing状态任务指派
|
||||
r($task->assignTest($taskIDlist[1],$doingTaskLeft)) && p() && e('『预计剩余』不能为空。'); // doing状态任务指派,预计剩余为0
|
||||
r($task->assignTest($taskIDlist[2],$doneTask)) && p('0:field,old,new') && e('assignedTo,old3,user94'); // done状态任务指派
|
||||
r($task->assignTest($taskIDlist[3],$pauseTask)) && p('0:field,old,new') && e('assignedTo,old4,user95'); // pause状态任务指派
|
||||
r($task->assignTest($taskIDlist[4],$cancelTask)) && p('0:field,old,new') && e('assignedTo,old5,user96'); // cancel状态任务指派
|
||||
r($task->assignTest($taskIDlist[5],$closedTask)) && p('0:field,old,new') && e('assignedTo,old6,user97'); // closed状态任务指派
|
||||
r($task->assignTest($taskIDlist[4],$cancelTask)) && p('0:field,old,new') && e('assignedTo,old5,user96'); // cancel状态任务指派
|
||||
@@ -2,7 +2,6 @@
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/task.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,20 +19,18 @@ cid=1
|
||||
- 第1条的old属性 @multi
|
||||
- 第1条的new属性 @~~
|
||||
|
||||
- 分配预计剩余为0工时团队后任务 @总计消耗"和"预计剩余"不能同时为0
|
||||
- 分配预计剩余为0工时团队后任务 @"总计消耗"和"预计剩余"不能同时为0
|
||||
|
||||
- 改变团队第二个成员后任务属性1 @user3
|
||||
|
||||
*/
|
||||
|
||||
function initData()
|
||||
{
|
||||
$task = zdTable('task');
|
||||
$task->mode->range('multi');
|
||||
$task->gen(6);
|
||||
$task = zdTable('task');
|
||||
$task->mode->range('multi');
|
||||
$task->gen(6);
|
||||
|
||||
$user = zdTable('user')->gen(50);
|
||||
}
|
||||
$user = zdTable('user')->gen(50);
|
||||
|
||||
initData();
|
||||
$taskIDList = array('1','2','3','4','5','6');
|
||||
$taskStatusList = array('doing','wait','done');
|
||||
$teamList = array('user1','user2','user3');
|
||||
@@ -42,3 +39,4 @@ $task = new taskTest();
|
||||
r($task->updateTeamTest($taskIDList[0], $taskStatusList[1], array($teamList[0], $teamList[1]), array($teamList[0], $teamList[1]), $teamEstimateList = array(1, 2.5), $teamConsumedList = array(0, 0), $teamLeftList = array(1, 0.5))) && p('1:field,old,new') && e('estimate,0,3.5'); //分配2个成员团队后任务
|
||||
r($task->updateTeamTest($taskIDList[1], $taskStatusList[1], array($teamList[0]), array($teamList[0]), $teamEstimateList = array(1), $teamConsumedList = array(0), $teamLeftList = array(1))) && p('1:field,old,new') && e('mode,multi,~~'); //分配1个成员团队后任务
|
||||
r($task->updateTeamTest($taskIDList[2], $taskStatusList[1], array($teamList[0], $teamList[1]), array($teamList[0], $teamList[1]), $teamEstimateList = array(1, 2.5), $teamConsumedList = array(0, 0), $teamLeftList = array(0, 0))) && p() && e('"总计消耗"和"预计剩余"不能同时为0'); //分配预计剩余为0工时团队后任务
|
||||
r($task->updateTeamTest($taskIDList[0], $taskStatusList[0], array($teamList[0], $teamList[2]), array($teamList[0], $teamList[1]), $teamEstimateList = array(1, 2.5), $teamConsumedList = array(0, 0), $teamLeftList = array(1, 0.5), true)) && p(1) && e('user3'); //改变团队第二个成员后任务
|
||||
@@ -316,7 +316,8 @@ class taskTest
|
||||
unset($_POST);
|
||||
if(dao::isError())
|
||||
{
|
||||
return dao::getError();
|
||||
$errors = dao::getError();
|
||||
return array_shift($errors);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -336,7 +337,7 @@ class taskTest
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function updateTeamTest($taskID, $status, $team, $teamSource, $teamEstimate, $teamConsumed, $teamLeft)
|
||||
public function updateTeamTest($taskID, $status, $team, $teamSource, $teamEstimate, $teamConsumed, $teamLeft, $getTeam = false)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
@@ -345,6 +346,8 @@ class taskTest
|
||||
$task->status = $status;
|
||||
$task->lastEditedBy = $tester->app->user->account;
|
||||
$object = $this->objectModel->updateTeam($task, $team, $teamSource, $teamEstimate, $teamConsumed, $teamLeft);
|
||||
|
||||
if($getTeam) return $this->objectModel->getTeamMembers($taskID);
|
||||
if(dao::isError())
|
||||
{
|
||||
$errors = dao::getError();
|
||||
|
||||
+79
-41
@@ -28,38 +28,24 @@ class taskZen extends task
|
||||
* @param form $postDataFixer
|
||||
* @param int $taskID
|
||||
* @access protected
|
||||
* @return object
|
||||
* @return object|false
|
||||
*/
|
||||
protected function prepareEdit(form $postDataFixer, int $taskID): object
|
||||
protected function prepareEdit(form $postDataFixer, int $taskID): object|false
|
||||
{
|
||||
$now = helper::now();
|
||||
$oldTask = $this->task->getByID($taskID);
|
||||
$postData = $postDataFixer->get();
|
||||
|
||||
if($postData->estimate < 0 || $postData->left < 0 || $postData->consumed < 0)
|
||||
{
|
||||
dao::$errors[] = $this->lang->task->error->recordMinus;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!empty($this->config->limitTaskDate))
|
||||
{
|
||||
$this->task->checkEstStartedAndDeadline($oldTask->execution, $postData->estStarted, $postData->deadline);
|
||||
return !dao::isError();
|
||||
}
|
||||
|
||||
if(!empty($postData->lastEditedDate) && $oldTask->lastEditedDate != $postData->lastEditedDate)
|
||||
{
|
||||
dao::$errors[] = $this->lang->error->editedByOther;
|
||||
return false;
|
||||
}
|
||||
/* Check that the data is reasonable. */
|
||||
if($postData->estimate < 0 or $postData->left < 0 or $postData->consumed < 0) dao::$errors[] = $this->lang->task->error->recordMinus;
|
||||
if(!empty($this->config->limitTaskDate)) $this->task->checkEstStartedAndDeadline($oldTask->execution, $postData->estStarted, $postData->deadline);
|
||||
if(!empty($postData->lastEditedDate) && $oldTask->lastEditedDate != $postData->lastEditedDate) dao::$errors[] = $this->lang->error->editedByOther;
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$task = $postDataFixer->add('id', $taskID)
|
||||
->setIF(!$postData->assignedTo && !empty($oldTask->team) && !empty($postDataFixer->rawdata->team), 'assignedTo', $this->task->getAssignedTo4Multi($postDataFixer->rawdata->team, $oldTask))
|
||||
->setIF(!$oldTask->mode && !$postData->assignedTo && !empty($postDataFixer->rawdata->team), 'assignedTo', $postDataFixer->rawdata->team[0])
|
||||
->setIF(is_numeric($postData->estimate), 'estimate', (float)$postData->estimate)
|
||||
->setIF(is_numeric($postData->consumed), 'consumed', (float)$postData->consumed)
|
||||
->setIF(is_numeric($postData->left), 'left', (float)$postData->left)
|
||||
|
||||
->setIF($oldTask->parent == 0 && $postData->parent == '', 'parent', 0)
|
||||
->setIF($postData->story != false && $postData->story != $oldTask->story, 'storyVersion', $this->loadModel('story')->getVersion($postData->story))
|
||||
|
||||
@@ -91,7 +77,7 @@ class taskZen extends task
|
||||
->join('mailto', ',')
|
||||
->get();
|
||||
|
||||
return $task;
|
||||
return $this->loadModel('file')->processImgURL($task, $this->config->task->editor->edit['id'], $postDataFixer->rawData->uid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,10 +88,16 @@ class taskZen extends task
|
||||
* @param string $from ''|taskkanban
|
||||
* @param array[] $changes
|
||||
* @access protected
|
||||
* @return array|int
|
||||
* @return array
|
||||
*/
|
||||
protected function reponseAfterEdit(int $taskID, string $from, array $changes): array|int
|
||||
protected function responseAfterEdit(int $taskID, string $from, array $changes): array
|
||||
{
|
||||
if(defined('RUN_MODE') && RUN_MODE == 'api') return array('status' => 'success', 'data' => $taskID);
|
||||
|
||||
$response['result'] = 'success';
|
||||
$response['message'] = $this->lang->saveSuccess;
|
||||
$response['closeModal'] = true;
|
||||
|
||||
$task = $this->task->getById($taskID);
|
||||
if($task->fromBug != 0)
|
||||
{
|
||||
@@ -113,17 +105,16 @@ class taskZen extends task
|
||||
{
|
||||
if($change['field'] == 'status')
|
||||
{
|
||||
$confirmURL = $this->createLink('bug', 'view', "id={$task->fromBug}");
|
||||
$cancelURL = $this->server->HTTP_REFERER;
|
||||
return print(js::confirm(sprintf($this->lang->task->remindBug, $task->fromBug), $confirmURL, $cancelURL, 'parent', 'parent'));
|
||||
$response['callback'] = "parent.confirmBug('" . sprintf($this->lang->task->remindBug, $task->fromBug) . "', {$task->fromBug})";
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isonlybody()) return $this->reponseKanban($task, $from);
|
||||
if(isonlybody()) return $this->responseKanban($task, $from);
|
||||
|
||||
if(defined('RUN_MODE') && RUN_MODE == 'api') return array('status' => 'success', 'data' => $taskID);
|
||||
return print(js::locate($this->createLink('task', 'view', "{taskID=$taskID}"), 'parent'));
|
||||
$response['locate'] = $this->createLink('task', 'view', "taskID=$taskID");
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,6 +128,8 @@ class taskZen extends task
|
||||
protected function buildEditForm(int $taskID): void
|
||||
{
|
||||
$task = $this->view->task;
|
||||
|
||||
/* Get the task parent id,name pairs. */
|
||||
$tasks = $this->task->getParentTaskPairs($this->view->execution->id, $task->parent);
|
||||
if(isset($tasks[$taskID])) unset($tasks[$taskID]);
|
||||
|
||||
@@ -187,7 +180,6 @@ class taskZen extends task
|
||||
*/
|
||||
protected function prepareManageTeam(form $postData, int $taskID): object
|
||||
{
|
||||
$now = helper::now();
|
||||
$task = $postData->add('id', $taskID)
|
||||
->add('lastEditedBy', $this->app->user->account)
|
||||
->get();
|
||||
@@ -219,16 +211,16 @@ class taskZen extends task
|
||||
* @param int $taskID
|
||||
* @param string $from ''|taskkanban
|
||||
* @access protected
|
||||
* @return array|int
|
||||
* @return array
|
||||
*/
|
||||
protected function reponseAfterAssignTo(int $taskID, string $from): array|int
|
||||
protected function responseAfterAssignTo(int $taskID, string $from): array
|
||||
{
|
||||
if($this->viewType == 'json' || (defined('RUN_MODE') && RUN_MODE == 'api')) return array('result' => 'success');
|
||||
|
||||
$task = $this->task->getById($taskID);
|
||||
if(isonlybody()) return $this->reponseKanban($task, $from);
|
||||
if(isonlybody()) return $this->responseKanban($task, $from);
|
||||
|
||||
return print(js::locate($this->createLink('task', 'view', "{taskID=$taskID}"), 'parent'));
|
||||
return array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'locate' => $this->createLink('task', 'view', "taskID=$taskID"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -271,10 +263,14 @@ class taskZen extends task
|
||||
* @param object $task
|
||||
* @param string $from ''|taskkanban
|
||||
* @access protected
|
||||
* @return int
|
||||
* @return array
|
||||
*/
|
||||
protected function reponseKanban(object $task, string $from): int
|
||||
protected function responseKanban(object $task, string $from): array
|
||||
{
|
||||
$response['result'] = 'success';
|
||||
$response['message'] = $this->lang->saveSuccess;
|
||||
$response['closeModal'] = true;
|
||||
|
||||
$execution = $this->execution->getByID($task->execution);
|
||||
$execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all';
|
||||
$execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default';
|
||||
@@ -286,7 +282,8 @@ class taskZen extends task
|
||||
$kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', 0, $execGroupBy, $rdSearchValue);
|
||||
$kanbanData = json_encode($kanbanData);
|
||||
|
||||
return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban({$kanbanData})"));
|
||||
$response['callback'] = "parent.parent.updateKanban($kanbanData)";
|
||||
return $response;
|
||||
}
|
||||
if($from == 'taskkanban')
|
||||
{
|
||||
@@ -296,9 +293,50 @@ class taskZen extends task
|
||||
$kanbanData = $kanbanData[$kanbanType];
|
||||
$kanbanData = json_encode($kanbanData);
|
||||
|
||||
return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", {$kanbanData})"));
|
||||
$response['callback'] = "parent.parent.updateKanban(\"task\", $kanbanData)";
|
||||
return $response;
|
||||
}
|
||||
return print(js::closeModal('parent.parent', 'this'));
|
||||
$response['locate'] = 'parent';
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 准备批量指派的任务数据。
|
||||
* Prepare batch assigned tasks.
|
||||
*
|
||||
* @param string[] $taskIdList
|
||||
* @param string $assignedTo
|
||||
* @access protected
|
||||
* @return object[]
|
||||
*/
|
||||
protected function prepareBatchAssignedTasks(array $taskIdList, string $assignedTo): array
|
||||
{
|
||||
$taskIdList = array_unique($taskIdList);
|
||||
$muletipleTasks = $this->dao->select('task, account')->from(TABLE_TASKTEAM)->where('task')->in($taskIdList)->fetchGroup('task', 'account');
|
||||
$tasks = $this->task->getByList($taskIdList);
|
||||
/* Filter tasks. */
|
||||
foreach($tasks as $taskID => $task)
|
||||
{
|
||||
if(isset($muletipleTasks[$taskID]) && $task->assignedTo != $this->app->user->account && $task->mode == 'linear') unset($tasks[$taskID]);
|
||||
if(isset($muletipleTasks[$taskID]) && !isset($muletipleTasks[$taskID][$this->post->assignedTo])) unset($tasks[$taskID]);
|
||||
if($task->status == 'closed') unset($tasks[$taskID]);
|
||||
}
|
||||
|
||||
/* Prepare data. */
|
||||
$now = helper::now();
|
||||
$preTasks = array();
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
$preTask = new stdclass();
|
||||
$preTask->id = $task->id;
|
||||
$preTask->lastEditedBy = $this->app->user->account;
|
||||
$preTask->lastEditedDate = $now;
|
||||
$preTask->assignedDate = $now;
|
||||
$preTask->assignedTo = $assignedTo;
|
||||
|
||||
$preTasks[] = clone $preTask;
|
||||
}
|
||||
return $preTasks;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -395,7 +395,7 @@ function getValues($value, $keys, $delimiter)
|
||||
}
|
||||
$keys = explode($delimiter, $keys);
|
||||
|
||||
if($object)
|
||||
if($object !== '')
|
||||
{
|
||||
if(is_array($value))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user