From 78d1de70c21aad44f95372c718f0dcf73f9328c3 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 16 Sep 2022 16:28:50 +0800 Subject: [PATCH 1/5] * code for task #69248. --- module/bug/config.php | 29 ++--- module/bug/control.php | 9 +- module/bug/model.php | 12 +-- module/bug/view/create.html.php | 4 +- module/common/model.php | 61 +++++------ module/group/lang/de.php | 5 +- module/group/lang/en.php | 5 +- module/group/lang/fr.php | 5 +- module/group/lang/resource.php | 101 +++++++++--------- module/group/lang/vi.php | 4 - module/group/lang/zh-cn.php | 5 +- module/group/lang/zh-tw.php | 5 +- module/group/view/manageprojectadmin.html.php | 32 ++++++ module/my/lang/de.php | 15 +-- module/my/lang/en.php | 15 +-- module/my/lang/fr.php | 15 +-- module/my/lang/vi.php | 18 ++-- module/my/lang/zh-cn.php | 15 +-- module/my/lang/zh-tw.php | 17 ++- module/my/model.php | 9 +- module/my/view/selectproject.html.php | 31 +----- module/report/model.php | 10 +- module/report/view/bugcreate.html.php | 2 +- 23 files changed, 174 insertions(+), 250 deletions(-) diff --git a/module/bug/config.php b/module/bug/config.php index ad67ba65e3..e330b23679 100644 --- a/module/bug/config.php +++ b/module/bug/config.php @@ -38,18 +38,10 @@ $config->bug->exportFields = 'id, product, branch, module, project, execution, s lastEditedBy, lastEditedDate, files ,feedbackBy, notifyEmail'; -if($config->systemMode == 'classic') $config->bug->exportFields = str_replace(' project,', '', $config->bug->exportFields); $config->bug->list->customCreateFields = 'execution,noticefeedbackBy,story,task,pri,severity,os,browser,deadline,mailto,keywords'; $config->bug->list->customBatchEditFields = 'type,severity,pri,productplan,assignedTo,deadline,resolvedBy,resolution,os,browser,keywords'; -if($config->systemMode == 'new') -{ - $config->bug->list->customBatchCreateFields = 'project,execution,steps,type,pri,deadline,severity,os,browser,keywords'; -} -else -{ - $config->bug->list->customBatchCreateFields = 'execution,steps,type,pri,deadline,severity,os,browser,keywords'; -} +$config->bug->list->customBatchCreateFields = 'project,execution,steps,type,pri,deadline,severity,os,browser,keywords'; $config->bug->custom = new stdclass(); $config->bug->custom->createFields = $config->bug->list->customCreateFields; @@ -83,7 +75,7 @@ $config->bug->search['fields']['status'] = $lang->bug->status; $config->bug->search['fields']['confirmed'] = $lang->bug->confirmed; $config->bug->search['fields']['story'] = $lang->bug->story; -if($config->systemMode == 'new') $config->bug->search['fields']['project'] = $lang->bug->project; +$config->bug->search['fields']['project'] = $lang->bug->project; $config->bug->search['fields']['product'] = $lang->bug->product; $config->bug->search['fields']['branch'] = ''; $config->bug->search['fields']['plan'] = $lang->bug->productplan; @@ -129,7 +121,7 @@ $config->bug->search['params']['status'] = array('operator' => '=', $config->bug->search['params']['confirmed'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->bug->confirmedList); $config->bug->search['params']['story'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); -if($config->systemMode == 'new') $config->bug->search['params']['project'] = array('operator' => '=', 'control' => 'select', 'values' => ''); +$config->bug->search['params']['project'] = array('operator' => '=', 'control' => 'select', 'values' => ''); $config->bug->search['params']['product'] = array('operator' => '=', 'control' => 'select', 'values' => ''); $config->bug->search['params']['branch'] = array('operator' => '=', 'control' => 'select', 'values' => ''); $config->bug->search['params']['plan'] = array('operator' => '=', 'control' => 'select', 'values' => ''); @@ -209,15 +201,12 @@ $config->bug->datatable->fieldList['type']['fixed'] = 'no'; $config->bug->datatable->fieldList['type']['width'] = '90'; $config->bug->datatable->fieldList['type']['required'] = 'no'; -if($config->systemMode == 'new') -{ - $config->bug->datatable->fieldList['project']['title'] = 'project'; - $config->bug->datatable->fieldList['project']['fixed'] = 'no'; - $config->bug->datatable->fieldList['project']['width'] = '120'; - $config->bug->datatable->fieldList['project']['required'] = 'no'; - $config->bug->datatable->fieldList['project']['control'] = 'hidden'; - $config->bug->datatable->fieldList['project']['dataSource'] = array('module' => 'product', 'method' => 'getProjectPairsByProduct', 'params' => '$productID'); -} +$config->bug->datatable->fieldList['project']['title'] = 'project'; +$config->bug->datatable->fieldList['project']['fixed'] = 'no'; +$config->bug->datatable->fieldList['project']['width'] = '120'; +$config->bug->datatable->fieldList['project']['required'] = 'no'; +$config->bug->datatable->fieldList['project']['control'] = 'hidden'; +$config->bug->datatable->fieldList['project']['dataSource'] = array('module' => 'product', 'method' => 'getProjectPairsByProduct', 'params' => '$productID'); $config->bug->datatable->fieldList['execution']['title'] = 'execution'; $config->bug->datatable->fieldList['execution']['fixed'] = 'no'; diff --git a/module/bug/control.php b/module/bug/control.php index a77e087cab..7ca593e3ce 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -630,20 +630,13 @@ class bug extends control /* Get executions. */ $executions = array(0 => ''); - if(isset($projects[$projectID]) or $this->config->systemMode == 'classic') $executions += $this->product->getExecutionPairsByProduct($productID, $branch ? "0,$branch" : 0, 'id_desc', $projectID); + if(isset($projects[$projectID])) $executions += $this->product->getExecutionPairsByProduct($productID, $branch ? "0,$branch" : 0, 'id_desc', $projectID); $execution = $executionID ? $this->loadModel('execution')->getByID($executionID) : ''; $executions = isset($executions[$executionID]) ? $executions : $executions + array($executionID => $execution->name); /* Set custom. */ foreach(explode(',', $this->config->bug->list->customCreateFields) as $field) $customFields[$field] = $this->lang->bug->$field; - /* In repair classic mode, when the project is required, the asterisk is not displayed. */ - if($this->config->systemMode == 'classic' and strpos(",{$this->config->bug->create->requiredFields},", ',project,') !== false) - { - $this->config->bug->create->requiredFields = str_replace(',project,', ',execution,', ",{$this->config->bug->create->requiredFields},"); - $this->config->bug->create->requiredFields = trim($this->config->bug->create->requiredFields, ','); - } - $this->view->title = isset($this->products[$productID]) ? $this->products[$productID] . $this->lang->colon . $this->lang->bug->create : $this->lang->bug->create; $this->view->customFields = $customFields; $this->view->showFields = $this->config->bug->custom->createFields; diff --git a/module/bug/model.php b/module/bug/model.php index 029d351d5f..81b285335c 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -66,7 +66,7 @@ class bugModel extends model ->setDefault('openedBuild', '') ->setDefault('notifyEmail', '') ->setDefault('deadline', '0000-00-00') - ->setIF($this->config->systemMode == 'new' && $this->lang->navGroup->bug != 'qa', 'project', $this->session->project) + ->setIF($this->lang->navGroup->bug != 'qa', 'project', $this->session->project) ->setIF(strpos($this->config->bug->create->requiredFields, 'deadline') !== false, 'deadline', $this->post->deadline) ->setIF($this->post->assignedTo != '', 'assignedDate', $now) ->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) @@ -89,9 +89,6 @@ class bugModel extends model $bug = $this->loadModel('file')->processImgURL($bug, $this->config->bug->editor->create['id'], $this->post->uid); - /* Use classic mode to replace required project. */ - if($this->config->systemMode == 'classic' and strpos($this->config->bug->create->requiredFields, 'project') !== false) $this->config->bug->create->requiredFields = str_replace('project', 'execution', $this->config->bug->create->requiredFields); - $this->dao->insert(TABLE_BUG)->data($bug) ->autoCheck() ->checkIF($bug->notifyEmail, 'notifyEmail', 'email') @@ -288,7 +285,7 @@ class bugModel extends model } } - if($this->config->systemMode == 'new' && $this->lang->navGroup->bug != 'qa') $bug->project = $this->session->project; + if($this->lang->navGroup->bug != 'qa') $bug->project = $this->session->project; $this->dao->insert(TABLE_BUG)->data($bug) ->autoCheck() ->batchCheck($this->config->bug->create->requiredFields, 'notempty') @@ -1617,7 +1614,7 @@ class bugModel extends model $this->config->bug->search['actionURL'] = $actionURL; $this->config->bug->search['queryID'] = $queryID; - if($this->config->systemMode == 'new') $this->config->bug->search['params']['project']['values'] = $projectParams; + $this->config->bug->search['params']['project']['values'] = $projectParams; $this->config->bug->search['params']['product']['values'] = $productParams; $this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairs($productID); $this->config->bug->search['params']['module']['values'] = $modules; @@ -2041,8 +2038,7 @@ class bugModel extends model $users = $this->dao->select("t2.id, t2.account, t2.realname")->from(TABLE_TEAM)->alias('t1') ->leftJoin(TABLE_USER)->alias('t2')->on('t1.account = t2.account') ->where('t1.root')->in(array_keys($projects)) - ->beginIF($this->config->systemMode == 'new')->andWhere('t1.type')->eq('project')->fi() - ->beginIF($this->config->systemMode == 'classic')->andWhere('t1.type')->eq('execution')->fi() + ->andWhere('t1.type')->eq('project') ->andWhere('t2.deleted')->eq(0) ->fi() ->fetchAll('account'); diff --git a/module/bug/view/create.html.php b/module/bug/view/create.html.php index c99a3a42f6..e385e28e06 100644 --- a/module/bug/view/create.html.php +++ b/module/bug/view/create.html.php @@ -78,9 +78,9 @@ if($this->app->tab == 'project') js::set('objectID', $projectID); + projectMode) and $config->projectMode == 'noExecution');?> - systemMode == 'classic') $lang->bug->project = $lang->bug->execution;?> bug->project : $lang->bug->type;?> @@ -111,7 +111,7 @@ if($this->app->tab == 'project') js::set('objectID', $projectID); - systemMode == 'new'):?> +
diff --git a/module/common/model.php b/module/common/model.php index 3390089b3b..de6e34cf60 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -49,40 +49,32 @@ class commonModel extends model global $app; $rawModule = $app->rawModule; - if($this->config->systemMode == 'classic') + if($rawModule == 'task' or $rawModule == 'effort') { - if($rawModule == 'task') $this->syncExecutionStatus($objectID); + $taskID = $objectID; + $execution = $this->syncExecutionStatus($taskID); + $project = $this->syncProjectStatus($execution); + $this->syncProgramStatus($project); } - - if($this->config->systemMode == 'new') + if($rawModule == 'execution') { - if($rawModule == 'task' or $rawModule == 'effort') - { - $taskID = $objectID; - $execution = $this->syncExecutionStatus($taskID); - $project = $this->syncProjectStatus($execution); - $this->syncProgramStatus($project); - } - if($rawModule == 'execution') - { - $executionID = $objectID; - $execution = $this->dao->select('id, project, grade, parent, status, deleted')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch(); - $this->syncExecutionByChild($execution); - $project = $this->syncProjectStatus($execution); - $this->syncProgramStatus($project); - } - if($rawModule == 'project') - { - $projectID = $objectID; - $project = $this->dao->select('id, parent, path')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch(); - $this->syncProgramStatus($project); - } - if($rawModule == 'program') - { - $programID = $objectID; - $program = $this->dao->select('id, parent, path')->from(TABLE_PROGRAM)->where('id')->eq($programID)->fetch(); - $this->syncProgramStatus($program); - } + $executionID = $objectID; + $execution = $this->dao->select('id, project, grade, parent, status, deleted')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch(); + $this->syncExecutionByChild($execution); + $project = $this->syncProjectStatus($execution); + $this->syncProgramStatus($project); + } + if($rawModule == 'project') + { + $projectID = $objectID; + $project = $this->dao->select('id, parent, path')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch(); + $this->syncProgramStatus($project); + } + if($rawModule == 'program' and $this->config->systemMode == 'new') + { + $programID = $objectID; + $program = $this->dao->select('id, parent, path')->from(TABLE_PROGRAM)->where('id')->eq($programID)->fetch(); + $this->syncProgramStatus($program); } } @@ -938,7 +930,6 @@ class commonModel extends model if($tab == 'product') $currentMethod = 'all'; } - if($config->systemMode == 'classic' and $tab == 'execution') $icon = zget($lang->navIcons, 'project', ''); $link = helper::createLink($currentModule, $currentMethod); $className = $tab == 'devops' ? 'btn num' : 'btn'; $html = $link ? html::a($link, "$icon {$lang->$tab->common}", '', "class='$className' style='padding-top: 2px'") : "$icon {$lang->$tab->common}"; @@ -1248,9 +1239,10 @@ class commonModel extends model echo "