From f734f15e7affacf1895eb9561ccbd032fb3fd6a4 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Fri, 11 Dec 2020 16:52:33 +0800 Subject: [PATCH] * Adjust code style. --- module/build/control.php | 2 +- module/build/model.php | 15 +++------------ module/build/view/edit.html.php | 4 ++-- module/task/control.php | 7 ++++--- module/task/model.php | 4 ++-- 5 files changed, 12 insertions(+), 20 deletions(-) diff --git a/module/build/control.php b/module/build/control.php index 23cec1c435..70e6ad3d4e 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -179,7 +179,7 @@ class build extends control $this->view->products = $products; $this->view->users = $this->loadModel('user')->getPairs('noletter', $build->builder); $this->view->build = $build; - $this->view->testtask = $this->dao->select('id')->from(TABLE_TESTTASK)->where('build')->eq($build->id)->andWhere('deleted')->eq(0)->fetch('id'); + $this->view->testtaskID = $this->dao->select('id')->from(TABLE_TESTTASK)->where('build')->eq($build->id)->andWhere('deleted')->eq(0)->fetch('id'); $this->display(); } diff --git a/module/build/model.php b/module/build/model.php index 311e92a7dc..4898e203a7 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -86,23 +86,14 @@ class buildModel extends model /* If there are saved query conditions, reset the session. */ if((int)$queryID) { - $buildQuery = $this->loadModel('search')->getQuery($queryID); - if($buildQuery) + $query = $this->loadModel('search')->getQuery($queryID); + if($query) { $this->session->set('projectBuildQuery', $query->sql); $this->session->set('projectBuildForm', $query->form); } - else - { - $this->session->set('projectBuildQuery', ' 1 = 1'); - } } - else - { - if($this->session->projectBuildQuery == false) $this->session->set('projectBuildQuery', ' 1 = 1'); - } - - $buildQuery = $this->session->projectBuildQuery; + if($this->session->projectBuildQuery == false) $this->session->set('projectBuildQuery', ' 1 = 1'); $buildQuery = $this->session->projectBuildQuery; diff --git a/module/build/view/edit.html.php b/module/build/view/edit.html.php index f4a16a210b..34ab3d3910 100644 --- a/module/build/view/edit.html.php +++ b/module/build/view/edit.html.php @@ -28,7 +28,7 @@ stories or $build->bugs or $testtask) $disabled = 'disabled'; + if($build->stories or $build->bugs or $testtaskID) $disabled = 'disabled'; ?>
product, "onchange='loadBranches(this.value);' class='form-control chosen' $disabled required");?> @@ -45,7 +45,7 @@ config->global->flow != 'onlyTest'):?> - + build->project;?> project, "class='form-control chosen' required $disabled");?> build->notice->changeProject;?> diff --git a/module/task/control.php b/module/task/control.php index 58868a0b75..2f8690e852 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -160,7 +160,7 @@ class task extends control elseif($this->post->after == 'toTaskList') { setcookie('moduleBrowseParam', 0, 0, $this->config->webRoot, '', false, false); - $taskLink = $this->createLink('project', 'task', "projectID=$projectID&status=bymodule¶m=$moduleID&orderBy=id_desc"); + $taskLink = $this->createLink('project', 'task', "projectID=$projectID&status=unclosed¶m=0&orderBy=id_desc"); $response['locate'] = $taskLink; $this->send($response); } @@ -1024,9 +1024,10 @@ class task extends control $changes = $this->task->close($taskID); if(dao::isError()) die(js::error(dao::getError())); - if(!empty($changes)) + if($this->post->comment != '' or !empty($changes)) { - $actionID = $this->action->create('task', $taskID, 'Closed', $this->post->comment); + $action = (!empty($changes)) ? 'Closed' : 'Commented'; + $actionID = $this->action->create('task', $taskID, $action, $this->post->comment); $this->action->logHistory($actionID, $changes); } diff --git a/module/task/model.php b/module/task/model.php index 72c12cd887..f439d6b1b1 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -1602,12 +1602,12 @@ class taskModel extends model * * @param int $taskID * @access public - * @return void + * @return array */ public function close($taskID) { $oldTask = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq($taskID)->fetch(); - if($oldTask->status == 'closed') return; + if($oldTask->status == 'closed') return array(); $now = helper::now(); $task = fixer::input('post')