diff --git a/module/block/control.php b/module/block/control.php index 42ba273c7e..4d2261daef 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -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); } diff --git a/module/common/model.php b/module/common/model.php index 0ea55d87c7..8140970169 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -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;