From 68ac2499142e49009390cffdd671cf7762c1848e Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Tue, 27 Apr 2021 14:24:04 +0800 Subject: [PATCH 1/5] * Fix bug#12373. --- module/testreport/control.php | 12 ++++++++++++ module/testreport/view/view.html.php | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/module/testreport/control.php b/module/testreport/control.php index c76ccc0e8f..c82957a115 100644 --- a/module/testreport/control.php +++ b/module/testreport/control.php @@ -260,6 +260,18 @@ class testreport extends control die(js::locate('back')); } + if($this->app->openApp == 'qa') + { + $productID = $this->product->saveState(key($productIdList), $this->products); + $this->loadModel('qa')->setMenu($this->products, $productID); + } + elseif($this->app->openApp == 'project') + { + $projects = $this->project->getPairsByProgram(); + $projectID = $this->project->saveState($execution->project, $projects); + $this->project->setMenu($projectID); + } + $builds = $this->build->getByList($buildIdList); $stories = !empty($builds) ? $this->testreport->getStories4Test($builds) : $this->story->getExecutionStories($execution->id);; diff --git a/module/testreport/view/view.html.php b/module/testreport/view/view.html.php index 56c10bfea0..adbfcdaf47 100644 --- a/module/testreport/view/view.html.php +++ b/module/testreport/view/view.html.php @@ -116,7 +116,8 @@ objectID&objectType=$report->objectType&extra=$report->id"), "", '', "class='btn' title='{$lang->testreport->recreate}' data-app='{$this->app->openApp}'"); + $extra = $report->objectType == 'execution' ? "&extra=$report->tasks" : ''; + if(common::hasPriv('testreport', 'create')) echo html::a(inLink('create', "objectID=$report->objectID&objectType=$report->objectType" . $extra), "", '', "class='btn' title='{$lang->testreport->recreate}' data-app='{$this->app->openApp}'"); common::printIcon('testreport', 'edit', "reportID=$report->id", '', 'button'); common::printIcon('testreport', 'delete', "reportID=$report->id", '', 'button', 'trash', 'hiddenwin'); } From 4cec21a516ac096d4f10a231dd867e48a6e55639 Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Tue, 27 Apr 2021 14:28:21 +0800 Subject: [PATCH 2/5] * Fix bug #12333. --- lib/base/front/front.class.php | 22 ++++++++++++++++------ module/todo/control.php | 10 ++++++++-- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/lib/base/front/front.class.php b/lib/base/front/front.class.php index d9858e1afc..6708f6f377 100644 --- a/lib/base/front/front.class.php +++ b/lib/base/front/front.class.php @@ -885,16 +885,18 @@ class baseJS * 显示一个确认框,点击确定跳转到$okURL,点击取消跳转到$cancelURL。 * show a confirm box, press ok go to okURL, else go to cancleURL. * - * @param string $message 显示的内容。 the text to be showed. - * @param string $okURL 点击确定后跳转的地址。 the url to go to when press 'ok'. - * @param string $cancleURL 点击取消后跳转的地址。 the url to go to when press 'cancle'. - * @param string $okTarget 点击确定后跳转的target。 the target to go to when press 'ok'. - * @param string $cancleTarget 点击取消后跳转的target。 the target to go to when press 'cancle'. + * @param string $message 显示的内容。 the text to be showed. + * @param string $okURL 点击确定后跳转的地址。 the url to go to when press 'ok'. + * @param string $cancleURL 点击取消后跳转的地址。 the url to go to when press 'cancle'. + * @param string $okTarget 点击确定后跳转的target。 the target to go to when press 'ok'. + * @param string $cancleTarget 点击取消后跳转的target。 the target to go to when press 'cancle'. + * @param string $okOpenApp 点击确定后跳转的应用。 the app to go to when press 'ok'. + * @param string $cancleOpenApp 点击取消后跳转的应用。 the app to go to when press 'cancle'. * @static * @access public * @return string */ - static public function confirm($message = '', $okURL = '', $cancleURL = '', $okTarget = "self", $cancleTarget = "self") + static public function confirm($message = '', $okURL = '', $cancleURL = '', $okTarget = "self", $cancleTarget = "self", $okOpenApp = '', $cancleOpenApp = '') { global $app; if($app->viewType == 'json') @@ -921,6 +923,10 @@ class baseJS { $confirmAction = "history.back(-1);"; } + elseif(strpos($okTarget, '$.apps.open') !== false) + { + $confirmAction = "$okTarget('$okURL', '$okOpenApp');"; + } elseif(!empty($okURL)) { $confirmAction = "$okTarget.location = '$okURL';"; @@ -931,6 +937,10 @@ class baseJS { $cancleAction = "history.back(-1);"; } + elseif(strpos($cancleTarget, '$.apps.open') !== false) + { + $cancleAction = "$cancleTarget('$cancleURL', '$cancleOpenApp');"; + } elseif(!empty($cancleURL)) { $cancleAction = "$cancleTarget.location = '$cancleURL';"; diff --git a/module/todo/control.php b/module/todo/control.php index 5b9d933f94..732ef0b358 100644 --- a/module/todo/control.php +++ b/module/todo/control.php @@ -279,8 +279,11 @@ class todo extends control { $confirmNote = 'confirm' . ucfirst($todo->type); $confirmURL = $this->createLink($todo->type, 'view', "id=$todo->idvalue"); + if($todo->type == 'bug') $app = 'qa'; + if($todo->type == 'task') $app = 'execution'; + if($todo->type == 'story') $app = 'product'; $cancelURL = $this->server->HTTP_REFERER; - die(js::confirm(sprintf($this->lang->todo->$confirmNote, $todo->idvalue), $confirmURL, $cancelURL, 'parent', 'parent')); + die(js::confirm(sprintf($this->lang->todo->$confirmNote, $todo->idvalue), $confirmURL, $cancelURL, 'window.parent.$.apps.open', 'parent', $app)); } if(isonlybody())die(js::reload('parent.parent')); die(js::reload('parent')); @@ -446,8 +449,11 @@ class todo extends control { $confirmNote = 'confirm' . ucfirst($todo->type); $confirmURL = $this->createLink($todo->type, 'view', "id=$todo->idvalue"); + if($todo->type == 'bug') $app = 'qa'; + if($todo->type == 'task') $app = 'execution'; + if($todo->type == 'story') $app = 'product'; $cancelURL = $this->server->HTTP_REFERER; - die(js::confirm(sprintf($this->lang->todo->$confirmNote, $todo->idvalue), $confirmURL, $cancelURL, 'parent', 'parent')); + die(js::confirm(sprintf($this->lang->todo->$confirmNote, $todo->idvalue), $confirmURL, $cancelURL, 'window.parent.$.apps.open', 'parent', $app)); } if(isonlybody())die(js::reload('parent.parent')); die(js::reload('parent')); From 7874535fd5930541ac63042f6551c2217ab1e80a Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Tue, 27 Apr 2021 14:34:53 +0800 Subject: [PATCH 3/5] * Fix bug#12380. --- module/backup/view/index.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/backup/view/index.html.php b/module/backup/view/index.html.php index 374ec2ef8c..6d7bef3fd7 100644 --- a/module/backup/view/index.html.php +++ b/module/backup/view/index.html.php @@ -63,7 +63,7 @@ 1) echo "rowspan='$rowspan'"?>>time);?> - + class='text-left' style='padding-left:5px;'> From 402e1cb49244dd7abb068c0d7b69eef07c3e28e3 Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Tue, 27 Apr 2021 15:04:11 +0800 Subject: [PATCH 4/5] * Fix bug#12397. --- module/product/view/project.html.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/product/view/project.html.php b/module/product/view/project.html.php index 6fcbd1ea08..5f23536dab 100644 --- a/module/product/view/project.html.php +++ b/module/product/view/project.html.php @@ -40,7 +40,7 @@ project->begin;?> project->end;?> project->status;?> - project->budget;?> + project->budget;?> project->estimate;?> project->consume;?> project->progress;?> @@ -78,7 +78,8 @@ app->getClientLang(), ['zh-cn','zh-tw']) ? round((float)$project->budget / 10000, 2) . $this->lang->project->tenThousand : round((float)$project->budget, 2);?> budget != 0 ? zget($this->lang->project->currencySymbol, $project->budgetUnit) . ' ' . $projectBudget : $this->lang->project->future;?> - + budget != 0 ? 'text-right' : 'text-center';?> + hours->totalEstimate . $lang->execution->workHourUnit;?> hours->totalConsumed . $lang->execution->workHourUnit;?> From 7ed10733b38e135dabf9dd01ed268950bd1783f4 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Tue, 27 Apr 2021 15:06:52 +0800 Subject: [PATCH 5/5] * Fix bug #11210. --- module/bug/control.php | 4 ++-- module/product/model.php | 35 +++++++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index d42ddb861f..fb35aca121 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -61,7 +61,7 @@ class bug extends control } else { - $products = $this->product->getPairs(); + $products = $this->product->getPairs('', 0, 'program_asc'); } $this->view->products = $this->products = $products; @@ -514,7 +514,7 @@ class bug extends control if(empty($moduleOptionMenu)) die(js::locate(helper::createLink('tree', 'browse', "productID=$productID&view=story"))); /* Get products and projects. */ - $products = $this->config->CRProduct ? $this->products : $this->product->getPairs('noclosed'); + $products = $this->config->CRProduct ? $this->products : $this->product->getPairs('noclosed', 0, 'program_asc'); $projects = array(0 => ''); if($projectID) { diff --git a/module/product/model.php b/module/product/model.php index 2255841b8f..5f8bb17ca5 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -261,21 +261,36 @@ class productModel extends model * * @param string $mode * @param string $programID + * @param string $orderBy program_asc * @return array */ - public function getPairs($mode = '', $programID = 0) + public function getPairs($mode = '', $programID = 0, $orderBy = '') { if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProductPairs(); - $orderBy = !empty($this->config->product->orderBy) ? $this->config->product->orderBy : 'isClosed'; - $products = $this->dao->select('*, IF(INSTR(" closed", status) < 2, 0, 1) AS isClosed') - ->from(TABLE_PRODUCT) - ->where('deleted')->eq(0) - ->beginIF($programID)->andWhere('program')->eq($programID)->fi() - ->beginIF(strpos($mode, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi() - ->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->products)->fi() - ->orderBy($orderBy) - ->fetchPairs('id', 'name'); + if($orderBy == 'program_asc') + { + $products = $this->dao->select('t1.id as id, t1.name as name, t1.*, IF(INSTR(" closed", t1.status) < 2, 0, 1) AS isClosed')->from(TABLE_PRODUCT)->alias('t1') + ->leftJoin(TABLE_PROGRAM)->alias('t2')->on('t1.program = t2.id') + ->where('t1.deleted')->eq(0) + ->beginIF($programID)->andWhere('t1.program')->eq($programID)->fi() + ->beginIF(strpos($mode, 'noclosed') !== false)->andWhere('t1.status')->ne('closed')->fi() + ->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->products)->fi() + ->orderBy('t2.order_asc, t1.line_desc, t1.order_desc') + ->fetchPairs('id', 'name'); + } + else + { + $orderBy = !empty($this->config->product->orderBy) ? $this->config->product->orderBy : 'isClosed'; + $products = $this->dao->select('*, IF(INSTR(" closed", status) < 2, 0, 1) AS isClosed') + ->from(TABLE_PRODUCT) + ->where('deleted')->eq(0) + ->beginIF($programID)->andWhere('program')->eq($programID)->fi() + ->beginIF(strpos($mode, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi() + ->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->products)->fi() + ->orderBy($orderBy) + ->fetchPairs('id', 'name'); + } return $products; }