* Optimize code after code reviewing.
This commit is contained in:
@@ -56,10 +56,10 @@ class task extends control
|
||||
/* Check whether the execution has permission to create tasks. */
|
||||
$this->execution->getLimitedExecution();
|
||||
$limitedExecutions = !empty($_SESSION['limitedExecutions']) ? $_SESSION['limitedExecutions'] : '';
|
||||
if(strpos(",{$limitedExecutions},", ",$executionID,") !== false)
|
||||
if(strpos(",{$limitedExecutions},", ",{$executionID},") !== false)
|
||||
{
|
||||
echo js::alert($this->lang->task->createDenied);
|
||||
return print(js::locate($this->createLink('execution', 'task', "executionID=$executionID")));
|
||||
return print(js::locate($this->createLink('execution', 'task', "executionID={$executionID}")));
|
||||
}
|
||||
|
||||
/* Submit the data processing after creating the task form. */
|
||||
@@ -70,7 +70,7 @@ class task extends control
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
list($task, $testTasks, $duplicateTaskID) = $result;
|
||||
if($duplicateTaskID) return $this->send(array('result' => 'success', 'message' => sprintf($this->lang->duplicate, $this->lang->task->common), 'locate' => $this->createLink('task', 'view', "taskID={$existTaskID}")));
|
||||
if($duplicateTaskID) return $this->send(array('result' => 'success', 'message' => sprintf($this->lang->duplicate, $this->lang->task->common), 'locate' => $this->createLink('task', 'view', "taskID={$duplicateTaskID}")));
|
||||
|
||||
/* Create task. */
|
||||
$taskIdList = $this->task->create($task, $this->post->assignedTo, (int)$this->post->multiple, $this->post->team, (bool)$this->post->selectTestStory, $this->post->teamSource, $this->post->teamEstimate, $this->post->teamConsumed, $this->post->teamLeft);
|
||||
|
||||
+14
-14
@@ -113,7 +113,7 @@ class taskZen extends task
|
||||
{
|
||||
if($change['field'] == 'status')
|
||||
{
|
||||
$confirmURL = $this->createLink('bug', 'view', "id=$task->fromBug");
|
||||
$confirmURL = $this->createLink('bug', 'view', "id={$task->fromBug}");
|
||||
$cancelURL = $this->server->HTTP_REFERER;
|
||||
return print(js::confirm(sprintf($this->lang->task->remindBug, $task->fromBug), $confirmURL, $cancelURL, 'parent', 'parent'));
|
||||
}
|
||||
@@ -123,7 +123,7 @@ class taskZen extends task
|
||||
if(isonlybody()) return $this->reponseKanban($task, $from);
|
||||
|
||||
if(defined('RUN_MODE') && RUN_MODE == 'api') return array('status' => 'success', 'data' => $taskID);
|
||||
return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
|
||||
return print(js::locate($this->createLink('task', 'view', "{taskID=$taskID}"), 'parent'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -228,7 +228,7 @@ class taskZen extends task
|
||||
$task = $this->task->getById($taskID);
|
||||
if(isonlybody()) return $this->reponseKanban($task, $from);
|
||||
|
||||
return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
|
||||
return print(js::locate($this->createLink('task', 'view', "{taskID=$taskID}"), 'parent'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -286,7 +286,7 @@ class taskZen extends task
|
||||
$kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $execLaneType, 'id_desc', 0, $execGroupBy, $rdSearchValue);
|
||||
$kanbanData = json_encode($kanbanData);
|
||||
|
||||
return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)"));
|
||||
return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban({$kanbanData})"));
|
||||
}
|
||||
if($from == 'taskkanban')
|
||||
{
|
||||
@@ -296,7 +296,7 @@ class taskZen extends task
|
||||
$kanbanData = $kanbanData[$kanbanType];
|
||||
$kanbanData = json_encode($kanbanData);
|
||||
|
||||
return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", $kanbanData)"));
|
||||
return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban(\"task\", {$kanbanData})"));
|
||||
}
|
||||
return print(js::closeModal('parent.parent', 'this'));
|
||||
}
|
||||
@@ -660,7 +660,7 @@ class taskZen extends task
|
||||
{
|
||||
$kanbanData = $this->getKanbanData($execution);
|
||||
$response['closeModal'] = true;
|
||||
$response['callback'] = $execution->type == 'kanban' ? "parent.updateKanban($kanbanData, 0)" : "parent.updateKanban(\"task\", $kanbanData)";
|
||||
$response['callback'] = $execution->type == 'kanban' ? "parent.updateKanban({$kanbanData}, 0)" : "parent.updateKanban(\"task\", {$kanbanData})";
|
||||
return $response;
|
||||
}
|
||||
$response['locate'] = 'parent';
|
||||
@@ -693,7 +693,7 @@ class taskZen extends task
|
||||
/* Set the universal return value. */
|
||||
$response['result'] = 'success';
|
||||
$response['message'] = $this->lang->saveSuccess;
|
||||
$response['locate'] = $this->createLink('execution', 'browse', "executionID=$executionID&tab=task");
|
||||
$response['locate'] = $this->createLink('execution', 'browse', "executionID={$executionID}&tab=task");
|
||||
|
||||
/* Set the response to continue adding task to story. */
|
||||
$executionID = $task->execution;
|
||||
@@ -702,22 +702,22 @@ class taskZen extends task
|
||||
$storyID = $task->story ? $task->story : 0;
|
||||
$moduleID = $task->module ? $task->module : 0;
|
||||
$response['message'] = $this->lang->task->successSaved . $this->lang->task->afterChoices['continueAdding'];
|
||||
$response['locate'] = $this->createLink('task', 'create', "executionID=$executionID&storyID=$storyID&moduleID=$moduleID");
|
||||
$response['locate'] = $this->createLink('task', 'create', "executionID={$executionID}&storyID={$storyID}&moduleID={$moduleID}");
|
||||
}
|
||||
/* Set the response to return task list. */
|
||||
elseif($afterChoice == 'toTaskList')
|
||||
{
|
||||
setcookie('moduleBrowseParam', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, true);
|
||||
$response['locate'] = $this->createLink('execution', 'task', "executionID=$executionID&status=unclosed¶m=0&orderBy=id_desc");
|
||||
$response['locate'] = $this->createLink('execution', 'task', "executionID={$executionID}&status=unclosed¶m=0&orderBy=id_desc");
|
||||
}
|
||||
/* Set the response to return story list. */
|
||||
elseif($afterChoice == 'toStoryList')
|
||||
{
|
||||
$response['locate'] = $this->createLink('execution', 'story', "executionID=$executionID");
|
||||
$response['locate'] = $this->createLink('execution', 'story', "executionID={$executionID}");
|
||||
if($this->config->vision == 'lite')
|
||||
{
|
||||
$projectID = $this->execution->getProjectID($executionID);
|
||||
$response['locate'] = $this->createLink('projectstory', 'story', "projectID=$projectID");
|
||||
$response['locate'] = $this->createLink('projectstory', 'story', "projectID={$projectID}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -762,7 +762,7 @@ class taskZen extends task
|
||||
$this->view->showAllModule = $showAllModule;
|
||||
$this->view->moduleOptionMenu = $moduleOptionMenu;
|
||||
$this->view->showFields = $this->config->task->custom->createFields;
|
||||
$this->view->gobackLink = (isset($output['from']) && $output['from'] == 'global') ? $this->createLink('execution', 'task', "executionID=$executionID") : '';
|
||||
$this->view->gobackLink = (isset($output['from']) && $output['from'] == 'global') ? $this->createLink('execution', 'task', "executionID={$executionID}") : '';
|
||||
$this->view->execution = $execution;
|
||||
$this->view->task = $task;
|
||||
$this->view->storyID = $storyID;
|
||||
@@ -1046,7 +1046,7 @@ class taskZen extends task
|
||||
if($execution->lifetime == 'ops' or $execution->attribute == 'request' or $execution->attribute == 'review')
|
||||
{
|
||||
unset($customFields['story']);
|
||||
$showFields = str_replace(',story,', ',', ",$showFields,");
|
||||
$showFields = str_replace(',story,', ',', ",{$showFields},");
|
||||
$showFields = trim($showFields, ',');
|
||||
}
|
||||
|
||||
@@ -1128,7 +1128,7 @@ class taskZen extends task
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = $this->createLink('execution', 'browse', "executionID=$execution->id");
|
||||
$link = $this->createLink('execution', 'browse', "executionID={$execution->id}");
|
||||
}
|
||||
|
||||
return $link;
|
||||
|
||||
Reference in New Issue
Block a user