* code for task #65286.

This commit is contained in:
wangyidong
2022-08-23 17:26:04 +08:00
parent 05d5d0054d
commit fcc537bacc
8 changed files with 33 additions and 15 deletions
+1 -2
View File
@@ -1191,11 +1191,10 @@ class task extends control
return print(js::locate($url, 'parent'));
}
$estimate = $this->task->getEstimateById($estimateID);
$this->view->title = $this->lang->task->editEstimate;
$this->view->position[] = $this->lang->task->editEstimate;
$this->view->estimate = $estimate;
$this->view->task = $this->task->getById($estimate->task);
$this->display();
}
+2
View File
@@ -232,6 +232,8 @@ $lang->task->noticeLinkStory = "Es wurde keine Story verknüpft. Sie k
$lang->task->noticeSaveRecord = 'Ihre Stunden wurden nicht gespeichrt. Bitte erst speichern.';
$lang->task->commentActions = '%s. %s, kommentiert von <strong>%s</strong>.';
$lang->task->deniedNotice = 'Nur %s kann die Aufgabe %s.';
$lang->task->deniedStatusNotice = 'The task status is %s, the effort cannot be maintained.';
$lang->task->transferNotice = 'Linear task cannot be transferred.';
$lang->task->noTask = 'Keine Aufagben. ';
$lang->task->createDenied = 'Aufgben erstellen it in diesem Projekt gesperrt';
$lang->task->cannotDeleteParent = 'Cannot delete parent task';
+2
View File
@@ -232,6 +232,8 @@ $lang->task->noticeLinkStory = "No story has been linked. You can %s f
$lang->task->noticeSaveRecord = 'Your Hour is not saved. Please save it first.';
$lang->task->commentActions = '%s. %s, commented by <strong>%s</strong>.';
$lang->task->deniedNotice = 'Only the %s can %s the task.';
$lang->task->deniedStatusNotice = 'The task status is %s, the effort cannot be maintained.';
$lang->task->transferNotice = 'Linear task cannot be transferred.';
$lang->task->noTask = 'No tasks yet. ';
$lang->task->createDenied = 'Create Task is denied in this project';
$lang->task->cannotDeleteParent = 'Cannot delete parent task';
+3 -1
View File
@@ -232,6 +232,8 @@ $lang->task->noticeLinkStory = "Aucune Story n'est associée. Vous pou
$lang->task->noticeSaveRecord = "Votre temps n'a pas été sauvé. Enregistrez-le d'abord.";
$lang->task->commentActions = '%s. %s, commenté par <strong>%s</strong>.';
$lang->task->deniedNotice = 'Seulement le %s peut %s la tâche.';
$lang->task->deniedStatusNotice = 'The task status is %s, the effort cannot be maintained.';
$lang->task->transferNotice = 'Linear task cannot be transferred.';
$lang->task->noTask = "Pas de tâche pour l'instant. ";
$lang->task->createDenied = 'La création de tâches est interdite dans ce projet';
$lang->task->cannotDeleteParent = 'Impossible de supprimer la tâche parente';
@@ -354,4 +356,4 @@ $lang->taskestimate = new stdclass();
$lang->taskestimate->consumed = 'Estimés';
$lang->task->overEsStartDate = 'The %s schedule start time has exceeded, please modify the %s schedule start time first';
$lang->task->overEsEndDate = 'The %s schedule end time has exceeded, please modify the %s schedule end time first';
$lang->task->overEsEndDate = 'The %s schedule end time has exceeded, please modify the %s schedule end time first';
+1
View File
@@ -232,6 +232,7 @@ $lang->task->noticeLinkStory = "没有可关联的相关{$lang->SRComm
$lang->task->noticeSaveRecord = '您有尚未保存的工时记录,请先将其保存。';
$lang->task->commentActions = '%s. %s, 由 <strong>%s</strong> 添加备注。';
$lang->task->deniedNotice = '当前任务只有%s才可以%s。';
$lang->task->deniedStatusNotice = '当前任务状态是%s,不能维护日志。';
$lang->task->transferNotice = '串行多人任务不能转交。';
$lang->task->noTask = '暂时没有任务。';
$lang->task->createDenied = '你不能在该项目添加任务';
+17 -9
View File
@@ -2740,11 +2740,8 @@ class taskModel extends model
->fetch();
/* If the estimate is the last of its task, status of task will be checked. */
$lastID = $this->dao->select('id')->from(TABLE_TASKESTIMATE)
->where('task')->eq($estimate->task)
->andWhere('id')->gt($estimate->id)
->fetch('id');
$estimate->isLast = $lastID ? false : true;
$lastID = $this->dao->select('id')->from(TABLE_TASKESTIMATE)->where('task')->eq($estimate->task)->orderBy('date,id')->limit(1)->fetch('id');
$estimate->isLast = $lastID == $estimate->id;
return $estimate;
}
@@ -2756,14 +2753,25 @@ class taskModel extends model
* @access public
* @return bool
*/
public function canOperateEffort($task, $effort)
public function canOperateEffort($task, $effort = null)
{
if(empty($task->team)) return true;
/* Check for add effort. */
if(empty($effort))
{
if($task->mode == 'linear' and strpos('|done|done|closed|cancel|pause|', "|{$task->status}|") !== false) return false;
$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;
}
/* Check for edit and delete effort. */
if($task->mode == 'linear')
{
if(strpos('|closed|cancel|pause|', "|{$task->status}|") !== false) return false;
if($task->status == 'doing') return $task->assignedTo == $effort->account;
if($task->status == 'doing') return ($task->assignedTo == $effort->account and $task->assignedTo == $this->app->user->account);
}
if($this->app->user->account == $effort->account) return true;
return false;
@@ -2811,7 +2819,7 @@ class taskModel extends model
if(!empty($task->team))
{
$currentTeam = $this->getTeamByAccount($task->team, $oldEstimate->account, array('filter' => '', 'effortID' => $estimateID));
$currentTeam = $this->getTeamByAccount($task->team, $oldEstimate->account, array('effortID' => $estimateID));
if($currentTeam)
{
$newTeamInfo = new stdClass();
@@ -2855,7 +2863,6 @@ class taskModel extends model
{
$estimate = $this->getEstimateById($estimateID);
$task = $this->getById($estimate->task);
$this->dao->delete()->from(TABLE_TASKESTIMATE)->where('id')->eq($estimateID)->exec();
$lastEstimate = $this->dao->select('*')->from(TABLE_TASKESTIMATE)->where('task')->eq($estimate->task)->orderBy('date desc,id desc')->limit(1)->fetch();
$consumed = $task->consumed - $estimate->consumed;
@@ -2893,6 +2900,7 @@ class taskModel extends model
}
}
$this->dao->delete()->from(TABLE_TASKESTIMATE)->where('id')->eq($estimateID)->exec();
$this->dao->update(TABLE_TASK)->data($data) ->where('id')->eq($estimate->task)->exec();
if($task->parent > 0) $this->updateParentStatus($task->id);
if($task->story) $this->loadModel('story')->setStage($task->story);
+3 -1
View File
@@ -32,7 +32,9 @@
</tr>
<tr>
<th><?php echo $lang->task->left;?></th>
<td><?php echo html::input('left', $estimate->left, 'class="form-control"');?></td>
<?php $readonly = $estimate->isLast ? '' : 'readonly';?>
<?php if(!empty($task->team) and $estimate->left == 0) $readonly = 'readonly';?>
<td><?php echo html::input('left', $estimate->left, "class='form-control' {$readonly}");?></td>
</tr>
<tr>
<th><?php echo $lang->comment;?></th>
+4 -2
View File
@@ -67,14 +67,16 @@
</tr>
<?php endforeach;?>
<?php endif;?>
<?php if(!empty($members) and (!isset($members[$app->user->account]) or ($task->assignedTo != $app->user->account and $task->mode == 'linear'))):?>
<?php if(!$this->task->canOperateEffort($task)):?>
</tbody>
</table>
</form>
<div class="alert with-icon">
<i class="icon-exclamation-sign"></i>
<div class="content">
<?php if($task->assignedTo != $app->user->account and $task->mode == 'linear'):?>
<?php if(strpos('|done|closed|cancel|pause|', $task->status) !== false):?>
<p><?php echo sprintf($lang->task->deniedStatusNotice, '<strong>' . zget($this->lang->task->statusList, $task->status) . '</strong>');?></p>
<?php elseif($task->assignedTo != $app->user->account and $task->mode == 'linear'):?>
<p><?php echo sprintf($lang->task->deniedNotice, '<strong>' . $task->assignedToRealName . '</strong>', $lang->task->logEfforts);?></p>
<?php else:?>
<p><?php echo sprintf($lang->task->deniedNotice, '<strong>' . $lang->task->teamMember . '</strong>', $lang->task->logEfforts);?></p>