* Fix the priority issue of creating todo.

This commit is contained in:
tianshujie98
2021-06-01 09:38:58 +08:00
parent 5d2a13673c
commit add67a9039
2 changed files with 46 additions and 1 deletions
+1 -1
View File
@@ -98,7 +98,7 @@
<td class="c-date"><?php echo $todo->date == '2030-01-01' ? $lang->todo->periods['future'] : $todo->date;?></td>
<td class="c-type"><?php echo zget($lang->todo->typeList, $todo->type, '');?></td>
<td class="c-pri"><span title="<?php echo zget($lang->todo->priList, $todo->pri);?>" class='label-pri <?php echo 'label-pri-' . $todo->pri;?>' title='<?php echo zget($lang->todo->priList, $todo->pri, $todo->pri);?>'><?php echo zget($lang->todo->priList, $todo->pri)?></span></td>
<td class="c-name" title="<?php echo $todo->name;?>"><?php echo html::a($this->createLink('todo', 'view', "id=$todo->id&from=my", '', true), $todo->name, '', "data-toggle='modal' data-width='75%' data-type='iframe' data-title='" . $lang->todo->view . "' data-icon='check'");?></td>
<td class="c-name" title="<?php echo $todo->name;?>"><?php echo html::a($this->createLink('todo', 'view', "id=$todo->id&from=my", '', true), $todo->name, '', "data-toggle='modal' data-width='80%' data-type='iframe' data-title='" . $lang->todo->view . "' data-icon='check'");?></td>
<td><?php echo zget($users, $todo->assignedBy);?></td>
<td class="c-begin"><?php echo $todo->begin;?></td>
<td class="c-end"><?php echo $todo->end;?></td>
+45
View File
@@ -26,6 +26,7 @@ class todoModel extends model
$idvalue = 0;
if($hasObject && $objectType) $idvalue = $this->post->uid ? $this->post->$objectType : $this->post->idvalue;
$todo = fixer::input('post')
->add('account', $this->app->user->account)
->setDefault('idvalue', 0)
@@ -38,6 +39,50 @@ class todoModel extends model
->remove(implode(',', $this->config->todo->moduleList) . ',uid')
->get();
if(!isset($todo->pri))
{
if($this->post->type == 'task')
{
$todo->pri = $this->dao->select('pri')->from(TABLE_TASK)->where('id')->eq($this->post->idvalue)->fetch('pri');
}
elseif($this->post->type == 'bug')
{
$todo->pri = $this->dao->select('pri')->from(TABLE_BUG)->where('id')->eq($this->post->idvalue)->fetch('pri');
}
elseif($this->post->type == 'story')
{
$todo->pri = $this->dao->select('pri')->from(TABLE_STORY)->where('id')->eq($this->post->idvalue)->fetch('pri');
}
elseif($this->post->type == 'testtask')
{
$todo->pri = $this->dao->select('pri')->from(TABLE_TESTTASK)->where('id')->eq($this->post->idvalue)->fetch('pri');
}
elseif($this->post->type == 'issue' and isset($this->config->maxVersion))
{
$todo->pri = $this->dao->select('pri')->from(TABLE_ISSUE)->where('id')->eq($this->post->idvalue)->fetch('pri');
}
elseif($this->post->type == 'risk' and isset($this->config->maxVersion))
{
$todo->pri = $this->dao->select('pri')->from(TABLE_RISK)->where('id')->eq($this->post->idvalue)->fetch('pri');
}
elseif($this->post->type == 'review' and isset($this->config->maxVersion))
{
$todo->pri = $this->dao->select('pri')->from(TABLE_REVIEW)->where('id')->eq($this->post->idvalue)->fetch('pri');
}
elseif($this->post->type == 'feedback' and isset($this->config->maxVersion))
{
$todo->pri = $this->dao->select('pri')->from(TABLE_FEEDBACK)->where('id')->eq($this->post->idvalue)->fetch('pri');
}
elseif($this->post->type == 'opportunity' and isset($this->config->maxVersion))
{
$todo->pri = $this->dao->select('pri')->from(TABLE_OPPORTUNITY)->where('id')->eq($this->post->idvalue)->fetch('pri');
}
if($todo->pri == 'high') $todo->pri = 1;
if($todo->pri == 'middle') $todo->pri = 2;
if($todo->pri == 'low') $todo->pri = 3;
}
if($todo->type != 'custom')
{
$type = $todo->type;