diff --git a/module/custom/control.php b/module/custom/control.php
index 3f7af07206..f4e63b7601 100644
--- a/module/custom/control.php
+++ b/module/custom/control.php
@@ -122,6 +122,13 @@ class custom extends control
if($review->needReview) $data = fixer::input('post')->join('forceNotReview', ',')->remove('forceReview')->get();
if(!$review->needReview) $data = fixer::input('post')->join('forceReview', ',')->remove('forceNotReview')->get();
$this->loadModel('setting')->setItems("system.$module", $data);
+
+ $reviewCase = isset($review->reviewCase) ? $review->reviewCase : 0;
+ if($review->needReview == 0 and $reviewCase)
+ {
+ $waitCases = $this->loadModel('testcase')->getByStatus(0, 0, 'all', 'wait');
+ $this->testcase->batchReview(array_keys($waitCases), 'pass');
+ }
}
elseif($module == 'task' and $field == 'hours')
{
diff --git a/module/custom/js/set.js b/module/custom/js/set.js
index 0236338696..244532a04d 100644
--- a/module/custom/js/set.js
+++ b/module/custom/js/set.js
@@ -34,4 +34,33 @@ $('[name*=unitList]').change(function()
$("#defaultCurrency").trigger("chosen:updated");
});
+$('#submit').click(function()
+{
+ if(module == 'testcase' && field == 'review' && stopSubmit)
+ {
+ var needReview = $('input:radio[name="needReview"]:checked').val();
+ stopSubmit = false;
+
+ if(needReview == 0)
+ {
+ $.post(createLink('testcase', 'ajaxGetReviewCount'), function(count)
+ {
+ if(count == 0)
+ {
+ $('#submit').click();
+ return true;
+ }
+
+ bootbox.confirm(confirmReviewCase, function(result)
+ {
+ if(result) $('#submit').append("");
+ $('#submit').click();
+ })
+ })
+
+ return false;
+ }
+ }
+})
+
$('[name*=unitList]').change();
diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php
index ade50a8647..562bde2fd0 100644
--- a/module/custom/lang/en.php
+++ b/module/custom/lang/en.php
@@ -174,6 +174,7 @@ $lang->custom->notice->readOnlyOfProduct = 'If Change Forbidden, any change on
$lang->custom->notice->readOnlyOfExecution = "If Change Forbidden, any change on tasks, builds, efforts and stories of the closed {$lang->executionCommon} is also forbidden.";
$lang->custom->notice->URSREmpty = 'Custom requirement name can not be empty!';
$lang->custom->notice->confirmDelete = 'Are you sure you want to delete it?';
+$lang->custom->notice->confirmReviewCase = 'Set the case in Wait to Normal?';
$lang->custom->notice->indexPage['product'] = "ZenTao 8.2+ has Product Home. Do you want to go to Product Home?";
$lang->custom->notice->indexPage['project'] = "ZenTao 8.2+ has Project Home. Do you want to go to Project Home?";
diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php
index 92f8d55d87..4e41e05db9 100644
--- a/module/custom/lang/zh-cn.php
+++ b/module/custom/lang/zh-cn.php
@@ -174,6 +174,7 @@ $lang->custom->notice->readOnlyOfProduct = '禁止修改后,已关闭' . $la
$lang->custom->notice->readOnlyOfExecution = "禁止修改后,已关闭{$lang->custom->execution}下的任务、版本、日志以及关联需求都禁止修改。";
$lang->custom->notice->URSREmpty = '自定义需求名称不能为空!';
$lang->custom->notice->confirmDelete = '您确定要删除吗?';
+$lang->custom->notice->confirmReviewCase = '是否将待评审的用例修改为正常状态?';
$lang->custom->notice->indexPage['product'] = "从8.2版本起增加了产品主页视图,是否默认进入产品主页?";
$lang->custom->notice->indexPage['project'] = "从8.2版本起增加了项目主页视图,是否默认进入项目主页?";
diff --git a/module/custom/view/set.html.php b/module/custom/view/set.html.php
index ea2287d284..c89902d8a5 100644
--- a/module/custom/view/set.html.php
+++ b/module/custom/view/set.html.php
@@ -31,6 +31,8 @@ EOT;
+custom->notice->confirmReviewCase)?>
+
diff --git a/module/testcase/control.php b/module/testcase/control.php
index 1d756a85a9..74bff877f3 100644
--- a/module/testcase/control.php
+++ b/module/testcase/control.php
@@ -1963,4 +1963,15 @@ class testcase extends control
if($methodName == 'update') $status = zget($status, 1, '');
die($status);
}
+
+ /**
+ * Ajax: Get count of need review casese.
+ *
+ * @access public
+ * @return int
+ */
+ public function ajaxGetReviewCount()
+ {
+ echo $this->dao->select('count(id) as count')->from(TABLE_CASE)->where('status')->eq('wait')->fetch('count');
+ }
}
diff --git a/module/testcase/model.php b/module/testcase/model.php
index 9fbf37c07b..6da824b03d 100644
--- a/module/testcase/model.php
+++ b/module/testcase/model.php
@@ -319,7 +319,7 @@ class testcaseModel extends model
}
/**
- * Get by suite.
+ * Get cases by suite.
*
* @param int $productID
* @param int $branch
@@ -329,7 +329,7 @@ class testcaseModel extends model
* @param object $pager
* @param string $auto no|unit
* @access public
- * @return void
+ * @return array
*/
public function getBySuite($productID, $branch = 0, $suiteID, $moduleIdList = 0, $orderBy = 'id_desc', $pager = null, $auto = 'no')
{
@@ -586,7 +586,7 @@ class testcaseModel extends model
* @access public
* @return array
*/
- public function getByStatus($productID = 0, $branch, $type = 'all', $status = 'all', $moduleID, $orderBy = 'id_desc', $pager, $auto = 'no')
+ public function getByStatus($productID = 0, $branch, $type = 'all', $status = 'all', $moduleID = 0, $orderBy = 'id_desc', $pager = null, $auto = 'no')
{
$modules = $moduleID ? $this->loadModel('tree')->getAllChildId($moduleID) : '0';