* adjust code for task #536.
This commit is contained in:
@@ -89,6 +89,7 @@ $lang->resource->project->delete = 'delete';
|
||||
$lang->resource->project->task = 'task';
|
||||
$lang->resource->project->grouptask = 'groupTask';
|
||||
$lang->resource->project->importtask = 'importTask';
|
||||
$lang->resource->project->importBug = 'importBug';
|
||||
$lang->resource->project->story = 'story';
|
||||
$lang->resource->project->build = 'build';
|
||||
$lang->resource->project->bug = 'bug';
|
||||
@@ -123,7 +124,6 @@ $lang->resource->task->confirmStoryChange = 'confirmStoryChange';
|
||||
$lang->resource->task->ajaxGetUserTasks = 'ajaxGetUserTasks';
|
||||
$lang->resource->task->ajaxGetProjectTasks = 'ajaxGetProjectTasks';
|
||||
$lang->resource->task->report = 'reportChart';
|
||||
$lang->resource->task->importFromBug = 'importFromBug';
|
||||
|
||||
/* Build. */
|
||||
$lang->resource->build->create = 'create';
|
||||
@@ -334,9 +334,9 @@ $lang->changelog['2.2'][] = 'file-edit';
|
||||
|
||||
$lang->changelog['2.3'][] = 'product-dynamic';
|
||||
$lang->changelog['2.3'][] = 'project-dynamic';
|
||||
$lang->changelog['2.3'][] = 'project-importBug';
|
||||
$lang->changelog['2.3'][] = 'story-batchCreate';
|
||||
$lang->changelog['2.3'][] = 'task-batchCreate';
|
||||
$lang->changelog['2.3'][] = 'task-importFromBug';
|
||||
$lang->changelog['2.3'][] = 'testcase-batchCreate';
|
||||
$lang->changelog['2.3'][] = 'bug-confirmBug';
|
||||
$lang->changelog['2.3'][] = 'svn-diff';
|
||||
|
||||
@@ -295,6 +295,206 @@ class project extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Import from Bug.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function importBug($projectID = 0, $pager = '', $recTotal = 0, $recPerPage = 30, $pageID = 1)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$mails = $this->project->importBug($projectID);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
foreach($mails as $mail)
|
||||
{
|
||||
$this->sendmail($mail->taskID, $mail->actionID);
|
||||
}
|
||||
|
||||
/* Locate the browser. */
|
||||
die(js::locate($this->createLink('project', 'task', "projectID=$projectID"), 'parent'));
|
||||
}
|
||||
$this->loadModel('bug');
|
||||
|
||||
$projects = $this->project->getPairs();
|
||||
$users = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
|
||||
|
||||
/* Load pager and get tasks. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$this->project->setMenu($projects, $projectID);
|
||||
$header['title'] = $projects[$projectID] . $this->lang->colon . $this->lang->project->importBug;
|
||||
$position[] = html::a($this->createLink('project', 'task', "projectID=$projectID"), $projects[$projectID]);
|
||||
$position[] = $this->lang->project->importBug;
|
||||
|
||||
$bugs = $this->bug->getActiveBugs($pager);
|
||||
$this->view->header = $header;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->bugs = $bugs;
|
||||
$this->view->users = $users;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
/* task#536.
|
||||
public function importFromBug($projectID = 0, $browseType = 'noclosed', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
$this->products = $this->loadModel('product')->getPairs();
|
||||
if(empty($this->products))
|
||||
{
|
||||
//echo js::alert($this->lang->product->errorNoProduct);
|
||||
//die(js::locate($this->createLink('product', 'create')));
|
||||
}
|
||||
$this->view->products = $this->products;
|
||||
$projects = $this->project->getPairs('all');
|
||||
|
||||
/* Set browseType and queryID. /
|
||||
$browseType = strtolower($browseType);
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
|
||||
/* Set menu and save session. /
|
||||
$this->project->setMenu($this->project->getPairs(), $projectID);
|
||||
$this->session->set('bugList', $this->app->getURI(true));
|
||||
|
||||
/* Process the order by field. /
|
||||
if(!$orderBy) $orderBy = $this->cookie->qaBugOrder ? $this->cookie->qaBugOrder : 'id_desc';
|
||||
setcookie('qaBugOrder', $orderBy, $this->config->cookieLife, $this->config->webRoot);
|
||||
|
||||
/* Load pager. /
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = pager::init($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$bugs = array();
|
||||
if($browseType == 'all')
|
||||
{
|
||||
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where('product')->eq($productID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'assigntome')
|
||||
{
|
||||
$bugs = $this->dao->findByAssignedTo($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'openedbyme')
|
||||
{
|
||||
$bugs = $this->dao->findByOpenedBy($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'resolvedbyme')
|
||||
{
|
||||
$bugs = $this->dao->findByResolvedBy($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'assigntonull')
|
||||
{
|
||||
$bugs = $this->dao->findByAssignedTo('')->from(TABLE_BUG)->andWhere('product')->eq($productID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'unresolved')
|
||||
{
|
||||
$bugs = $this->dao->findByStatus('active')->from(TABLE_BUG)->andWhere('product')->eq($productID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'longlifebugs')
|
||||
{
|
||||
$bugs = $this->dao->findByLastEditedDate("<", date(DT_DATE1, strtotime('-7 days')))->from(TABLE_BUG)->andWhere('product')->eq($productID)
|
||||
->andWhere('openedDate')->lt(date(DT_DATE1,strtotime('-7 days')))
|
||||
->andWhere('deleted')->eq(0)
|
||||
->andWhere('status')->ne('closed')->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'postponedbugs')
|
||||
{
|
||||
$bugs = $this->dao->findByResolution('postponed')->from(TABLE_BUG)->andWhere('product')->eq($productID)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'needconfirm')
|
||||
{
|
||||
$bugs = $this->dao->select('t1.*, t2.title AS storyTitle')->from(TABLE_BUG)->alias('t1')->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
|
||||
->where("t2.status = 'active'")
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->andWhere('t2.version > t1.storyVersion')
|
||||
->orderBy($orderBy)
|
||||
->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'bysearch')
|
||||
{
|
||||
if($queryID)
|
||||
{
|
||||
$query = $this->loadModel('search')->getQuery($queryID);
|
||||
if($query)
|
||||
{
|
||||
$this->session->set('bugQuery', $query->sql);
|
||||
$this->session->set('bugForm', $query->form);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set('bugQuery', ' 1 = 1');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->session->bugQuery == false) $this->session->set('bugQuery', ' 1 = 1');
|
||||
}
|
||||
$bugQuery = str_replace("`product` = 'all'", '1', $this->session->bugQuery); // Search all product.
|
||||
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where($bugQuery)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
|
||||
/ Process the sql, get the conditon partion, save it to session. Thus the report page can use the same condition. /
|
||||
if($browseType != 'needconfirm')
|
||||
{
|
||||
$sql = explode('WHERE', $this->dao->get());
|
||||
$sql = explode('ORDER', $sql[1]);
|
||||
$this->session->set('bugReportCondition', $sql[0]);
|
||||
}
|
||||
|
||||
/ Build the search form. /
|
||||
$this->config->bug->search['actionURL'] = $this->createLink('bug', 'browse', "productID=$productID&browseType=bySearch&queryID=myQueryID");
|
||||
$this->config->bug->search['queryID'] = $queryID;
|
||||
$this->config->bug->search['params']['product']['values'] = array($productID => $this->products[$productID], 'all' => $this->lang->bug->allProduct);
|
||||
$this->config->bug->search['params']['module']['values'] = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0);
|
||||
$this->config->bug->search['params']['project']['values'] = $this->product->getProjectPairs($productID);
|
||||
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($productID);
|
||||
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->build->getProductBuildPairs($productID);
|
||||
$this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->bug->search);
|
||||
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
|
||||
$header['title'] = $projects[$projectID] . $this->lang->colon . $this->lang->task->common;
|
||||
$position[] = html::a($this->createLink('project', 'task', "projectID=$projectID"), $projects[$projectID]);
|
||||
$position[] = $this->lang->task->common;
|
||||
|
||||
$this->view->header = $header;
|
||||
$this->view->position = $position;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->projectName = $projects[$projectID];
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->bugs = $bugs;
|
||||
$this->view->users = $users;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->param = $param;
|
||||
$this->view->orderBy = $orderBy;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Browse stories of a project.
|
||||
*
|
||||
@@ -664,6 +864,58 @@ class project extends control
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send email.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @param int $actionID
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
private function sendmail($taskID, $actionID)
|
||||
{
|
||||
/* Set toList and ccList. */
|
||||
$task = $this->loadModel('task')->getById($taskID);
|
||||
$projectName = $this->project->getById($task->project)->name;
|
||||
$toList = $task->assignedTo;
|
||||
$ccList = trim($task->mailto, ',');
|
||||
|
||||
if($toList == '')
|
||||
{
|
||||
if($ccList == '') return;
|
||||
if(strpos($ccList, ',') === false)
|
||||
{
|
||||
$toList = $ccList;
|
||||
$ccList = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$commaPos = strpos($ccList, ',');
|
||||
$toList = substr($ccList, 0, $commaPos);
|
||||
$ccList = substr($ccList, $commaPos + 1);
|
||||
}
|
||||
}
|
||||
elseif(strtolower($toList) == 'closed')
|
||||
{
|
||||
$toList = $task->finishedBy;
|
||||
}
|
||||
|
||||
/* Get action info. */
|
||||
$action = $this->loadModel('action')->getById($actionID);
|
||||
$history = $this->action->getHistory($actionID);
|
||||
$action->history = isset($history[$actionID]) ? $history[$actionID] : array();
|
||||
|
||||
/* Create the email content. */
|
||||
$this->view->task = $task;
|
||||
$this->view->action = $action;
|
||||
$this->clear();
|
||||
$mailContent = $this->parse($this->moduleName, 'sendmail');
|
||||
|
||||
/* Send emails. */
|
||||
$this->loadModel('mail')->send($toList, $projectName . ':' . 'TASK#' . $task->id . $this->lang->colon . $task->name, $mailContent, $ccList);
|
||||
if($this->mail->isError()) echo js::error($this->mail->getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage products.
|
||||
*
|
||||
|
||||
@@ -86,6 +86,7 @@ $lang->project->manageMembers = 'Manage team members';
|
||||
$lang->project->unlinkMember = 'Remove member';
|
||||
$lang->project->unlinkStory = 'Remove story';
|
||||
$lang->project->importTask = 'Import Task';
|
||||
$lang->project->importBug = 'Import tasks from Bugs';
|
||||
$lang->project->ajaxGetProducts= "API: get project's products";
|
||||
|
||||
/* Browse. */
|
||||
|
||||
@@ -86,6 +86,7 @@ $lang->project->manageMembers = '团队管理';
|
||||
$lang->project->unlinkMember = '移除成员';
|
||||
$lang->project->unlinkStory = '移除需求';
|
||||
$lang->project->importTask = '导入任务';
|
||||
$lang->project->importBug = '导入Bug';
|
||||
$lang->project->ajaxGetProducts= '接口:获得项目产品列表';
|
||||
|
||||
/* 分组浏览。*/
|
||||
|
||||
@@ -567,6 +567,65 @@ class projectModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Import task from Bug.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function importBug($projectID)
|
||||
{
|
||||
$this->loadModel('bug');
|
||||
$bugLang = $this->app->loadLang('bug');
|
||||
$this->loadModel('task');
|
||||
$this->loadModel('story');
|
||||
$now = helper::now();
|
||||
$BugToTasks = fixer::input('post')->get();
|
||||
foreach($BugToTasks->import as $key => $value)
|
||||
{
|
||||
$bug = $this->bug->getById($key);
|
||||
$task->project = $projectID;
|
||||
$task->story = $bug->story;
|
||||
$task->storyVersion = $bug->story;
|
||||
$task->fromBug = $key;
|
||||
$task->name = $bug->title;
|
||||
$task->type = 'devel';
|
||||
$task->pri = $BugToTasks->pri[$key];
|
||||
$task->consumed = 0;
|
||||
$task->status = 'wait';
|
||||
$task->statusCustom = 1;
|
||||
$task->desc = $bugLang->bug->resolve . ':' . sprintf('%03d', $key);
|
||||
$task->openedDate = $now;
|
||||
$task->openedBy = $this->app->user->account;
|
||||
if(!empty($BugToTasks->estimate[$key]))
|
||||
{
|
||||
$task->estimate = $BugToTasks->estimate[$key];
|
||||
$task->left = $task->estimate;
|
||||
}
|
||||
if(!empty($BugToTasks->assignedTo[$key]))
|
||||
{
|
||||
$task->assignedTo = $BugToTasks->assignedTo[$key];
|
||||
$task->assignedDate = $now;
|
||||
}
|
||||
$this->dao->insert(TABLE_TASK)->data($task)->checkIF($BugToTasks->estimate[$key] != '', 'estimate', 'float')->exec();
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
echo js::error(dao::getError());
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
|
||||
$taskID = $this->dao->lastInsertID();
|
||||
if($task->story != false) $this->story->setStage($task->story);
|
||||
$actionID = $this->loadModel('action')->create('task', $taskID, 'Opened', '');
|
||||
$this->dao->update(TABLE_BUG)->set('toTask')->eq($taskID)->where('id')->eq($key)->exec();
|
||||
$mails[$key]->taskID = $taskID;
|
||||
$mails[$key]->actionID = $actionID;
|
||||
}
|
||||
return $mails;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get child projects.
|
||||
*
|
||||
|
||||
@@ -15,23 +15,20 @@
|
||||
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
|
||||
<table class='table-1 colored'>
|
||||
<tr class='colhead'>
|
||||
<th class='w-id'> <?php echo $lang->task->importBug;?></th>
|
||||
<th class='w-id'> <?php echo $lang->import;?></th>
|
||||
<th class='w-id'> <?php echo $lang->idAB;?></th>
|
||||
<th class='hidden'></th>
|
||||
<th class='w-severity'> <?php echo $lang->bug->severityAB;?></th>
|
||||
<th class='w-pri'> <?php echo $lang->priAB;?></th>
|
||||
<th><?php echo $lang->bug->title;?></th>
|
||||
<th class='w-80px'><?php echo $lang->bug->statusAB;?></th>
|
||||
<th class='w-80px'><?php echo $lang->task->pri;?></th>
|
||||
<th class='w-150px'><?php echo $lang->task->assignedTo;?></th>
|
||||
<th class='w-80px nobr'><?php echo $lang->task->estimateBatch;?></th>
|
||||
<th class='w-80px nobr'><?php echo $lang->task->estimate;?></th>
|
||||
</tr>
|
||||
<?php foreach($bugs as $bug):?>
|
||||
<tr class='a-center'>
|
||||
<td><?php echo html::checkbox("import[$bug->id]", '');?> </td>
|
||||
<?php $class = ($bug->status == 'active' or $bug->status == 'reactivated') ? 'active' . $bug->severity : $bug->status;?>
|
||||
<td class='linkbox <?php echo $class;?>'><?php echo sprintf('%03d', $bug->id);?></td>
|
||||
<td class='hidden'><?php echo html::input("id[$bug->id]", $bug->id);?></td>
|
||||
<td><?php echo sprintf('%03d', $bug->id); echo html::input("id[$bug->id]", $bug->id, "class=hidden");?></td>
|
||||
<td><?php echo $lang->bug->severityList[$bug->severity]?></td>
|
||||
<td><?php echo $lang->bug->priList[$bug->pri]?></td>
|
||||
<td class='a-left nobr'><?php echo $bug->title;?></td>
|
||||
@@ -41,25 +38,8 @@
|
||||
<td><?php echo html::input("estimate[$bug->id]", '', 'size=4');?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<tr>
|
||||
<td colspan='9'>
|
||||
<div class='f-left'>
|
||||
<?php
|
||||
foreach($lang->bug->statusList as $status => $label)
|
||||
{
|
||||
if($status != 'active') continue;
|
||||
rsort($this->lang->bug->severityList);
|
||||
foreach($this->lang->bug->severityList as $severity)
|
||||
{
|
||||
echo "<span class='$status$severity'> {$lang->bug->severity}:$severity </span> ";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class='f-right'><?php $pager->show();?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan='9' class='a-center'><?php echo html::submitButton($lang->task->importBug) . html::resetButton();?></td></tr>
|
||||
<tr><td colspan='9'><div class='f-right'><?php $pager->show();?></div></td></tr>
|
||||
<tr><td colspan='9' class='a-center'><?php echo html::submitButton($lang->import) . html::resetButton();?></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -21,7 +21,7 @@
|
||||
<?php
|
||||
if($browseType != 'needconfirm') common::printLink('task', 'export', "projectID=$projectID&orderBy=$orderBy", $lang->export, '', 'class="export"');
|
||||
common::printLink('project', 'importTask', "project=$project->id", $lang->project->importTask);
|
||||
common::printLink('task', 'importFromBug', "projectID=$project->id", $lang->task->importFromBug);
|
||||
common::printLink('project', 'importBug', "projectID=$project->id", $lang->project->importBug);
|
||||
common::printLink('task', 'report', "project=$project->id&browseType=$browseType", $lang->task->report->common);
|
||||
common::printLink('task', 'batchCreate', "projectID=$project->id", $lang->task->batchCreate);
|
||||
common::printLink('task', 'create', "project=$project->id", $lang->task->create);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
$lang->story->browse = "需求列表";
|
||||
$lang->story->create = "新增需求";
|
||||
$lang->story->batchCreate = "批量添加需求";
|
||||
$lang->story->batchCreate = "批量添加";
|
||||
$lang->story->change = "变更";
|
||||
$lang->story->changed = '需求变更';
|
||||
$lang->story->review = '评审';
|
||||
|
||||
@@ -664,204 +664,4 @@ class task extends control
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Import from Bug.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function importFromBug($projectID = 0, $pager = '', $recTotal = 0, $recPerPage = 30, $pageID = 1)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$mails = $this->task->importFromBug($projectID);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
foreach($mails as $mail)
|
||||
{
|
||||
$this->sendmail($mail->taskID, $mail->actionID);
|
||||
}
|
||||
|
||||
/* Locate the browser. */
|
||||
die(js::locate($this->createLink('project', 'task', "projectID=$projectID"), 'parent'));
|
||||
}
|
||||
$this->loadModel('bug');
|
||||
|
||||
$projects = $this->project->getPairs();
|
||||
$users = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
|
||||
|
||||
/* Load pager and get tasks. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$this->project->setMenu($projects, $projectID);
|
||||
$header['title'] = $projects[$projectID] . $this->lang->colon . $this->lang->task->importFromBug;
|
||||
$position[] = html::a($this->createLink('project', 'task', "projectID=$projectID"), $projects[$projectID]);
|
||||
$position[] = $this->lang->task->importFromBug;
|
||||
|
||||
$bugs = $this->bug->getActiveBugs($pager);
|
||||
$this->view->header = $header;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->bugs = $bugs;
|
||||
$this->view->users = $users;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
/* task#536.
|
||||
public function importFromBug($projectID = 0, $browseType = 'noclosed', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
$this->products = $this->loadModel('product')->getPairs();
|
||||
if(empty($this->products))
|
||||
{
|
||||
//echo js::alert($this->lang->product->errorNoProduct);
|
||||
//die(js::locate($this->createLink('product', 'create')));
|
||||
}
|
||||
$this->view->products = $this->products;
|
||||
$projects = $this->project->getPairs('all');
|
||||
|
||||
/* Set browseType and queryID. /
|
||||
$browseType = strtolower($browseType);
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
|
||||
/* Set menu and save session. /
|
||||
$this->project->setMenu($this->project->getPairs(), $projectID);
|
||||
$this->session->set('bugList', $this->app->getURI(true));
|
||||
|
||||
/* Process the order by field. /
|
||||
if(!$orderBy) $orderBy = $this->cookie->qaBugOrder ? $this->cookie->qaBugOrder : 'id_desc';
|
||||
setcookie('qaBugOrder', $orderBy, $this->config->cookieLife, $this->config->webRoot);
|
||||
|
||||
/* Load pager. /
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = pager::init($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$bugs = array();
|
||||
if($browseType == 'all')
|
||||
{
|
||||
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where('product')->eq($productID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'assigntome')
|
||||
{
|
||||
$bugs = $this->dao->findByAssignedTo($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'openedbyme')
|
||||
{
|
||||
$bugs = $this->dao->findByOpenedBy($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'resolvedbyme')
|
||||
{
|
||||
$bugs = $this->dao->findByResolvedBy($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'assigntonull')
|
||||
{
|
||||
$bugs = $this->dao->findByAssignedTo('')->from(TABLE_BUG)->andWhere('product')->eq($productID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'unresolved')
|
||||
{
|
||||
$bugs = $this->dao->findByStatus('active')->from(TABLE_BUG)->andWhere('product')->eq($productID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'longlifebugs')
|
||||
{
|
||||
$bugs = $this->dao->findByLastEditedDate("<", date(DT_DATE1, strtotime('-7 days')))->from(TABLE_BUG)->andWhere('product')->eq($productID)
|
||||
->andWhere('openedDate')->lt(date(DT_DATE1,strtotime('-7 days')))
|
||||
->andWhere('deleted')->eq(0)
|
||||
->andWhere('status')->ne('closed')->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'postponedbugs')
|
||||
{
|
||||
$bugs = $this->dao->findByResolution('postponed')->from(TABLE_BUG)->andWhere('product')->eq($productID)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'needconfirm')
|
||||
{
|
||||
$bugs = $this->dao->select('t1.*, t2.title AS storyTitle')->from(TABLE_BUG)->alias('t1')->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
|
||||
->where("t2.status = 'active'")
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->andWhere('t2.version > t1.storyVersion')
|
||||
->orderBy($orderBy)
|
||||
->fetchAll();
|
||||
}
|
||||
elseif($browseType == 'bysearch')
|
||||
{
|
||||
if($queryID)
|
||||
{
|
||||
$query = $this->loadModel('search')->getQuery($queryID);
|
||||
if($query)
|
||||
{
|
||||
$this->session->set('bugQuery', $query->sql);
|
||||
$this->session->set('bugForm', $query->form);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set('bugQuery', ' 1 = 1');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->session->bugQuery == false) $this->session->set('bugQuery', ' 1 = 1');
|
||||
}
|
||||
$bugQuery = str_replace("`product` = 'all'", '1', $this->session->bugQuery); // Search all product.
|
||||
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where($bugQuery)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
|
||||
/ Process the sql, get the conditon partion, save it to session. Thus the report page can use the same condition. /
|
||||
if($browseType != 'needconfirm')
|
||||
{
|
||||
$sql = explode('WHERE', $this->dao->get());
|
||||
$sql = explode('ORDER', $sql[1]);
|
||||
$this->session->set('bugReportCondition', $sql[0]);
|
||||
}
|
||||
|
||||
/ Build the search form. /
|
||||
$this->config->bug->search['actionURL'] = $this->createLink('bug', 'browse', "productID=$productID&browseType=bySearch&queryID=myQueryID");
|
||||
$this->config->bug->search['queryID'] = $queryID;
|
||||
$this->config->bug->search['params']['product']['values'] = array($productID => $this->products[$productID], 'all' => $this->lang->bug->allProduct);
|
||||
$this->config->bug->search['params']['module']['values'] = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0);
|
||||
$this->config->bug->search['params']['project']['values'] = $this->product->getProjectPairs($productID);
|
||||
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($productID);
|
||||
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->build->getProductBuildPairs($productID);
|
||||
$this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->bug->search);
|
||||
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
|
||||
$header['title'] = $projects[$projectID] . $this->lang->colon . $this->lang->task->common;
|
||||
$position[] = html::a($this->createLink('project', 'task', "projectID=$projectID"), $projects[$projectID]);
|
||||
$position[] = $this->lang->task->common;
|
||||
|
||||
$this->view->header = $header;
|
||||
$this->view->position = $position;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->projectName = $projects[$projectID];
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->bugs = $bugs;
|
||||
$this->view->users = $users;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->param = $param;
|
||||
$this->view->orderBy = $orderBy;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
.active1 {background:#E70014;}
|
||||
.active2 {background:#EA5407;}
|
||||
.active3 {background:#F39801;}
|
||||
.active4 {background:#FFF100;}
|
||||
.active1 a, .active2 a, .active3 a{color:white; text-decoration:none}
|
||||
.active4 a {color:blue; text-decoration:none}
|
||||
@@ -26,8 +26,6 @@ $lang->task->activate = "Activate";
|
||||
$lang->task->export = "Export";
|
||||
$lang->task->reportChart = "Report chart";
|
||||
$lang->task->fromBug = 'From Bug';
|
||||
$lang->task->importBug = 'Import';
|
||||
$lang->task->importFromBug = 'Import tasks from Bug';
|
||||
$lang->task->confirmStoryChange = "Confirm story change";
|
||||
|
||||
$lang->task->common = 'Task';
|
||||
@@ -40,7 +38,6 @@ $lang->task->type = 'Type';
|
||||
$lang->task->pri = 'Pri';
|
||||
$lang->task->mailto = 'Mailto';
|
||||
$lang->task->estimate = 'Estimate';
|
||||
$lang->task->estimateBatch = 'Estimate';
|
||||
$lang->task->estimateAB = 'Est';
|
||||
$lang->task->left = 'Left';
|
||||
$lang->task->leftAB = 'Left';
|
||||
@@ -71,21 +68,8 @@ $lang->task->lastEditedBy = 'Last Edited By';
|
||||
$lang->task->lastEditedDate = 'Last Edited Date';
|
||||
$lang->task->lastEdited = 'Last Edited';
|
||||
|
||||
$lang->task->bug->assignToMe = 'MyBugs';
|
||||
$lang->task->bug->openedByMe = 'MyOpen';
|
||||
$lang->task->bug->resolvedByMe = 'MyResolve';
|
||||
$lang->task->bug->closedByMe = 'MyClose';
|
||||
$lang->task->bug->assignToNull = 'Unassigned';
|
||||
$lang->task->bug->unResolved = 'Unresolved';
|
||||
$lang->task->bug->longLifeBugs = 'Longlife';
|
||||
$lang->task->bug->postponedBugs = 'Postponed';
|
||||
$lang->task->bug->allBugs = 'All Bugs';
|
||||
$lang->task->bug->byQuery = 'Search';
|
||||
$lang->task->bug->needConfirm = 'StoryChanged';
|
||||
|
||||
$lang->task->same = 'The same as above';
|
||||
$lang->task->notes = '(Notes: the name, type, pri and estimate must be written, otherwise it is no use)';
|
||||
$lang->task->descFromBug = 'ResolveBug:';
|
||||
|
||||
$lang->task->statusList[''] = '';
|
||||
$lang->task->statusList['wait'] = 'Waiting';
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
$lang->task->index = "任务一览";
|
||||
$lang->task->create = "新增任务";
|
||||
$lang->task->batchCreate = "批量添加任务";
|
||||
$lang->task->batchCreate = "批量添加";
|
||||
$lang->task->import = "导入之前未完任务";
|
||||
$lang->task->edit = "编辑任务";
|
||||
$lang->task->delete = "删除任务";
|
||||
@@ -26,8 +26,6 @@ $lang->task->activate = "激活任务";
|
||||
$lang->task->export = "导出数据";
|
||||
$lang->task->reportChart = "报表统计";
|
||||
$lang->task->fromBug = '来源Bug';
|
||||
$lang->task->importBug = '导入';
|
||||
$lang->task->importFromBug = '导入Bug';
|
||||
$lang->task->confirmStoryChange = "确认需求变动";
|
||||
|
||||
$lang->task->common = '任务';
|
||||
@@ -40,7 +38,6 @@ $lang->task->type = '任务类型';
|
||||
$lang->task->pri = '优先级';
|
||||
$lang->task->mailto = '抄送给';
|
||||
$lang->task->estimate = '最初预计';
|
||||
$lang->task->estimateBatch = '预计工时';
|
||||
$lang->task->estimateAB = '预';
|
||||
$lang->task->left = '预计剩余';
|
||||
$lang->task->leftAB = '剩';
|
||||
@@ -71,21 +68,8 @@ $lang->task->lastEditedBy = '最后修改';
|
||||
$lang->task->lastEditedDate = '最后修改日期';
|
||||
$lang->task->lastEdited = '最后编辑';
|
||||
|
||||
$lang->task->bug->assignToMe = '指派给我';
|
||||
$lang->task->bug->openedByMe = '由我创建';
|
||||
$lang->task->bug->resolvedByMe = '由我解决';
|
||||
$lang->task->bug->closedByMe = '由我关闭';
|
||||
$lang->task->bug->assignToNull = '未指派';
|
||||
$lang->task->bug->unResolved = '未解决';
|
||||
$lang->task->bug->longLifeBugs = '久未处理';
|
||||
$lang->task->bug->postponedBugs = '被延期';
|
||||
$lang->task->bug->allBugs = '所有Bug';
|
||||
$lang->task->bug->byQuery = '搜索';
|
||||
$lang->task->bug->needConfirm = '需求变动';
|
||||
|
||||
$lang->task->same = '同上';
|
||||
$lang->task->notes = '(注:“任务类型”、“任务名称”、“优先级”和“预计工时”必需填写,否则此行无效)';
|
||||
$lang->task->descFromBug = '解决Bug:';
|
||||
|
||||
$lang->task->statusList[''] = '';
|
||||
$lang->task->statusList['wait'] = '未开始';
|
||||
|
||||
@@ -141,63 +141,6 @@ class taskModel extends model
|
||||
return $mails;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import task from Bug.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function importFromBug($projectID)
|
||||
{
|
||||
$this->loadModel('bug');
|
||||
$this->loadModel('task');
|
||||
$now = helper::now();
|
||||
$BugToTasks = fixer::input('post')->get();
|
||||
foreach($BugToTasks->import as $key => $value)
|
||||
{
|
||||
$bug = $this->bug->getById($key);
|
||||
$task->project = $projectID;
|
||||
$task->story = $bug->story;
|
||||
$task->storyVersion = $bug->story;
|
||||
$task->fromBug = $key;
|
||||
$task->name = $bug->title;
|
||||
$task->type = 'devel';
|
||||
$task->pri = $BugToTasks->pri[$key];
|
||||
$task->consumed = 0;
|
||||
$task->status = 'wait';
|
||||
$task->statusCustom = 1;
|
||||
$task->desc = $this->lang->task->descFromBug . sprintf('%03d', $key);
|
||||
$task->openedDate = $now;
|
||||
$task->openedBy = $this->app->user->account;
|
||||
if(!empty($BugToTasks->estimate[$key]))
|
||||
{
|
||||
$task->estimate = $BugToTasks->estimate[$key];
|
||||
$task->left = $task->estimate;
|
||||
}
|
||||
if(!empty($BugToTasks->assignedTo[$key]))
|
||||
{
|
||||
$task->assignedTo = $BugToTasks->assignedTo[$key];
|
||||
$task->assignedDate = $now;
|
||||
}
|
||||
$this->dao->insert(TABLE_TASK)->data($task)->checkIF($task->estimate != '', 'estimate', 'float')->exec();
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
echo js::error(dao::getError());
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
|
||||
$taskID = $this->dao->lastInsertID();
|
||||
if($task->story != false) $this->story->setStage($tasks->story[$i]);
|
||||
$actionID = $this->loadModel('action')->create('task', $taskID, 'Opened', '');
|
||||
$this->dao->update(TABLE_BUG)->set('toTask')->eq($taskID)->where('id')->eq($key)->exec();
|
||||
$mails[$key]->taskID = $taskID;
|
||||
$mails[$key]->actionID = $actionID;
|
||||
}
|
||||
return $mails;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a task.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user