* Finish task #8397.

This commit is contained in:
tianshujie98
2020-11-18 10:33:34 +08:00
parent 726bbc775b
commit 48e4e31a30
11 changed files with 54 additions and 30 deletions
-7
View File
@@ -94,13 +94,6 @@ class buildModel extends model
}
}
$allProduct = "`product` = 'all'";
$buildQuery = $this->session->projectBuildQuery;
if(strpos($this->session->projectBuildQuery, $allProduct) !== false)
{
$buildQuery = str_replace($allProduct, '1', $this->session->projectBuildQuery);
}
/* Distinguish between repeated fields. */
$fields = array('id' => '`id`', 'name' => '`name`', 'product' => '`product`', 'desc' => '`desc`');
foreach($fields as $field)
+1 -1
View File
@@ -47,7 +47,7 @@
<form method='post' target='hiddenwin'>
<table class='table table-form mw-400px' style='margin: 0 auto'>
<tr>
<th class="<?php echo strpos('|zh-cn|zh-tw|', '|' . $this->app->getClientLang() . '|') === false ? 'w-150px' : 'w-80px';?>"><?php echo $lang->install->company;?></th>
<th class="<?php echo strpos($this->app->getClientLang(), 'zh') === false ? 'w-150px' : 'w-80px';?>"><?php echo $lang->install->company;?></th>
<td class='w-300px'><?php echo html::input('company', '', "class='form-control'");?></td>
</tr>
<tr>
+1 -1
View File
@@ -4,4 +4,4 @@ tbody > tr > td > .btn-icon {margin-right: 4px}
@media (max-width: 1200px) {#storyList .c-user, #storyList .c-estimate {display: none!important;}}
@media (max-width: 1000px) {#storyList .c-status, #storyList .c-pri {display: none!important;}}
@media (max-width: 820px) {#storyList .c-sort, #storyList .c-stage {display: none!important;}}
#batchToTask table tbody tr th{width: 110px;}
#batchToTask .checkbox-primary {display: inline-block; margin-left: 10px;}
+11 -8
View File
@@ -247,7 +247,7 @@
<ul class='dropdown-menu'>
<?php
$class = $canBatchToTask ? '' : "class='hidden'";
echo "<li $class>" . html::a('#batchToTask', $lang->story->toTask, '', "data-toggle='modal' id='batchToTaskButton'") . "</li>";
echo "<li $class>" . html::a('#batchToTask', $lang->story->batchToTask, '', "data-toggle='modal' id='batchToTaskButton'") . "</li>";
?>
</ul>
</div>
@@ -313,28 +313,31 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon icon-close"></i></button>
<h4 class="modal-title"><?php echo $lang->story->batchToTask;?></h4><?php echo '(' . $lang->story->batchToTaskTips . ')';?>
<h4 class="modal-title"><?php echo $lang->story->batchToTask;?></h4>
</div>
<div class="modal-body">
<form method='post' action='<?php echo $this->createLink('story', 'batchToTask', "projectID=$project->id");?>'>
<form method='post' class='form-ajax' action='<?php echo $this->createLink('story', 'batchToTask', "projectID=$project->id");?>'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->task->type?></th>
<th class="<?php echo strpos($this->app->getClientLang(), 'zh') === false ? 'w-140px' : 'w-80px';?>"><?php echo $lang->task->type?></th>
<td><?php echo html::select('type', $lang->task->typeList, '', "class='form-control chosen' required");?></td>
<td></td>
</tr>
<?php if($lang->hourCommon !== $lang->workingHour):?>
<tr>
<th><?php echo $lang->story->oneUnit . $lang->hourCommon?></th>
<td><?php echo html::input('hourPointValue', '', "class='form-control' required");?></td>
<td><?php echo $lang->project->burnYUnit?></td>
<th><?php echo $lang->story->one . $lang->hourCommon?></th>
<td><div class='input-group'><span class='input-group-addon'><?php echo "=";?></span><?php echo html::input('hourPointValue', '', "class='form-control' required");?> <span class='input-group-addon'><?php echo $lang->workingHour;?></span></div></td>
<td></td>
</tr>
<?php endif;?>
<tr>
</tr>
<tr>
<th><?php echo $lang->story->field;?></th>
<td colspan='2'><?php echo html::select('field[]', $lang->story->convertToTask->fieldList, array_keys($lang->story->convertToTask->fieldList), "class='form-control chosen' multiple");?></td>
<td colspan='2'><?php echo html::checkbox('fields', $lang->story->convertToTask->fieldList, '', 'checked');?></td>
</tr>
<tr>
<td colspan='3'><div class='alert alert-info no-margin'><?php echo $lang->story->batchToTaskTips?></div></td>
</tr>
<tr>
<td colspan='3' class='text-center'>
+12 -2
View File
@@ -1074,10 +1074,20 @@ class story extends control
{
if(!empty($_POST))
{
$response['result'] = 'success';
$response['message'] = $this->lang->story->successToTask;
$this->story->batchToTask($projectID);
if(dao::isError()) die(js::error(dao::getError()) . js::locate('back'));
die(js::alert($this->lang->story->successToTask) . js::locate($this->createLink('project', 'task', "projectID=$projectID"), 'parent'));
if(dao::isError())
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
$this->send($response);
}
$response['locate'] = $this->createLink('project', 'task', "projectID=$projectID");
$this->send($response);
}
}
+3 -2
View File
@@ -60,11 +60,12 @@ $lang->story->batchChangeModule = "Mehere Module ändern";
$lang->story->viewAll = "Alle";
$lang->story->toTask = 'Convert to Task';
$lang->story->batchToTask = 'Batch Convert to Task';
$lang->story->convertRelations = 'Convert Relations';
$lang->story->skipStory = '%s is a parent story. It cannot be closed.';
$lang->story->closedStory = 'Story %s is closed and will not be closed.';
$lang->story->batchToTaskTips = "This action will create a task with the same name as the selected {$lang->storyCommon} and link {$lang->storyCommon} to the task. The closed {$lang->storyCommon} will not be converted into tasks.";
$lang->story->successToTask = "Converted to task."
$lang->story->successToTask = "Converted to task.";
$lang->story->common = 'Story';
$lang->story->id = 'ID';
@@ -126,7 +127,7 @@ $lang->story->allStories = 'Alle';
$lang->story->unclosed = 'Nicht geschlossen';
$lang->story->deleted = 'Gelöscht';
$lang->story->released = 'Released Linked Stories';
$lang->story->oneUnit = 'One Unit';
$lang->story->one = 'One';
$lang->story->field = 'Synchronized fields';
$lang->story->ditto = 'Dito';
+3 -2
View File
@@ -60,11 +60,12 @@ $lang->story->batchChangeModule = "Batch Change Modules";
$lang->story->viewAll = "See All";
$lang->story->toTask = 'Convert to Task';
$lang->story->batchToTask = 'Batch Convert to Task';
$lang->story->convertRelations = 'Convert Relations';
$lang->story->skipStory = '%s is a parent story. It cannot be closed.';
$lang->story->closedStory = 'Story %s is closed and will not be closed.';
$lang->story->batchToTaskTips = "This action will create a task with the same name as the selected {$lang->storyCommon} and link {$lang->storyCommon} to the task. The closed {$lang->storyCommon} will not be converted into tasks.";
$lang->story->successToTask = "Converted to task."
$lang->story->successToTask = "Converted to task.";
$lang->story->common = 'Story';
$lang->story->id = 'ID';
@@ -126,7 +127,7 @@ $lang->story->allStories = 'All Stories';
$lang->story->unclosed = 'Unclosed';
$lang->story->deleted = 'Deleted';
$lang->story->released = 'Released Stories';
$lang->story->oneUnit = 'One Unit';
$lang->story->one = 'One';
$lang->story->field = 'Synchronized fields';
$lang->story->ditto = 'Ditto';
+3 -2
View File
@@ -60,11 +60,12 @@ $lang->story->batchChangeModule = "Changer Modules par lot";
$lang->story->viewAll = "Voir Tout";
$lang->story->toTask = 'Convert to Task';
$lang->story->batchToTask = 'Batch Convert to Task';
$lang->story->convertRelations = 'Convert Relations';
$lang->story->skipStory = '%s is a parent story. It cannot be closed.';
$lang->story->closedStory = 'Story %s is closed and will not be closed.';
$lang->story->batchToTaskTips = "This action will create a task with the same name as the selected {$lang->storyCommon} and link {$lang->storyCommon} to the task. The closed {$lang->storyCommon} will not be converted into tasks.";
$lang->story->successToTask = "Converted to task."
$lang->story->successToTask = "Converted to task.";
$lang->story->common = 'Story';
$lang->story->id = 'ID';
@@ -126,7 +127,7 @@ $lang->story->allStories = 'Toutes les Stories';
$lang->story->unclosed = 'Non Fermées';
$lang->story->deleted = 'Supprimée';
$lang->story->released = 'Stories Versionnées';
$lang->story->oneUnit = 'One Unit';
$lang->story->one = 'One';
$lang->story->field = 'Synchronized fields';
$lang->story->ditto = 'Idem';
+3 -2
View File
@@ -60,11 +60,12 @@ $lang->story->batchChangeModule = "Thay đổi Module hàng loạt";
$lang->story->viewAll = "Xem tất cả";
$lang->story->toTask = 'Convert to Task';
$lang->story->batchToTask = 'Batch Convert to Task';
$lang->story->convertRelations = 'Convert Relations';
$lang->story->skipStory = '%s is a parent story. It cannot be closed.';
$lang->story->closedStory = 'Story %s is closed and will not be closed.';
$lang->story->batchToTaskTips = "This action will create a task with the same name as the selected {$lang->storyCommon} and link {$lang->storyCommon} to the task. The closed {$lang->storyCommon} will not be converted into tasks.";
$lang->story->successToTask = "Converted to task."
$lang->story->successToTask = "Converted to task.";
$lang->story->common = 'Câu chuyện';
$lang->story->id = 'ID';
@@ -126,7 +127,7 @@ $lang->story->allStories = 'Tất cả câu chuyện';
$lang->story->unclosed = 'Chưa đóng';
$lang->story->deleted = 'Đã xóa';
$lang->story->released = 'Đã phát hành';
$lang->story->oneUnit = 'One Unit';
$lang->story->one = 'One';
$lang->story->field = 'Synchronized fields';
$lang->story->ditto = 'Như trên';
+2 -1
View File
@@ -60,6 +60,7 @@ $lang->story->batchChangeModule = "批量修改模块";
$lang->story->viewAll = '查看全部';
$lang->story->toTask = '转任务';
$lang->story->batchToTask = '批量转任务';
$lang->story->convertRelations = '换算关系';
$lang->story->skipStory = '需求:%s 为父需求,将不会被关闭。';
$lang->story->closedStory = '需求:%s 已关闭,将不会被关闭。';
@@ -126,7 +127,7 @@ $lang->story->allStories = "所有{$lang->storyCommon}";
$lang->story->unclosed = '未关闭';
$lang->story->deleted = '已删除';
$lang->story->released = "已发布{$lang->storyCommon}数";
$lang->story->oneUnit = '一个单位';
$lang->story->one = '一个';
$lang->story->field = '同步的字段';
$lang->story->ditto = '同上';
+15 -2
View File
@@ -1426,6 +1426,18 @@ class storyModel extends model
$data = fixer::input('post')->get();
$now = helper::now();
/* Judgment of required items. */
if(empty($data->type))
{
dao::$errors['type'] = sprintf($this->lang->error->notempty, $this->lang->task->type);
}
if(isset($data->hourPointValue) and empty($data->hourPointValue))
{
dao::$errors['hourPointValue'] = sprintf($this->lang->error->notempty, $this->lang->story->convertRelations);
}
if(dao::isError()) return false;
/* Create tasks. */
$stories = $this->getByList($data->storyIdList);
foreach($stories as $story)
@@ -1438,12 +1450,13 @@ class storyModel extends model
$task->story = $story->id;
$task->type = $data->type;
$task->estimate = isset($data->hourPointValue) ? ($story->estimate * $data->hourPointValue) : $story->estimate;
$task->left = $task->estimate;
$task->openedBy = $this->app->user->account;
$task->openedDate = $now;
if(isset($data->field))
if(isset($data->fields))
{
foreach($data->field as $field)
foreach($data->fields as $field)
{
$task->$field = $story->$field;