This commit is contained in:
chenfei
2020-07-22 16:28:41 +08:00
7 changed files with 43 additions and 22 deletions
+11 -4
View File
@@ -1114,7 +1114,7 @@ class storyModel extends model
/* Update parent story status. */
if($oldStory->parent > 0) $this->updateParentStatus($storyID, $oldStory->parent);
$this->setStage($storyID);
if(!dao::isError()) $this->loadModel('score')->create('story', 'close', $storyID);
return common::createChanges($oldStory, $story);
}
@@ -1183,7 +1183,7 @@ class storyModel extends model
{
/* Update parent story status. */
if($oldStory->parent > 0) $this->updateParentStatus($storyID, $oldStory->parent);
$this->setStage($storyID);
$allChanges[$storyID] = common::createChanges($oldStory, $story);
}
else
@@ -1437,9 +1437,7 @@ class storyModel extends model
$this->dao->delete()->from(TABLE_STORYSTAGE)->where('story')->eq($storyID)->exec();
$story = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch();
if(!empty($story->stagedBy)) return false;
if($story->status == 'closed') $this->dao->update(TABLE_STORY)->set('stage')->eq('closed')->where('id')->eq($storyID)->exec();
$product = $this->dao->findById($story->product)->from(TABLE_PRODUCT)->fetch();
$projects = $this->dao->select('t1.project,t3.branch')->from(TABLE_PROJECTSTORY)->alias('t1')
@@ -1457,6 +1455,15 @@ class storyModel extends model
foreach($plans as $branch) $stages[$branch] = 'planned';
}
/* When the status is closed, phase = is also changed to closed. */
if($story->status == 'closed')
{
$this->dao->update(TABLE_STORY)->set('stage')->eq('closed')->where('id')->eq($storyID)->exec();
foreach($stages as $branch => $stage) $this->dao->replace(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq('closed')->exec();
foreach($projects as $project => $branch) $this->dao->replace(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq('closed')->exec();
return false;
}
/* If no projects, in plan, stage is planned. No plan, wait. */
if(!$projects)
{
+3
View File
@@ -149,6 +149,7 @@ class todo extends control
$todo = $this->todo->getById($todoID);
if($todo->private and $this->app->user->account != $todo->account) die('private');
unset($this->lang->todo->typeList['cycle']);
$todo->date = date("Y-m-d", strtotime($todo->date));
$this->view->title = $this->lang->todo->common . $this->lang->colon . $this->lang->todo->edit;
$this->view->position[] = $this->lang->todo->common;
@@ -206,6 +207,8 @@ class todo extends control
$countInputVars = count($editedTodos) * $columns;
$showSuhosinInfo = common::judgeSuhosinSetting($countInputVars);
unset($this->lang->todo->typeList['cycle']);
/* Set Custom*/
foreach(explode(',', $this->config->todo->list->customBatchEditFields) as $field) $customFields[$field] = $this->lang->todo->$field;
$this->view->customFields = $customFields;
+4
View File
@@ -0,0 +1,4 @@
$(function()
{
loadList($('#type').val());
});
+15 -5
View File
@@ -171,13 +171,17 @@ class todoModel extends model
$todo = fixer::input('post')
->cleanInt('pri, begin, end, private')
->add('account', $oldTodo->account)
->setIF(in_array($oldTodo->type, array('bug', 'task', 'story')), 'name', '')
->setIF(in_array($this->post->type, array('bug', 'task', 'story')), 'name', '')
->setIF($this->post->type == 'bug' and $this->post->bug, 'idvalue', $this->post->bug)
->setIF($this->post->type == 'task' and $this->post->task, 'idvalue', $this->post->task)
->setIF($this->post->type == 'story' and $this->post->story, 'idvalue', $this->post->story)
->setIF($this->post->type == 'feedback' and $this->post->feedback, 'idvalue', $this->post->feedback)
->setIF($this->post->date == false, 'date', '2030-01-01')
->setIF($this->post->begin == false, 'begin', '2400')
->setIF($this->post->end == false, 'end', '2400')
->setDefault('private', 0)
->stripTags($this->config->todo->editor->edit['id'], $this->config->allowedTags)
->remove('uid')
->remove('bug, task, story, feedback, uid')
->get();
if($todo->end < $todo->begin)
@@ -214,6 +218,10 @@ class todoModel extends model
$this->dao->update(TABLE_TODO)->data($todo)
->autoCheck()
->checkIF($todo->type == 'custom', $this->config->todo->edit->requiredFields, 'notempty')
->checkIF($todo->type == 'bug' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'task' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'story' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'feedback' and $todo->idvalue == 0, 'idvalue', 'notempty')
->where('id')->eq($todoID)
->exec();
if(!dao::isError())
@@ -263,12 +271,14 @@ class todoModel extends model
foreach($todos as $todoID => $todo)
{
$oldTodo = $oldTodos[$todoID];
if($oldTodo->type == 'bug' or $oldTodo->type == 'task') $oldTodo->name = '';
if($oldTodo->type == 'bug' or $oldTodo->type == 'task' or $oldTodo->type == 'story' or $oldTodo->type == 'feedback') $oldTodo->name = '';
$this->dao->update(TABLE_TODO)->data($todo)
->autoCheck()
->checkIF($todo->type == 'custom', $this->config->todo->edit->requiredFields, 'notempty')
->checkIF($todo->type == 'bug', 'idvalue', 'notempty')
->checkIF($todo->type == 'task', 'idvalue', 'notempty')
->checkIF($todo->type == 'bug' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'task' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'story' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'feedback' and $todo->idvalue == 0, 'idvalue', 'notempty')
->where('id')->eq($todoID)
->exec();
+3 -4
View File
@@ -36,7 +36,7 @@
<tr class='text-center'>
<th class='w-40px'> <?php echo $lang->idAB;?></th>
<th class='w-100px'> <?php echo $lang->todo->date;?></th>
<th class='w-80px'> <?php echo $lang->todo->type;?></th>
<th class='w-110px'> <?php echo $lang->todo->type;?></th>
<th class='w-100px<?php echo zget($visibleFields, 'pri', ' hidden')?>'> <?php echo $lang->todo->pri;?></th>
<th><?php echo $lang->todo->name;?></th>
<th <?php echo zget($visibleFields, 'desc', "class='hidden'")?>><?php echo $lang->todo->desc;?></th>
@@ -50,12 +50,11 @@
<td><?php echo $todo->id . html::hidden("todoIDList[$todo->id]", $todo->id);?></td>
<td><?php echo html::input("dates[$todo->id]", $todo->date, "class='form-control form-date'");?></td>
<td class='text-center'>
<?php echo zget($lang->todo->typeList, $todo->type);?>
<?php echo html::hidden("types[$todo->id]", $todo->type);?>
<?php echo html::select("types[$todo->id]", $lang->todo->typeList, $todo->type, "onchange='loadList(this.value, " . $todo->id . ")' class='form-control'");?>
</td>
<td style='overflow:visible' <?php echo zget($visibleFields, 'pri', "class='hidden'")?>><?php echo html::select("pris[$todo->id]", $lang->todo->priList, $todo->pri, "class='form-control chosen'");?></td>
<td style='overflow:visible'>
<div id='<?php echo "nameBox" . $todo->id;?>' class='hidden'><? echo html::input("names[$todo->id]", '', "class='text-left form-control hiddenwin'"); ?></div>
<div id='<?php echo "nameBox" . $todo->id;?>' class='hidden'><?php echo html::input("names[$todo->id]", $todo->name, "class='text-left form-control hiddenwin'"); ?></div>
<div class='<?php echo "nameBox" . $todo->id;?> text-left'>
<?php
if($todo->type == 'custom' or $todo->type == 'cycle')
+4 -9
View File
@@ -85,9 +85,8 @@
<?php endif;?>
<div class="row form-group">
<label class="col-sm-1"><?php echo $lang->todo->type;?></label>
<div class="col-sm-10 todoType">
<input type='hidden' name='type' value='<?php echo $todo->type;?>' />
<?php echo $lang->todo->typeList[$todo->type];?>
<div class="col-sm-2">
<?php echo html::select('type', $lang->todo->typeList, $todo->type, 'onchange="loadList(this.value);" class="form-control"');?>
</div>
</div>
<div class="row form-group">
@@ -99,12 +98,8 @@
<div class="row form-group">
<label class="col-sm-1"><?php echo $lang->todo->name;?></label>
<div class="col-sm-10">
<div id='nameBox' class='required'>
<?php
$readType = ($todo->type == 'bug' or $todo->type == 'task') ? 'readonly' : '';
echo html::input('name', $todo->name, "$readType class='form-control'");
?>
</div>
<div id='nameBox' class='hidden'><?php echo html::input('name', $todo->name, "class='form-control'");?></div>
<div class='nameBox required'><?php echo html::input('name', $todo->name, "class='form-control'");?></div>
</div>
</div>
<div class="row form-group">