* fix error.

This commit is contained in:
wangyidong
2021-04-01 15:23:01 +08:00
parent b24b6a2744
commit 7567d4436a
2 changed files with 15 additions and 4 deletions
+1
View File
@@ -599,6 +599,7 @@ class block extends control
$account = $this->app->user->account;
$type = $this->params->type;
$this->app->loadLang('execution');
$this->view->tasks = $this->loadModel('task')->getUserTasks($account, $type, $this->viewType == 'json' ? 0 : (int)$this->params->count, null, $this->params->orderBy);
}
+14 -4
View File
@@ -2101,20 +2101,30 @@ EOD;
public static function canBeChanged($module, $object = null)
{
global $app, $config;
static $productsStatus = array();
static $executionsStatus = array();
/* Check the product is closed. */
if(!empty($object->product) and is_numeric($object->product) and empty($config->CRProduct))
{
$product = $app->control->loadModel('product')->getByID($object->product);
if($product->status == 'closed') return false;
if(!isset($productsStatus[$object->product]))
{
$product = $app->control->loadModel('product')->getByID($object->product);
$productsStatus[$object->product] = $product ? $product->status : '';
}
if($productsStatus[$object->product] == 'closed') return false;
}
/* Check the execution is closed. */
$productModuleList = array('story', 'bug', 'testtask');
if(!in_array($module, $productModuleList) and !empty($object->execution) and is_numeric($object->execution) and empty($config->CRExecution))
{
$execution = $app->control->loadModel('execution')->getByID($object->execution);
if($execution->status == 'closed') return false;
if(!isset($executionsStatus[$object->execution]))
{
$execution = $app->control->loadModel('execution')->getByID($object->execution);
$executionsStatus[$object->execution] = $execution ? $execution->status : '';
}
if($executionsStatus[$object->execution] == 'closed') return false;
}
return true;