* Adjust code style.

This commit is contained in:
tianshujie98
2020-12-10 09:31:02 +08:00
parent 69e8548c1b
commit 4b95dd37d9
6 changed files with 18 additions and 10 deletions
+7 -2
View File
@@ -21,6 +21,7 @@ class build extends control
*/
public function create($executionID, $productID = 0)
{
/* Create execution if no execution. */
if($executionID == 0)
{
die(js::locate($this->createLink('project', 'create'), 'parent'));
@@ -34,7 +35,7 @@ class build extends control
$this->executeHooks($buildID);
if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "parent.loadProjectBuilds($executionID)"));//Code for task #5126.
if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "parent.loadProjectBuilds($executionID)")); // Code for task #5126.
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('build', 'view', "buildID=$buildID")));
}
@@ -42,6 +43,7 @@ class build extends control
$this->loadModel('project');
$this->loadModel('user');
/* Set session and get execution by id. */
$this->session->set('buildCreate', $this->app->getURI(true));
$execution = $this->loadModel('project')->getExecutionById($executionID);
@@ -162,6 +164,7 @@ class build extends control
*/
public function view($buildID, $type = 'story', $link = 'false', $param = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 100, $pageID = 1)
{
/* Set session and load modules. */
if($type == 'story')$this->session->set('storyList', $this->app->getURI(true));
if($type == 'bug') $this->session->set('bugList', $this->app->getURI(true));
@@ -172,7 +175,7 @@ class build extends control
$this->app->loadClass('pager', $static = true);
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
/* Set menu. */
/* Get build, product and bugs. */
$build = $this->build->getByID((int)$buildID, true);
if(!$build) die(js::error($this->lang->notFound) . js::locate('back'));
@@ -185,6 +188,7 @@ class build extends control
->page($bugPager)
->fetchAll();
/* Get stories and stages. */
$storyPager = new pager($type == 'story' ? $recTotal : 0, $recPerPage, $type == 'story' ? $pageID : 1);
$stories = $this->dao->select('*')->from(TABLE_STORY)->where('id')->in($build->stories)->andWhere('deleted')->eq(0)
->beginIF($type == 'story')->orderBy($orderBy)->fi()
@@ -193,6 +197,7 @@ class build extends control
$stages = $this->dao->select('*')->from(TABLE_STORYSTAGE)->where('story')->in($build->stories)->andWhere('branch')->eq($build->branch)->fetchPairs('story', 'stage');
foreach($stages as $storyID => $stage)$stories[$storyID]->stage = $stage;
/* Set menu. */
$this->loadModel('project')->setMenu($this->project->getExecutionPairs($this->session->PRJ), $build->project, $buildID);
$projects = $this->project->getExecutionPairs($this->session->PRJ, 'all', 'empty');
+5 -3
View File
@@ -19,7 +19,7 @@ class buildModel extends model
* @param int $buildID
* @param bool $setImgSize
* @access public
* @return object
* @return object|bool
*/
public function getByID($buildID, $setImgSize = false)
{
@@ -495,9 +495,10 @@ class buildModel extends model
*/
public function unlinkStory($buildID, $storyID)
{
$build = $this->getByID($buildID);
$build = $this->getByID($buildID);
$build->stories = trim(str_replace(",$storyID,", ',', ",$build->stories,"), ',');
if($build->stories) $build->stories = ',' . $build->stories;
$this->dao->update(TABLE_BUILD)->set('stories')->eq($build->stories)->where('id')->eq((int)$buildID)->exec();
$this->loadModel('action')->create('story', $storyID, 'unlinkedfrombuild', '', $buildID, '', false);
}
@@ -558,9 +559,10 @@ class buildModel extends model
*/
public function unlinkBug($buildID, $bugID)
{
$build = $this->getByID($buildID);
$build = $this->getByID($buildID);
$build->bugs = trim(str_replace(",$bugID,", ',', ",$build->bugs,"), ',');
if($build->bugs) $build->bugs = ',' . $build->bugs;
$this->dao->update(TABLE_BUILD)->set('bugs')->eq($build->bugs)->where('id')->eq((int)$buildID)->exec();
$this->loadModel('action')->create('bug', $bugID, 'unlinkedfrombuild', '', $buildID, '', false);
}
+1
View File
@@ -443,6 +443,7 @@ class issue extends control
*/
public function view($issueID)
{
/* Set actions and get issue by id. */
$this->commonAction($issueID, 'issue');
$issue = $this->issue->getByID($issueID);
if(!$issue) die(js::error($this->lang->notFound) . js::locate('back'));
+3 -2
View File
@@ -66,12 +66,13 @@ class issueModel extends model
*
* @param int $issueID
* @access public
* @return object
* @return object|bool
*/
public function getByID($issueID)
{
$issue = $this->dao->select('*')->from(TABLE_ISSUE)->where('id')->eq($issueID)->andWhere('deleted')->eq('0')->fetch();
$issue = $this->dao->select('*')->from(TABLE_ISSUE)->where('id')->eq($issueID)->andWhere('deleted')->eq('0')->fetch();
if(!$issue) return false;
$issue->files = $this->loadModel('file')->getByObject('issue', $issue->id);
return $issue;
}
-1
View File
@@ -485,7 +485,6 @@ class productplan extends control
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
*
* @access public
* @return void
*/
+2 -2
View File
@@ -58,7 +58,7 @@ class projectModel extends model
* @param int $buildID
* @param string $extra
* @access public
* @return void
* @return bool
*/
public function setMenu($projects, $projectID, $buildID = 0, $extra = '')
{
@@ -125,7 +125,7 @@ class projectModel extends model
/* Set project module page nav. */
$label = $this->lang->project->index;
if($methodName == 'all') $label = $this->lang->project->allProjects;
if($methodName == 'all') $label = $this->lang->project->allProjects;
if($methodName == 'create' and $moduleName == 'project') $label = $this->lang->project->create;
$projectIndex = '<div class="btn-group angle-btn' . ((strpos('index|all|create', $methodName) !== false and $moduleName == 'project') ? ' active' : '') . '"><div class="btn-group"><button data-toggle="dropdown" type="button" class="btn">' . $label . ' <span class="caret"></span></button>';