* Add selected lane when batch create in kanban.

This commit is contained in:
xieqiyu
2022-03-08 14:43:55 +08:00
parent 12f4dd389c
commit 944c0efdfe
6 changed files with 83 additions and 12 deletions
+15 -5
View File
@@ -200,7 +200,8 @@ class bugModel extends model
$bug->os = $data->oses[$i];
$bug->browser = $data->browsers[$i];
$bug->keywords = $data->keywords[$i];
$bug->laneID = $data->lanes[$i];
if(isset($data->lanes[$i])) $bug->laneID = $data->lanes[$i];
if($bug->execution != 0) $bug->project = $this->dao->select('parent')->from(TABLE_EXECUTION)->where('id')->eq($bug->execution)->fetch('parent');
@@ -237,8 +238,12 @@ class bugModel extends model
/* When the bug is created by uploading an image, add the image to the step of the bug. */
foreach($bugs as $i => $bug)
{
$laneID = isset($bug->laneID) ? $bug->laneID : $output['laneID'];
unset($bug->laneID);
$laneID = isset($output['laneID']) ? $output['laneID'] : 0;
if(isset($bug->laneID))
{
$laneID = $bug->laneID;
unset($bug->laneID);
}
if(!empty($data->uploadImage[$i]))
{
@@ -278,8 +283,13 @@ class bugModel extends model
if($bug->execution)
{
$columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'unconfirmed');
$columnID = empty($columnIDByLaneID) ? $output['columnID'] : $columnIDByLaneID;
$columnID = isset($output['columnID']) ? $output['columnID'] : 0;
if(!empty($laneID))
{
$columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'unconfirmed');
$columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID;
}
if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($bug->execution, $laneID, $columnID, 'bug', $bugID);
if(empty($laneID) or empty($columnID)) $this->kanban->updateLane($bug->execution, 'bug');
+1 -1
View File
@@ -290,7 +290,7 @@ function createColumnCreateMenu(options)
else if(col.type == 'wait')
{
if(priv.canCreateTask) items.push({label: taskLang.create, url: $.createLink('task', 'create', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&todoID=0&extra=laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
if(priv.canBatchCreateTask) items.push({label: taskLang.batchCreate, url: $.createLink('task', 'batchcreate', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&iframe=0&extra=laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
if(priv.canBatchCreateTask) items.push({label: taskLang.batchCreate, url: $.createLink('task', 'batchcreate', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&iframe=0&extra=regionID=" + regionID + ",laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
if(priv.canImportBug && vision == 'rnd') items.push({label: executionLang.importBug, url: $.createLink('execution', 'importBug', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&todoID=0&extra=laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
}
return items;
+17
View File
@@ -389,6 +389,23 @@ class task extends control
$showAllModule = isset($this->config->execution->task->allModule) ? $this->config->execution->task->allModule : '';
$modules = $this->loadModel('tree')->getTaskOptionMenu($executionID, 0, 0, $showAllModule ? 'allModule' : '');
if($execution->type == 'kanban')
{
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
parse_str($extra, $output);
$this->loadModel('kanban');
$regionPairs = $this->kanban->getRegionPairs($executionID, 0, 'execution');
$regionID = isset($output['regionID']) ? $output['regionID'] : key($regionPairs);
$lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'task');
$laneID = isset($output['laneID']) ? $output['laneID'] : key($lanePairs);
$this->view->regionID = $regionID;
$this->view->laneID = $laneID;
$this->view->regionPairs = $regionPairs;
$this->view->lanePairs = $lanePairs;
}
$title = $execution->name . $this->lang->colon . $this->lang->task->batchCreate;
$position[] = html::a($taskLink, $execution->name);
$position[] = $this->lang->task->common;
+21
View File
@@ -184,6 +184,27 @@ function markStoryTask()
});
}
/**
* Set lane.
*
* @param int $regionID
* @param int $num
* @access public
* @return void
*/
function setLane(regionID, num)
{
laneLink = createLink('kanban', 'ajaxGetLanes', 'regionID=' + regionID + '&type=task&field=lanes&i=' + num);
$.get(laneLink, function(lanes)
{
if(!lanes) lanes = '<select id="lanes' + num + '" name="lanes[' + num + ']" class="form-control"></select>';
$('#lanes' + num).replaceWith(lanes);
$("#lanes" + num + "_chosen").remove();
$("#lanes" + num).next('.picker').remove();
$("#lanes" + num).chosen();
});
}
$(document).on('chosen:showing_dropdown', 'select[name^="story"],.chosen-with-drop', function()
{
var select = $(this).closest('td').find('select');
+16 -1
View File
@@ -331,6 +331,7 @@ class taskModel extends model
if($assignedTo) $data[$i]->assignedDate = $now;
if(strpos($this->config->task->create->requiredFields, 'estStarted') !== false and empty($estStarted)) $data[$i]->estStarted = '';
if(strpos($this->config->task->create->requiredFields, 'deadline') !== false and empty($deadline)) $data[$i]->deadline = '';
if(isset($tasks->lanes[$i])) $data[$i]->laneID = $tasks->lanes[$i];
foreach($extendFields as $extendField)
{
@@ -387,6 +388,13 @@ class taskModel extends model
foreach($data as $i => $task)
{
$laneID = isset($output['laneID']) ? $output['laneID'] : 0;
if(isset($task->laneID))
{
$laneID = $task->laneID;
unset($task->laneID);
}
$task->version = 1;
$this->dao->insert(TABLE_TASK)->data($task)
->autoCheck()
@@ -418,7 +426,14 @@ class taskModel extends model
}
else
{
if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($executionID, $output['laneID'], $output['columnID'], 'task', $taskID);
$columnID = isset($output['columnID']) ? $output['columnID'] : 0;
if(!empty($laneID))
{
$columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'wait');
$columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID;
}
if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($executionID, $laneID, $columnID, 'task', $taskID);
}
$actionID = $this->action->create('task', $taskID, 'Opened', '');
+13 -5
View File
@@ -64,6 +64,10 @@
<th class='c-story<?php echo zget($visibleFields, 'story', ' hidden') . zget($requiredFields, 'story', '', ' required');?>'><?php echo $lang->task->story;?></th>
<?php endif;?>
<th class='c-name required has-btn'><?php echo $lang->task->name;?></span></th>
<?php if($execution->type == 'kanban'):?>
<th class='c-module'><?php echo $lang->kanbancard->region;?></th>
<th class='c-module'><?php echo $lang->kanbancard->lane;?></th>
<?php endif;?>
<th class='c-type required'><?php echo $lang->typeAB;?></span></th>
<th class='c-assigned<?php echo zget($visibleFields, 'assignedTo', ' hidden') . zget($requiredFields, 'assignedTo', '', ' required');?>'><?php echo $lang->task->assignedTo;?></th>
<th class='c-estimate<?php echo zget($visibleFields, 'estimate', ' hidden') . zget($requiredFields, 'estimate', '', ' required');?>'><?php echo $lang->task->estimateAB;?></th>
@@ -85,9 +89,9 @@
$modules['ditto'] = $lang->task->ditto;
if($execution->type == 'ops') $colspan = $colspan - 1;
?>
<?php for($i = 0; $i < $config->task->batchCreate; $i++):?>
<?php for($i = 1; $i <= $config->task->batchCreate; $i++):?>
<?php
if($i == 0)
if($i == 1)
{
$currentStory = $storyID;
$type = '';
@@ -100,7 +104,7 @@
?>
<?php $pri = 3;?>
<tr>
<td class='text-center'><?php echo $i + 1;?></td>
<td class='text-center'><?php echo $i;?></td>
<td <?php echo zget($visibleFields, 'module', "class='hidden'")?> style='overflow:visible'>
<?php echo html::select("module[$i]", $modules, $moduleID, "class='form-control chosen' onchange='setStories(this.value, $execution->id, $i)'")?>
<?php echo html::hidden("parent[$i]", $parent);?>
@@ -129,6 +133,10 @@
</div>
</div>
</td>
<?php if($execution->type == 'kanban'):?>
<td><?php echo html::select("regions[$i]", $regionPairs, $regionID, "class='form-control chosen' onchange='setLane(this.value, $i)'");?></td>
<td><?php echo html::select("lanes[$i]", $lanePairs, $laneID, "class='form-control chosen'");?></td>
<?php endif;?>
<td><?php echo html::select("type[$i]", $lang->task->typeList, $type, 'class=form-control');?></td>
<td <?php echo zget($visibleFields, 'assignedTo', "class='hidden'")?> style='overflow:visible'><?php echo html::select("assignedTo[$i]", $members, $member, "class='form-control chosen'");?></td>
<td <?php echo zget($visibleFields, 'estimate', "class='hidden'")?>><?php echo html::input("estimate[$i]", '', "class='form-control text-center'");?></td>
@@ -136,7 +144,7 @@
<div class='input-group'>
<?php
echo html::input("estStarted[$i]", '', "class='form-control text-center form-date' onkeyup='toggleCheck(this)'");
if($i != 0) echo "<span class='input-group-addon estStartedBox'><input type='checkbox' name='estStartedDitto[$i]' id='estStartedDitto$i' " . ($i> 0 ? "checked" : '') . " /> {$lang->task->ditto}</span>";
if($i != 1) echo "<span class='input-group-addon estStartedBox'><input type='checkbox' name='estStartedDitto[$i]' id='estStartedDitto$i' " . ($i > 1 ? "checked" : '') . " /> {$lang->task->ditto}</span>";
?>
</div>
</td>
@@ -144,7 +152,7 @@
<div class='input-group'>
<?php
echo html::input("deadline[$i]", '', "class='form-control text-center form-date' onkeyup='toggleCheck(this)'");
if($i != 0) echo "<span class='input-group-addon deadlineBox'><input type='checkbox' name='deadlineDitto[$i]' id='deadlineDitto$i' " . ($i> 0 ? "checked" : '') . " /> {$lang->task->ditto}</span>";
if($i != 1) echo "<span class='input-group-addon deadlineBox'><input type='checkbox' name='deadlineDitto[$i]' id='deadlineDitto$i' " . ($i > 1 ? "checked" : '') . " /> {$lang->task->ditto}</span>";
?>
</div>
</td>