diff --git a/framework/control.class.php b/framework/control.class.php index 44e60cef3d..385fdee3b1 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -252,8 +252,8 @@ class control extends baseControl */ public function processStatus($module, $record) { - if(!isset($this->config->bizVersion) or empty($record->subStatus)) return zget($this->lang->$module->statusList, $record->status); + $moduleName = $this->moduleName; - return $this->loadModel('workflowfield')->processSubStatus($module, $record); + return $this->$moduleName->processStatus($module, $record); } } diff --git a/framework/model.class.php b/framework/model.class.php index f7fb367e93..caa3db33d1 100644 --- a/framework/model.class.php +++ b/framework/model.class.php @@ -76,4 +76,19 @@ class model extends baseModel $object = preg_replace('/^' . preg_quote($this->config->db->prefix) . '/', '', trim($table, '`')); $this->loadModel('action')->create($object, $id, 'deleted', '', $extra = ACTIONMODEL::CAN_UNDELETED); } + + /** + * Process status of an object according to its subStatus. + * + * @param string $module product | release | story | project | task | bug | testcase | testtask | feedback + * @param object $record a record of above modules. + * @access public + * @return string + */ + public function processStatus($module, $record) + { + if(!isset($this->config->bizVersion) or empty($record->subStatus)) return zget($this->lang->$module->statusList, $record->status); + + return $this->loadModel('workflowfield')->processSubStatus($module, $record); + } } diff --git a/module/bug/control.php b/module/bug/control.php index 62f3204dbe..e9d07487fc 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1522,7 +1522,7 @@ class bug extends control if(isset($bugLang->severityList[$bug->severity])) $bug->severity = $bugLang->severityList[$bug->severity]; if(isset($bugLang->osList[$bug->os])) $bug->os = $bugLang->osList[$bug->os]; if(isset($bugLang->browserList[$bug->browser])) $bug->browser = $bugLang->browserList[$bug->browser]; - if(isset($bugLang->statusList[$bug->status])) $bug->status = $bugLang->statusList[$bug->status]; + if(isset($bugLang->statusList[$bug->status])) $bug->status = $this->processStatus('bug', $bug); if(isset($bugLang->confirmedList[$bug->confirmed])) $bug->confirmed = $bugLang->confirmedList[$bug->confirmed]; if(isset($bugLang->resolutionList[$bug->resolution])) $bug->resolution = $bugLang->resolutionList[$bug->resolution]; diff --git a/module/bug/model.php b/module/bug/model.php index 1961e4be6f..3d8ad68989 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -2441,7 +2441,7 @@ class bugModel extends model if($id == 'status') { $class .= ' bug-' . $bug->status; - $title = "title='" . zget($this->lang->bug->statusList, $bug->status) . "'"; + $title = "title='" . $this->processStatus('bug', $bug) . "'"; } if($id == 'confirmed') { @@ -2530,7 +2530,7 @@ class bugModel extends model break; case 'status': echo ""; - echo zget($this->lang->bug->statusList, $bug->status); + echo $this->processStatus('bug', $bug); echo ''; break; case 'activatedCount': diff --git a/module/project/control.php b/module/project/control.php index c5156ad056..3fd675c5d6 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -2279,8 +2279,8 @@ class project extends control $users = $this->loadModel('user')->getPairs('noletter'); foreach($projectStats as $i => $project) { - $project->PM = zget($users, $project->PM); - $project->status = isset($project->delay) ? $projectLang->delayed : $projectLang->statusList[$project->status]; + $project->PM = zget($users, $project->PM); + $project->status = isset($project->delay) ? $projectLang->delayed : $this->processStatus('project', $project); $project->totalEstimate = $project->hours->totalEstimate; $project->totalConsumed = $project->hours->totalConsumed; $project->totalLeft = $project->hours->totalLeft; diff --git a/module/story/control.php b/module/story/control.php index 778d5ecc85..100ccea897 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -1567,7 +1567,7 @@ class story extends control if(isset($relatedStories[$story->duplicateStory])) $story->duplicateStory = $relatedStories[$story->duplicateStory]; if(isset($storyLang->priList[$story->pri])) $story->pri = $storyLang->priList[$story->pri]; - if(isset($storyLang->statusList[$story->status])) $story->status = $storyLang->statusList[$story->status]; + if(isset($storyLang->statusList[$story->status])) $story->status = $this->processStatus('story', $story); if(isset($storyLang->stageList[$story->stage])) $story->stage = $storyLang->stageList[$story->stage]; if(isset($storyLang->reasonList[$story->closedReason])) $story->closedReason = $storyLang->reasonList[$story->closedReason]; if(isset($storyLang->sourceList[$story->source])) $story->source = $storyLang->sourceList[$story->source]; diff --git a/module/story/model.php b/module/story/model.php index 886b8c20fd..fc077f8238 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2465,7 +2465,7 @@ class storyModel extends model break; case 'status': echo ""; - echo $this->lang->story->statusList[$story->status]; + echo $this->processStatus('story', $story); echo ''; break; case 'estimate': diff --git a/module/task/control.php b/module/task/control.php index 6ef67fee10..441e672237 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1458,7 +1458,7 @@ class task extends control if(isset($projects[$task->project])) $task->project = $projects[$task->project] . "(#$task->project)"; if(isset($taskLang->typeList[$task->type])) $task->type = $taskLang->typeList[$task->type]; if(isset($taskLang->priList[$task->pri])) $task->pri = $taskLang->priList[$task->pri]; - if(isset($taskLang->statusList[$task->status])) $task->status = $taskLang->statusList[$task->status]; + if(isset($taskLang->statusList[$task->status])) $task->status = $this->processStatus('task', $task); if(isset($taskLang->reasonList[$task->closedReason])) $task->closedReason = $taskLang->reasonList[$task->closedReason]; if(isset($relatedModules[$task->module])) $task->module = $relatedModules[$task->module] . "(#$task->module)"; diff --git a/module/task/model.php b/module/task/model.php index 83e2bce725..1796c611ec 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2628,7 +2628,7 @@ class taskModel extends model echo $this->lang->task->typeList[$task->type]; break; case 'status': - $storyChanged ? print("{$this->lang->story->changed}") : print(" {$this->lang->task->statusList[$task->status]}"); + $storyChanged ? print("{$this->lang->story->changed}") : print(" " . $this->processStatus('task', $task) . ""); break; case 'estimate': echo round($task->estimate, 1); diff --git a/module/testcase/control.php b/module/testcase/control.php index 455d232f12..ec5ae4e553 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -1211,7 +1211,7 @@ class testcase extends control if(isset($caseLang->priList[$case->pri])) $case->pri = $caseLang->priList[$case->pri]; if(isset($caseLang->typeList[$case->type])) $case->type = $caseLang->typeList[$case->type]; - if(isset($caseLang->statusList[$case->status])) $case->status = $caseLang->statusList[$case->status]; + if(isset($caseLang->statusList[$case->status])) $case->status = $this->processStatus('testcase', $case); if(isset($users[$case->openedBy])) $case->openedBy = $users[$case->openedBy]; if(isset($users[$case->lastEditedBy])) $case->lastEditedBy = $users[$case->lastEditedBy]; if(isset($caseLang->resultList[$case->lastRunResult])) $case->lastRunResult = $caseLang->resultList[$case->lastRunResult]; diff --git a/module/testcase/model.php b/module/testcase/model.php index ab5855f898..dfbe69b5a1 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -1360,7 +1360,7 @@ class testcaseModel extends model if($id == 'status') { $class .= $case->status; - $title = "title='" . zget($this->lang->testcase->statusList, $case->status) . "'"; + $title = "title='" . $this->processStatus('testcase', $case) . "'"; } if($id == 'actions') $class .= ' c-actions'; if($id == 'lastRunResult') $class .= " {$case->lastRunResult}"; @@ -1406,7 +1406,7 @@ class testcaseModel extends model } else { - print("{$this->lang->testcase->statusList[$case->status]}"); + print("" . $this->processStatus('testcase', $case) . ""); } break; case 'story': diff --git a/module/testtask/model.php b/module/testtask/model.php index 559ad32260..dd1a16f5ec 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -1213,7 +1213,7 @@ class testtaskModel extends model foreach(explode(',', trim($run->stage, ',')) as $stage) echo $this->lang->testcase->stageList[$stage] . '
'; break; case 'status': - echo ($run->version < $run->caseVersion) ? "{$this->lang->testcase->changed}" : $this->lang->testtask->statusList[$run->status]; + echo ($run->version < $run->caseVersion) ? "{$this->lang->testcase->changed}" : $this->processStatus('testtask', $run); break; case 'precondition': echo $run->precondition;