From eb63a1788588954763966a5098d1ed46e1c17d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Fri, 19 Nov 2021 09:08:03 +0800 Subject: [PATCH 01/14] * code for task #44313. --- api/v1/entries/productprojects.php | 128 +++++++++++++++++++++++++++++ config/routes.php | 9 +- module/product/control.php | 5 +- module/product/model.php | 9 +- module/testcase/model.php | 2 +- 5 files changed, 143 insertions(+), 10 deletions(-) create mode 100644 api/v1/entries/productprojects.php diff --git a/api/v1/entries/productprojects.php b/api/v1/entries/productprojects.php new file mode 100644 index 0000000000..6af80adba3 --- /dev/null +++ b/api/v1/entries/productprojects.php @@ -0,0 +1,128 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + */ +class productProjectsEntry extends entry +{ + /** + * GET method. + * + * @param int $productID + * @access public + * @return void + */ + public function get($productID = 0) + { + if(empty($productID)) $productID = $this->param('product', 0); + if(empty($productID)) return $this->sendError('400', "Need product id"); + $appendFields = $this->param('fields', ''); + + $control = $this->loadController('product', 'project'); + $control->project($this->param('status', 'all'), $productID, $this->param('branch', 0), $this->param('involved', 0), $this->param('order', 'order_desc')); + $data = $this->getData(); + + if(isset($data->status) and $data->status == 'success') + { + $result = array(); + foreach($data->data->projectStats as $project) + { + foreach($project->hours as $field => $value) $project->$field = $value; + + $project = $this->filterFields($project, 'id,name,code,model,type,budget,budgetUnit,parent,begin,end,status,openedBy,openedDate,PM,delay,progress,' . $appendFields); + $result[] = $this->format($project, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time'); + } + + $data = array(); + $data['total'] = count($result); + $data['projects'] = $result; + + $withUser = $this->param('withUser', ''); + if(!empty($withUser)) $data['users'] = $users; + + return $this->send(200, $data); + } + + if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); + + // TODO There is no handle for 401. + return $this->sendError(400, 'error'); + } + + /** + * POST method. + * + * @access public + * @return void + */ + public function post() + { + $fields = 'name,begin,end,products'; + $this->batchSetPost($fields); + + $this->setPost('code', $this->request('code', '')); + $this->setPost('acl', $this->request('acl', 'private')); + $this->setPost('parent', $this->request('program', 0)); + $this->setPost('whitelist', $this->request('whitelist', array())); + $this->setPost('PM', $this->request('PM', '')); + $this->setPost('model', $this->request('model', 'scrum')); + + $control = $this->loadController('project', 'create'); + $this->requireFields('name,code,begin,end,products'); + + $control->create($this->request('model', 'scrum')); + + $data = $this->getData(); + if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); + if(!isset($data->result)) return $this->sendError(400, 'error'); + + $project = $this->loadModel('project')->getByID($data->id); + + $this->send(201, $this->format($project, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time')); + } + + /** + * Get drop menu. + * + * @access public + * @return void + */ + public function getDropMenu() + { + $control = $this->loadController('project', 'ajaxGetDropMenu'); + $control->ajaxGetDropMenu($this->request('projectID', 0), $this->request('module', 'project'), $this->request('method', 'browse')); + + $data = $this->getData(); + if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); + + $dropMenu = array('owner' => array(), 'other' => array(), 'closed' => array()); + foreach($data->data->projects as $programID => $projects) + { + foreach($projects as $project) + { + if(helper::diffDate(date('Y-m-d'), $project->end) > 0) $project->delay = true; + $project = $this->filterFields($project, 'id,model,type,name,code,parent,status,PM,delay'); + + if($project->status == 'closed') + { + $dropMenu['closed'][] = $project; + } + elseif($project->PM == $this->app->user->account) + { + $dropMenu['owner'][] = $project; + } + else + { + $dropMenu['other'][] = $project; + } + } + } + $this->send(200, $dropMenu); + } +} diff --git a/config/routes.php b/config/routes.php index 0a3d96dd15..2e44c76381 100644 --- a/config/routes.php +++ b/config/routes.php @@ -46,6 +46,7 @@ $routes['/bugs'] = 'bugs'; $routes['/bugs/:id'] = 'bug'; $routes['/programs/:id/projects'] = 'projects'; +$routes['/products/:id/projects'] = 'productProjects'; $routes['/projects'] = 'projects'; $routes['/projects/:id'] = 'project'; @@ -69,10 +70,10 @@ $routes['/programs/:id'] = 'program'; $routes['/programs/:id/stakeholders'] = 'stakeholders'; -$routes['/products/:productID/issues'] = 'productIssues'; -$routes['/projects/:projectID/issues'] = 'issues'; -$routes['/issues'] = 'issues'; -$routes['/issues/:issueID'] = 'issue'; +$routes['/products/:id/issues'] = 'productIssues'; +$routes['/projects/:id/issues'] = 'issues'; +$routes['/issues'] = 'issues'; +$routes['/issues/:issueID'] = 'issue'; $routes['/todos'] = 'todos'; $routes['/todos/:id'] = 'todo'; diff --git a/module/product/control.php b/module/product/control.php index b4b1afd4e3..9d737a4630 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -73,10 +73,11 @@ class product extends control * @param int $productID * @param int $branch * @param int $involved + * @param string $orderBy * @access public * @return void */ - public function project($status = 'all', $productID = 0, $branch = 0, $involved = 0) + public function project($status = 'all', $productID = 0, $branch = 0, $involved = 0, $orderBy = 'order_desc') { $this->app->loadLang('execution'); $this->app->loadLang('project'); @@ -85,7 +86,7 @@ class product extends control /* Get PM id list. */ $accounts = array(); - $projectStats = $this->product->getProjectStatsByProduct($productID, $status, $branch, $involved); + $projectStats = $this->product->getProjectStatsByProduct($productID, $status, $branch, $involved, $orderBy); foreach($projectStats as $project) { diff --git a/module/product/model.php b/module/product/model.php index 23fd17ea4c..63239c39b6 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -892,10 +892,11 @@ class productModel extends model * @param string $browseType * @param int $branch * @param int $involved + * @param string $orderBy * @access public * @return array */ - public function getProjectListByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0) + public function getProjectListByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0, $orderBy = 'order_desc') { $projectList = $this->dao->select('t2.*')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') @@ -912,6 +913,7 @@ class productModel extends model ->fi() ->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi() ->andWhere('t2.deleted')->eq('0') + ->orderBy($orderBy) ->fetchAll('id'); /* Determine how to display the name of the program. */ @@ -932,12 +934,13 @@ class productModel extends model * @param string $browseType * @param int $branch * @param int $involved + * @param string $orderBy * @access public * @return array */ - public function getProjectStatsByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0) + public function getProjectStatsByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0, $orderBy = 'order_desc') { - $projects = $this->getProjectListByProduct($productID, $browseType, $branch, $involved); + $projects = $this->getProjectListByProduct($productID, $browseType, $branch, $involved, $orderBy); if(empty($projects)) return array(); $projectKeys = array_keys($projects); diff --git a/module/testcase/model.php b/module/testcase/model.php index 8c0123742b..244e04d5fd 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -312,7 +312,7 @@ class testcaseModel extends model { return $this->dao->select('distinct t1.*, t2.*')->from(TABLE_PROJECTCASE)->alias('t1') ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case=t2.id') - ->leftJoin(TABLE_STORY)->alias('t3')->on('t1.story = t3.id') + ->leftJoin(TABLE_STORY)->alias('t3')->on('t2.story = t3.id') ->where('t1.project')->eq((int)$executionID) ->beginIF($browseType != 'all')->andWhere('t2.status')->eq($browseType)->fi() ->andWhere('t2.deleted')->eq('0') From 5afccaf4172a5cd414d18411466df56dd8624d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Fri, 19 Nov 2021 09:22:02 +0800 Subject: [PATCH 02/14] * code for task #44314. --- api/v1/entries/releases.php | 22 ++++++---------------- config/routes.php | 4 ++-- module/release/control.php | 5 +++-- module/release/model.php | 5 +++-- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/api/v1/entries/releases.php b/api/v1/entries/releases.php index 207da6b80d..688551ab67 100644 --- a/api/v1/entries/releases.php +++ b/api/v1/entries/releases.php @@ -15,26 +15,16 @@ class releasesEntry extends entry * GET method. * * @param int $productID - * @param int $projectID * @access public * @return void */ - public function get($productID = 0, $projectID = 0) + public function get($productID = 0) { - if(!$productID) $productID = $this->param('product'); - if(!$projectID) $projectID = $this->param('project'); - if(!$productID and !$projectID) return $this->sendError(400, 'Need product or project id.'); + if(empty($productID)) $productID = $this->param('product'); + if(empty($productID)) return $this->sendError(400, 'Need product id.'); - if($projectID) - { - $control = $this->loadController('projectrelease', 'browse'); - $control->browse($projectID, 0, $this->param('status', 'all')); - } - else - { - $control = $this->loadController('release', 'browse'); - $control->browse($productID, $this->param('branch', 0), $this->param('status', 'all')); - } + $control = $this->loadController('release', 'browse'); + $control->browse($productID, $this->param('branch', 0), $this->param('status', 'all'), $this->param('order', 't1.date_desc')); /* Response */ $data = $this->getData(); @@ -44,7 +34,7 @@ class releasesEntry extends entry $releases = $data->data->releases; foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date'); - return $this->send(200, array('releases' => $result)); + return $this->send(200, array('total' => count($result), 'releases' => $result)); } if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); diff --git a/config/routes.php b/config/routes.php index 2e44c76381..9fe83eef7e 100644 --- a/config/routes.php +++ b/config/routes.php @@ -28,8 +28,8 @@ $routes['/products/:id/plans'] = 'productPlans'; $routes['/productplans/:id'] = 'productPlan'; $routes['/releases'] = 'releases'; -$routes['/product/:id/releases'] = 'releases'; -$routes['/projects/:id/releases'] = 'projectreleases'; +$routes['/products/:id/releases'] = 'releases'; +$routes['/projects/:id/releases'] = 'projectReleases'; $routes['/releases/:id'] = 'release'; $routes['/stories'] = 'stories'; diff --git a/module/release/control.php b/module/release/control.php index 346f0c06d3..6b381f4de1 100644 --- a/module/release/control.php +++ b/module/release/control.php @@ -37,17 +37,18 @@ class release extends control * @param int $productID * @param int $branch * @param string $type + * @param string $orderBy * @access public * @return void */ - public function browse($productID, $branch = 0, $type = 'all') + public function browse($productID, $branch = 0, $type = 'all', $orderBy = 't1.date_desc') { $this->commonAction($productID, $branch); $this->session->set('releaseList', $this->app->getURI(true), 'product'); $this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->release->browse; $this->view->position[] = $this->lang->release->browse; - $this->view->releases = $this->release->getList($productID, $branch, $type); + $this->view->releases = $this->release->getList($productID, $branch, $type, $orderBy); $this->view->type = $type; $this->display(); } diff --git a/module/release/model.php b/module/release/model.php index da4afb63c3..afaaa2c65a 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -46,10 +46,11 @@ class releaseModel extends model * @param int $productID * @param int $branch * @param string $type + * @param string $orderBy * @access public * @return array */ - public function getList($productID, $branch = 0, $type = 'all') + public function getList($productID, $branch = 0, $type = 'all', $orderBy = 't1.date_desc') { return $this->dao->select('t1.*, t2.name as productName, t3.id as buildID, t3.name as buildName, t3.project, t4.name as projectName') ->from(TABLE_RELEASE)->alias('t1') @@ -60,7 +61,7 @@ class releaseModel extends model ->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi() ->beginIF($type != 'all')->andWhere('t1.status')->eq($type)->fi() ->andWhere('t1.deleted')->eq(0) - ->orderBy('t1.date DESC') + ->orderBy($orderBy) ->fetchAll(); } From b4757126904999e143f5a41ae1dfb9c86de8056a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Fri, 19 Nov 2021 09:41:18 +0800 Subject: [PATCH 03/14] * code for task #44322. --- api/v1/entries/builds.php | 7 ++++--- api/v1/entries/projectbugs.php | 2 +- module/build/model.php | 5 +++-- module/project/control.php | 8 +++++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/api/v1/entries/builds.php b/api/v1/entries/builds.php index e985d9fdb4..4ffa3eb258 100644 --- a/api/v1/entries/builds.php +++ b/api/v1/entries/builds.php @@ -20,10 +20,11 @@ class buildsEntry extends entry */ public function get($projectID = 0) { - if(!$projectID) $projectID = $this->param('project', 0); + if(empty($projectID)) $projectID = $this->param('project', 0); + if(empty($projectID)) return $this->sendError(400, "Need project id."); $control = $this->loadController('project', 'build'); - $control->build($projectID, $this->param('type', 'all'), $this->param('param', 0)); + $control->build($projectID, $this->param('type', 'all'), $this->param('param', 0), $this->param('order', 't1.date_desc,t1.id_desc')); $data = $this->getData(); if(!isset($data->status)) return $this->sendError(400, 'error'); @@ -38,7 +39,7 @@ class buildsEntry extends entry } } - return $this->send(200, $result); + return $this->send(200, array('total' => count($result), 'builds' => $result)); } /** diff --git a/api/v1/entries/projectbugs.php b/api/v1/entries/projectbugs.php index df5c2de092..f799f78d12 100644 --- a/api/v1/entries/projectbugs.php +++ b/api/v1/entries/projectbugs.php @@ -20,7 +20,7 @@ class projectBugsEntry extends entry */ public function get($projectID = 0) { - if(!$projectID) $projectID = $this->param('project', 0); + if(empty($projectID)) $projectID = $this->param('project', 0); if(empty($projectID)) return $this->sendError(400, 'Need project id.'); $control = $this->loadController('project', 'bug'); diff --git a/module/build/model.php b/module/build/model.php index 02ec44f684..93117a978f 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -55,10 +55,11 @@ class buildModel extends model * @param int $projectID * @param string $type * @param int $param + * @param string $orderBy * @access public * @return array */ - public function getProjectBuilds($projectID = 0, $type = 'all', $param = 0) + public function getProjectBuilds($projectID = 0, $type = 'all', $param = 0, $orderBy = 't1.date_desc,t1.id_desc') { return $this->dao->select('t1.*, t2.name as executionName, t2.id as executionID, t3.name as productName, t4.name as branchName') ->from(TABLE_BUILD)->alias('t1') @@ -70,7 +71,7 @@ class buildModel extends model ->andWhere('t1.project')->ne(0) ->beginIF($type == 'product' and $param)->andWhere('t1.product')->eq($param)->fi() ->beginIF($type == 'bysearch')->andWhere($param)->fi() - ->orderBy('t1.date DESC, t1.id desc') + ->orderBy($orderBy) ->fetchAll('id'); } diff --git a/module/project/control.php b/module/project/control.php index 991549a75c..6811205bb8 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1005,12 +1005,14 @@ class project extends control /** * Browse builds of a project. * + * @param int $projectID * @param string $type all|product|bysearch * @param int $param + * @param string $orderBy * @access public * @return void */ - public function build($projectID = 0, $type = 'all', $param = 0) + public function build($projectID = 0, $type = 'all', $param = 0, $orderBy = 't1.date_desc,t1.id_desc') { /* Load module and get project. */ $this->loadModel('build'); @@ -1036,11 +1038,11 @@ class project extends control if($type == 'bysearch') { - $builds = $this->build->getProjectBuildsBySearch((int)$projectID, (int)$param); + $builds = $this->build->getProjectBuildsBySearch((int)$projectID, (int)$param, $orderBy); } else { - $builds = $this->build->getProjectBuilds((int)$projectID, $type, $param); + $builds = $this->build->getProjectBuilds((int)$projectID, $type, $param, $orderBy); } /* Set project builds. */ From 4f5308aefacbf7d3a30a06777f4aea690ad372de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Fri, 19 Nov 2021 10:17:59 +0800 Subject: [PATCH 04/14] * code for task #44320. --- api/v1/entries/project.php | 4 +++ api/v1/entries/projectcases.php | 52 +++++++++++++++++++++++++++++++++ api/v1/entries/testcases.php | 22 ++++---------- config/routes.php | 3 +- 4 files changed, 63 insertions(+), 18 deletions(-) create mode 100644 api/v1/entries/projectcases.php diff --git a/api/v1/entries/project.php b/api/v1/entries/project.php index 9776cb1615..039515b15e 100644 --- a/api/v1/entries/project.php +++ b/api/v1/entries/project.php @@ -31,6 +31,10 @@ class projectEntry extends entry if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); $project = $this->format($data->data->project, 'begin:date,end:date,realBegan:date,realEnd:date,openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time,deleted:bool'); + + $this->loadModel('testcase'); + $project->caseReview = ($this->config->testcase->needReview or !empty($this->config->testcase->forceReview)); + if(empty($fields)) return $this->send(200, $project); /* Set other fields. */ diff --git a/api/v1/entries/projectcases.php b/api/v1/entries/projectcases.php new file mode 100644 index 0000000000..e459c8f7c7 --- /dev/null +++ b/api/v1/entries/projectcases.php @@ -0,0 +1,52 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + */ +class projectCasesEntry extends entry +{ + /** + * GET method. + * + * @param int $projectID + * @access public + * @return void + */ + public function get($projectID = 0) + { + if(!$projectID) $projectID = $this->param('project', 0); + if(empty($projectID)) return $this->sendError(400, 'Need project id.'); + + $this->app->tab = 'project'; + $this->app->session->set('project', $projectID, $this->app->tab); + + $control = $this->loadController('project', 'testcase'); + $control->testcase($projectID, $this->param('product', 0), $this->param('branch', 0), $this->param('status', 'all'), 0, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1)); + + $data = $this->getData(); + + if(isset($data->status) and $data->status == 'success') + { + $cases = $data->data->cases; + $pager = $data->data->pager; + $result = array(); + foreach($cases as $case) + { + $case->status = array('code' => $case->status, 'name' => $this->lang->testcase->statusList[$case->status]); + $result[] = $this->format($case, 'openedDate:time,reviewedDate:date,lastEditedDate:time,lastRunDate:time'); + } + + return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'cases' => $result)); + } + + if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); + + return $this->sendError(400, 'error'); + } +} diff --git a/api/v1/entries/testcases.php b/api/v1/entries/testcases.php index 90e273ea8d..a5b67f2144 100644 --- a/api/v1/entries/testcases.php +++ b/api/v1/entries/testcases.php @@ -15,28 +15,16 @@ class testcasesEntry extends entry * GET method. * * @param int $productID - * @param int $projectID - * @param int $executionID * @access public * @return void */ - public function get($productID = 0, $projectID = 0, $executionID = 0) + public function get($productID = 0) { - if(!$productID) $productID = $this->param('product', 0); - if(!$projectID) $projectID = $this->param('project', 0); - if(!$executionID) $executionID = $this->param('execution', 0); - if(!$productID and !$projectID and !$executionID) return $this->sendError(400, 'Need product or project or execution id.'); + if(empty($productID)) $productID = $this->param('product', 0); + if(empty($productID)) return $this->sendError(400, 'Need product id.'); - if($executionID) - { - $control = $this->loadController('execution', 'testcase'); - $control->testcase($executionID, $this->param('status', 'all'), $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1)); - } - else - { - $control = $this->loadController('testcase', 'browse'); - $control->browse($productID, $this->param('branch', ''), $this->param('status', 'all'), 0, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1), $projectID); - } + $control = $this->loadController('testcase', 'browse'); + $control->browse($productID, $this->param('branch', ''), $this->param('status', 'all'), 0, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1), $projectID); $data = $this->getData(); diff --git a/config/routes.php b/config/routes.php index 9fe83eef7e..1f1037cfa1 100644 --- a/config/routes.php +++ b/config/routes.php @@ -85,7 +85,8 @@ $routes['/builds'] = 'builds'; $routes['/builds/:id'] = 'build'; $routes['/products/:id/testcases'] = 'testcases'; -$routes['/executions/:id/testcases'] = 'executioncases'; +$routes['/projects/:id/testcases'] = 'projectCases'; +$routes['/executions/:id/testcases'] = 'executionCases'; $routes['/testcases'] = 'testcases'; $routes['/testcases/:id'] = 'testcase'; From e0f2e88048be7d2bee45caf34cf59b8ce11aa1f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Fri, 19 Nov 2021 10:34:50 +0800 Subject: [PATCH 05/14] * code for task #44323. --- api/v1/entries/projectreleases.php | 23 +++++++++++++++++++++-- module/projectrelease/control.php | 5 +++-- module/projectrelease/model.php | 5 +++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/api/v1/entries/projectreleases.php b/api/v1/entries/projectreleases.php index 325a8be9eb..af02e042fb 100644 --- a/api/v1/entries/projectreleases.php +++ b/api/v1/entries/projectreleases.php @@ -9,7 +9,7 @@ * @version 1 * @link http://www.zentao.net */ -class projectreleasesEntry extends entry +class projectReleasesEntry extends entry { /** * GET method. @@ -20,7 +20,26 @@ class projectreleasesEntry extends entry */ public function get($projectID = 0) { - $this->fetch('releases', 'get', array('productID' => 0, 'projectID' => $projectID)); + if(empty($projectID)) $projectID = $this->param('project'); + if(empty($projectID)) return $this->sendError(400, 'Need project id.'); + + $control = $this->loadController('projectrelease', 'browse'); + $control->browse($projectID, $this->param('execution', 0), $this->param('status', 'all'), $this->param('order', 't1.date_desc')); + + /* Response */ + $data = $this->getData(); + if(isset($data->status) and $data->status == 'success') + { + $result = array(); + $releases = $data->data->releases; + foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date'); + + return $this->send(200, array('total' => count($result), 'releases' => $result)); + } + + if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); + + return $this->sendError(400, 'error'); } /** diff --git a/module/projectrelease/control.php b/module/projectrelease/control.php index b2011200bf..423688abda 100644 --- a/module/projectrelease/control.php +++ b/module/projectrelease/control.php @@ -62,10 +62,11 @@ class projectrelease extends control * @param int $projectID * @param int $executionID * @param string $type + * @param string $orderBy * @access public * @return void */ - public function browse($projectID = 0, $executionID = 0, $type = 'all') + public function browse($projectID = 0, $executionID = 0, $type = 'all', $orderBy = 't1.date_desc') { $this->session->set('releaseList', $this->app->getURI(true), 'project'); $project = $this->project->getById($projectID); @@ -81,7 +82,7 @@ class projectrelease extends control $this->view->execution = $execution; $this->view->project = $project; $this->view->products = $this->loadModel('product')->getProducts($projectID); - $this->view->releases = $this->projectrelease->getList($projectID, $type); + $this->view->releases = $this->projectrelease->getList($projectID, $type, $orderBy); $this->view->projectID = $projectID; $this->view->executionID = $executionID; $this->view->type = $type; diff --git a/module/projectrelease/model.php b/module/projectrelease/model.php index 24558830bb..2ff48bdd3a 100644 --- a/module/projectrelease/model.php +++ b/module/projectrelease/model.php @@ -45,10 +45,11 @@ class projectreleaseModel extends model * * @param int $projectID * @param string $type + * @param string $orderBy * @access public * @return array */ - public function getList($projectID, $type = 'all') + public function getList($projectID, $type = 'all', $orderBy = 't1.date_desc') { return $this->dao->select('t1.*, t2.name as productName, t3.id as buildID, t3.name as buildName, t3.execution, t4.name as executionName') ->from(TABLE_RELEASE)->alias('t1') @@ -58,7 +59,7 @@ class projectreleaseModel extends model ->where('t1.project')->eq((int)$projectID) ->beginIF($type != 'all')->andWhere('t1.status')->eq($type)->fi() ->andWhere('t1.deleted')->eq(0) - ->orderBy('t1.date DESC') + ->orderBy($orderBy) ->fetchAll(); } From 7dbcf304d19f0d5be2fb6f8dc4fa387a40639c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Fri, 19 Nov 2021 11:04:30 +0800 Subject: [PATCH 06/14] * code for task #44334. --- api/v1/entries/bugs.php | 61 +++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/api/v1/entries/bugs.php b/api/v1/entries/bugs.php index d3fdb496c6..e0fec1d8b6 100644 --- a/api/v1/entries/bugs.php +++ b/api/v1/entries/bugs.php @@ -9,42 +9,22 @@ * @version 1 * @link http://www.zentao.net */ -class bugsEntry extends entry +class bugsEntry extends entry { /** * GET method. * * @param int $productID - * @param int $projectID - * @param int $executionID * @access public * @return void */ - public function get($productID = 0, $projectID = 0, $executionID = 0) + public function get($productID = 0) { - if(!$productID) $productID = $this->param('product', 0); - if(!$projectID) $projectID = $this->param('project', 0); - if(!$executionID) $executionID = $this->param('execution', 0); + if(empty($productID)) $productID = $this->param('product', 0); + if(empty($productID)) return $this->sendError(400, 'Need product id.'); - if($projectID) - { - $control = $this->loadController('project', 'bug'); - $control->bug($projectID, $productID, $this->param('order', 'status,id_desc'), $this->param('build', 0), $this->param('status', 'all'), 0, $this->param('limit', 20), $this->param('page', 1)); - } - elseif($executionID) - { - $control = $this->loadController('execution', 'bug'); - $control->bug($executionID, $productID, $this->param('order', 'status,id_desc'), $this->param('build', 0), $this->param('status', 'all'), 0, $this->param('limit', 20), $this->param('page', 1)); - } - elseif($productID) - { - $control = $this->loadController('bug', 'browse'); - $control->browse($productID, $this->param('branch', ''), $this->param('status', ''), 0, $this->param('order', ''), 0, $this->param('limit', 20), $this->param('page', 1)); - } - else - { - return $this->sendError(400, 'Need product or project or execution id.'); - } + $control = $this->loadController('bug', 'browse'); + $control->browse($productID, $this->param('branch', ''), $this->param('status', 'unclosed'), 0, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1)); $data = $this->getData(); @@ -55,16 +35,31 @@ class bugsEntry extends entry $result = array(); foreach($bugs as $bug) { - $result[] = $this->format($bug, 'activatedDate:time,openedDate:time,assignedDate:time,resolvedDate:time,closedDate:time,lastEditedDate:time,deadline:date,deleted:bool'); + $status = array('code' => $bug->status, 'name' => $this->lang->bug->statusList[$bug->status]); + if($bug->status == 'active' and $bug->confirmed) $status = array('code' => 'confirmed', 'name' => $this->lang->bug->labelConfirmed); + if($bug->resolution == 'postponed') $status = array('code' => 'postponed', 'name' => $this->lang->bug->labelPostponed); + if(!empty($bug->delay)) $status = array('code' => 'delay', 'name' => $this->lang->bug->overdueBugs); + $bug->status = $status; + + $result[$bug->id] = $this->format($bug, 'activatedDate:time,openedDate:time,assignedDate:time,resolvedDate:time,closedDate:time,lastEditedDate:time,deadline:date,deleted:bool'); } - return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'bugs' => $result)); + $storyChangeds = $this->dao->select('t1.id')->from(TABLE_BUG)->alias('t1') + ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id') + ->where('t1.id')->in(array_keys($result)) + ->andWhere('t1.story')->ne('0') + ->andWhere('t1.storyVersion != t2.version') + ->fetchPairs('id', 'id'); + foreach($storyChangeds as $bugID) + { + $status = array('code' => 'storyChanged', 'name' => $this->lang->bug->changed); + $result[$bugID]->status = $status; + } + + return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'bugs' => array_values($result))); } - if(isset($data->status) and $data->status == 'fail') - { - return $this->sendError(400, $data->message); - } + if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); return $this->sendError(400, 'error'); } @@ -91,7 +86,7 @@ class bugsEntry extends entry $this->requireFields('title,pri,severity,type,openedBuild'); $control->create($productID); - + $data = $this->getData(); if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); if(isset($data->result) and !isset($data->id)) return $this->sendError(400, $data->message); From c849afe0cd8da9b530dc1f1134fbb0e466f09fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Fri, 19 Nov 2021 15:55:13 +0800 Subject: [PATCH 07/14] * code for task #44324. --- api/v1/entries/meetings.php | 80 +++++++++++++++++++++++++++++++++++++ config/routes.php | 4 ++ 2 files changed, 84 insertions(+) create mode 100644 api/v1/entries/meetings.php diff --git a/api/v1/entries/meetings.php b/api/v1/entries/meetings.php new file mode 100644 index 0000000000..8f077f0852 --- /dev/null +++ b/api/v1/entries/meetings.php @@ -0,0 +1,80 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + */ +class meetingsEntry extends entry +{ + /** + * GET method. + * + * @param int $projectID + * @access public + * @return void + */ + public function get($projectID = 0) + { + if(empty($projectID)) $projectID = $this->param('project', 0); + if(empty($projectID)) return $this->sendError(400, 'Need project id.'); + + $project = $this->loadModel('project')->getByID($projectID); + if(!$project) return $this->send404(); + + /* Get meetings by project. */ + $control = $this->loadController('meeting', 'browse'); + $control->browse($projectID, $this->param('status', 'all'), '', $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1)); + $data = $this->getData(); + + if(!isset($data->status)) return $this->sendError(400, 'error'); + if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); + + $pager = $data->data->pager; + $result = array(); + foreach($data->data->meetings as $risk) + { + $result[] = $this->format($risk, 'createdDate:time,editedDate:time'); + } + + return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'meetings' => $result)); + } + + /** + * POST method. + * + * @param int $projectID + * @access public + * @return void + */ + public function post($projectID = 0) + { + $project = $this->loadModel('project')->getByID($projectID); + if(!$project) return $this->send404(); + + $fields = 'source,name,category,strategy,status,impact,probability,rate,identifiedDate,plannedClosedDate,actualClosedDate,resolvedBy,assignedTo,prevention,remedy,resolution'; + $this->batchSetPost($fields); + + $this->setPost('impact', $this->request('impact', 3)); + $this->setPost('probability', $this->request('probability', 3)); + $this->setPost('rate', $this->request('rate', 9)); + $this->setPost('pri', 'middle'); + + $control = $this->loadController('risk', 'create'); + $this->requireFields('name'); + + $control->create($projectID); + + $data = $this->getData(); + if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); + if(isset($data->result) and !isset($data->id)) return $this->sendError(400, $data->message); + + $risk = $this->loadModel('risk')->getByID($data->id); + + $this->send(201, $this->format($risk, 'createdDate:time,editedDate:time')); + } +} diff --git a/config/routes.php b/config/routes.php index 1f1037cfa1..3384a81bf9 100644 --- a/config/routes.php +++ b/config/routes.php @@ -98,6 +98,10 @@ $routes['/projects/:projectID/risks'] = 'risks'; $routes['/risks'] = 'risks'; $routes['/risks/:id'] = 'risk'; +$routes['/projects/:id/meetings'] = 'meetings'; +$routes['/meetings'] = 'meetings'; +$routes['/meetings/:id'] = 'meeting'; + $routes['/departments'] = 'departments'; $routes['/departments/:id'] = 'department'; From 4ec1fd0f4c3abeaac3a049bf13f54f0a053d7882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Fri, 19 Nov 2021 15:56:25 +0800 Subject: [PATCH 08/14] * adjust for merge program children. --- api/v1/entries/programs.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/v1/entries/programs.php b/api/v1/entries/programs.php index 0333e849b5..28989e0af5 100644 --- a/api/v1/entries/programs.php +++ b/api/v1/entries/programs.php @@ -32,13 +32,13 @@ class programsEntry extends Entry if(!$data or !isset($data->status)) return $this->sendError(400, 'error'); if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); - $programs = (array)$data->data->programs; - $progressList = (array)$data->data->progressList; + $programs = $data->data->programs; + $progressList = $data->data->progressList; $users = $data->data->users; $result = array(); foreach($programs as $program) { - if(isset($progressList[$program->id])) $program->progress = $progressList[$program->id]; + if(isset($progressList->{$program->id})) $program->progress = $progressList->{$program->id}; $param = $this->format($program, 'begin:date,end:date,realBegan:date,realEnd:date,openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time,deleted:bool'); if($mergeChildren) @@ -57,9 +57,9 @@ class programsEntry extends Entry $program->labelBudget = $program->budget != 0 ? zget($this->lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $this->lang->project->future; if(empty($program->parent)) $result[$program->id] = $program; - if(isset($programs[$program->parent])) + if(isset($programs->{$program->parent})) { - $parentProgram = $programs[$program->parent]; + $parentProgram = $programs->{$program->parent}; if(!isset($parentProgram->children)) $parentProgram->children = array(); $parentProgram->children[] = $program; } From 73aa790f646713adc3c75c57fa81ff97fef627fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Mon, 22 Nov 2021 14:45:09 +0800 Subject: [PATCH 09/14] * remove files lib in api. --- api/v1/entries/doclibs.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/api/v1/entries/doclibs.php b/api/v1/entries/doclibs.php index b41d8270f4..f9131fe3b7 100644 --- a/api/v1/entries/doclibs.php +++ b/api/v1/entries/doclibs.php @@ -33,11 +33,6 @@ class doclibsEntry extends Entry } krsort($result); - $lib = new stdclass(); - $lib->id = 'files'; - $lib->name = $this->lang->doclib->files; - $result[] = $lib; - return $this->send(200, array('libs' => array_values($result))); } } From 0e6e41d003f141b44589944c8e49fd69f2d604bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Mon, 22 Nov 2021 15:21:43 +0800 Subject: [PATCH 10/14] * fix bug for get needconfirm case. --- module/testcase/model.php | 1 - 1 file changed, 1 deletion(-) diff --git a/module/testcase/model.php b/module/testcase/model.php index 244e04d5fd..e698a8df4d 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -314,7 +314,6 @@ class testcaseModel extends model ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case=t2.id') ->leftJoin(TABLE_STORY)->alias('t3')->on('t2.story = t3.id') ->where('t1.project')->eq((int)$executionID) - ->beginIF($browseType != 'all')->andWhere('t2.status')->eq($browseType)->fi() ->andWhere('t2.deleted')->eq('0') ->andWhere('t3.version > t2.storyVersion') ->andWhere("t3.status")->eq('active') From 4f50602fdaf9b22b4bceff3f4550baa14e027cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Tue, 23 Nov 2021 11:05:00 +0800 Subject: [PATCH 11/14] * adjust for progress. --- module/my/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/my/model.php b/module/my/model.php index 57ea22b967..21028cfc01 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -192,7 +192,7 @@ class myModel extends model foreach($myProjects as $key => $project) { $workhour = $this->project->getWorkhour($project->id); - $project->progress = ($workhour->totalConsumed + $workhour->totalLeft) ? floor($workhour->totalConsumed / ($workhour->totalConsumed + $workhour->totalLeft) * 1000) / 1000 * 100 : 0; + $project->progress = ($workhour->totalConsumed + $workhour->totalLeft) ? round($workhour->totalConsumed / ($workhour->totalConsumed + $workhour->totalLeft) * 100, 1) : 0; $project->delay = (helper::diffDate(helper::today(), $project->end) > 0); $project->link = common::hasPriv('project', 'view') ? helper::createLink('project', 'view', "projectID={$project->id}") : ''; } From c7d94a770eb0493681c5f0858c5f5df9375807ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Tue, 23 Nov 2021 11:21:02 +0800 Subject: [PATCH 12/14] * add lang for mobile api. --- module/bug/lang/zh-cn.php | 1 + module/common/lang/zh-cn.php | 1 + module/execution/lang/zh-cn.php | 1 + module/product/lang/zh-cn.php | 2 ++ module/testtask/lang/zh-cn.php | 2 ++ 5 files changed, 7 insertions(+) diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php index ec0e6032b1..198dad5d1a 100644 --- a/module/bug/lang/zh-cn.php +++ b/module/bug/lang/zh-cn.php @@ -182,6 +182,7 @@ $lang->bug->legendComment = '备注'; $lang->bug->legendLife = 'Bug的一生'; $lang->bug->legendMisc = '其他相关'; $lang->bug->legendRelated = '其他信息'; +$lang->bug->legendThisWeekCreated = '本周新增'; /* 功能按钮。*/ $lang->bug->buttonConfirm = '确认'; diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index a1b7929efb..6c24b35a1c 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -104,6 +104,7 @@ $lang->customMenu = '自定义导航'; $lang->customField = '自定义表单项'; $lang->lineNumber = '行号'; $lang->tutorialConfirm = '检测到你尚未退出新手教程模式,是否现在退出?'; +$lang->levelExceeded = '层级已超过显示范围,更多信息请前往网页端查看或者是通过搜索方式查看。'; $lang->preShortcutKey = '[快捷键:←]'; $lang->nextShortcutKey = '[快捷键:→]'; diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php index ce76413e38..8c5dfaf4a4 100644 --- a/module/execution/lang/zh-cn.php +++ b/module/execution/lang/zh-cn.php @@ -101,6 +101,7 @@ $lang->execution->copyNoExecution = '没有可用的' . $lang->executionCommon . $lang->execution->noTeam = '暂时没有团队成员'; $lang->execution->or = '或'; $lang->execution->selectProject = '请选择项目'; +$lang->execution->unfoldClosed = '展开已结束'; /* Fields of zt_team. */ $lang->execution->root = '源ID'; diff --git a/module/product/lang/zh-cn.php b/module/product/lang/zh-cn.php index 1c06dcdf85..c52d630b8b 100644 --- a/module/product/lang/zh-cn.php +++ b/module/product/lang/zh-cn.php @@ -55,6 +55,7 @@ $lang->product->project = $lang->executionCommon . '列表'; $lang->product->build = '版本列表'; $lang->product->moreProduct = "更多产品"; $lang->product->projectInfo = "所有与此产品关联的项目"; +$lang->product->progress = "产品完成度"; $lang->product->currentExecution = "当前执行"; $lang->product->activeStories = "激活{$lang->SRCommon}"; @@ -77,6 +78,7 @@ $lang->product->assignToNullBugs = '未指派Bug'; $lang->product->assignToNullBugsTitle = '未指派Bug'; $lang->product->closedBugs = '关闭Bug'; $lang->product->bugFixedRate = 'Bug修复率'; +$lang->product->unfoldClosed = '展开已关闭'; $lang->product->confirmDelete = " 您确定删除该{$lang->productCommon}吗?"; $lang->product->errorNoProduct = "还没有创建{$lang->productCommon}!"; diff --git a/module/testtask/lang/zh-cn.php b/module/testtask/lang/zh-cn.php index 055299fde0..566d2b28f3 100644 --- a/module/testtask/lang/zh-cn.php +++ b/module/testtask/lang/zh-cn.php @@ -37,9 +37,11 @@ $lang->testtask->next = '下一个'; $lang->testtask->start = "开始"; $lang->testtask->close = "关闭"; $lang->testtask->wait = "待测测试单"; +$lang->testtask->waitAB = "待测试"; $lang->testtask->block = "阻塞"; $lang->testtask->activate = "激活"; $lang->testtask->testing = "测试中测试单"; +$lang->testtask->testingAB = "测试中"; $lang->testtask->blocked = "被阻塞测试单"; $lang->testtask->done = "已测测试单"; $lang->testtask->totalStatus = "全部"; From 11e5d04bf7a42232cb161736eca94a9982173353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Tue, 23 Nov 2021 13:47:12 +0800 Subject: [PATCH 13/14] * fix bug #16439. --- module/program/model.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/module/program/model.php b/module/program/model.php index d053f2370d..e682cf9849 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -440,21 +440,24 @@ class programModel extends model $path = $program->path; } - $projectList = $this->dao->select('*')->from(TABLE_PROJECT) - ->where('deleted')->eq('0') - ->beginIF($this->config->systemMode == 'new')->andWhere('type')->eq('project')->fi() - ->beginIF($browseType != 'all' and $browseType != 'undone')->andWhere('status')->eq($browseType)->fi() - ->beginIF($browseType == 'undone')->andWhere('status')->in('wait,doing')->fi() - ->beginIF($path)->andWhere('path')->like($path . '%')->fi() - ->beginIF(!$queryAll and !$this->app->user->admin and $this->config->systemMode == 'new')->andWhere('id')->in($this->app->user->view->projects)->fi() - ->beginIF(!$queryAll and !$this->app->user->admin and $this->config->systemMode == 'classic')->andWhere('id')->in($this->app->user->view->sprints)->fi() + $projectList = $this->dao->select('t1.*')->from(TABLE_PROJECT)->alias('t1') + ->leftJoin(TABLE_TEAM)->alias('t2')->on('t1.id=t2.root') + ->where('t1.deleted')->eq('0') + ->beginIF($this->config->systemMode == 'new')->andWhere('t1.type')->eq('project')->fi() + ->beginIF($this->config->systemMode == 'new')->andWhere('t2.type')->eq('project')->fi() + ->beginIF($browseType != 'all' and $browseType != 'undone')->andWhere('t1.status')->eq($browseType)->fi() + ->beginIF($browseType == 'undone')->andWhere('t1.status')->in('wait,doing')->fi() + ->beginIF($path)->andWhere('t1.path')->like($path . '%')->fi() + ->beginIF(!$queryAll and !$this->app->user->admin and $this->config->systemMode == 'new')->andWhere('t1.id')->in($this->app->user->view->projects)->fi() + ->beginIF(!$queryAll and !$this->app->user->admin and $this->config->systemMode == 'classic')->andWhere('t1.id')->in($this->app->user->view->sprints)->fi() ->beginIF($this->cookie->involved or $involved) - ->andWhere('openedBy', true)->eq($this->app->user->account) - ->orWhere('PM')->eq($this->app->user->account) + ->andWhere('t1.openedBy', true)->eq($this->app->user->account) + ->orWhere('t1.PM')->eq($this->app->user->account) + ->orWhere('t2.account')->eq($this->app->user->account) ->markRight(1) ->fi() ->orderBy($orderBy) - ->page($pager) + ->page($pager, 't1.id') ->fetchAll('id'); /* Determine how to display the name of the program. */ From 57c6ae78a87e1c836688002aec619726dc5e4304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Wed, 24 Nov 2021 14:24:35 +0800 Subject: [PATCH 14/14] * adjust for search. --- module/search/model.php | 2 +- module/user/control.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/module/search/model.php b/module/search/model.php index 5fb8555fad..442883203c 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -266,7 +266,7 @@ class searchModel extends model if($hasUser) { - $users = $this->loadModel('user')->getPairs('realname|noclosed', $appendUsers); + $users = $this->loadModel('user')->getPairs('realname|noclosed', $appendUsers, $this->config->maxCount); $users['$@me'] = $this->lang->search->me; } if($hasProduct) $products = array('' => '') + $this->loadModel('product')->getPairs('', $this->session->project); diff --git a/module/user/control.php b/module/user/control.php index 3ee1712a98..a9f281c40f 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -1253,6 +1253,7 @@ class user extends control $limit = $this->get->limit; $index = 0; $newUsers = array(); + if(empty($search)) return array(); foreach($users as $account => $realname) { if($index >= $limit) break;