From 196f638737e65276dd9d760413c19fa34585ab41 Mon Sep 17 00:00:00 2001 From: daitingting Date: Fri, 16 Sep 2022 03:09:55 +0000 Subject: [PATCH 01/12] * Finish task #69245. --- module/custom/control.php | 15 ++++++--------- module/custom/view/mode.html.php | 8 ++------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/module/custom/control.php b/module/custom/control.php index a770c7b2e6..0941c023bd 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -630,12 +630,10 @@ class custom extends control $mode = zget($this->config->global, 'mode', 'classic'); if($this->post->mode and $this->post->mode != $mode) // If mode value change. { - $mode = fixer::input('post')->get('mode'); - $this->loadModel('setting')->setItem('system.common.global.mode', $mode); - $this->setting->setItem('system.common.global.changedMode', 'yes'); + $this->loadModel('setting')->setItem('system.common.global.mode', $this->post->mode); $sprintConcept = isset($this->config->custom->sprintConcept) ? $this->config->custom->sprintConcept : '0'; - if($mode == 'new') + if($this->post->mode == 'new') { if($sprintConcept == 2) $this->setting->setItem('system.custom.sprintConcept', 1); if($sprintConcept == 1) $this->setting->setItem('system.custom.sprintConcept', 0); @@ -658,11 +656,10 @@ class custom extends control $this->app->loadLang('upgrade'); - $this->view->title = $this->lang->custom->mode; - $this->view->position[] = $this->lang->custom->common; - $this->view->position[] = $this->view->title; - $this->view->mode = $mode; - $this->view->changedMode = zget($this->config->global, 'changedMode', 'no'); + $this->view->title = $this->lang->custom->mode; + $this->view->position[] = $this->lang->custom->common; + $this->view->position[] = $this->view->title; + $this->view->mode = $mode; $this->display(); } diff --git a/module/custom/view/mode.html.php b/module/custom/view/mode.html.php index 2d480ed65c..89a21fc9dd 100644 --- a/module/custom/view/mode.html.php +++ b/module/custom/view/mode.html.php @@ -22,18 +22,14 @@ custom->mode;?> -

- - - -

+

upgrade->to15Mode, $mode);?>

upgrade->selectedModeTips['new'];?>

- custom->switch);?> + custom->switch);?> From bfe47dbdb55112152d784fa340b5eb6b6cefd859 Mon Sep 17 00:00:00 2001 From: daitingting Date: Fri, 16 Sep 2022 06:54:35 +0000 Subject: [PATCH 02/12] * Add noExecution field in project table. * Set noExecution of project accord to projectMode. --- db/update17.6.1.sql | 1 + db/zentao.sql | 1 + module/upgrade/model.php | 7 ++++--- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 db/update17.6.1.sql diff --git a/db/update17.6.1.sql b/db/update17.6.1.sql new file mode 100644 index 0000000000..e8749557cf --- /dev/null +++ b/db/update17.6.1.sql @@ -0,0 +1 @@ +ALTER table `zt_project` ADD `noExecution` enum('0', '1') NOT NULL DEFAULT '0'; diff --git a/db/zentao.sql b/db/zentao.sql index d5266fc5e3..da4c5c0d2b 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -1193,6 +1193,7 @@ CREATE TABLE IF NOT EXISTS `zt_project` ( `vision` varchar(10) NOT NULL DEFAULT 'rnd', `displayCards` smallint(6) NOT NULL default '0', `fluidBoard` enum('0','1') NOT NULL DEFAULT '0', + `noExecution` enum('0', '1') NOT NULL DEFAULT '0', `deleted` enum('0','1') NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `parent` (`parent`), diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 443787236b..397a87013e 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -7598,8 +7598,9 @@ class upgradeModel extends model public function upgradeInProjectMode($programID) { $this->loadModel('action'); - $now = helper::now(); - $account = isset($this->app->user->account) ? $this->app->user->account : ''; + $now = helper::now(); + $account = isset($this->app->user->account) ? $this->app->user->account : ''; + $projectMode = $this->setting->getItem('owner=system&module=common§ion=global&key=projectMode'); $noMergedSprints = $this->getNoMergedSprints(); if(!$noMergedSprints) return true; @@ -7624,7 +7625,7 @@ class upgradeModel extends model $project->lastEditedDate = $now; $project->grade = 2; $project->acl = $sprint->acl == 'open' ? 'open' : 'private'; - if($this->config->global->mode == 'classic') $project->noExecution = '1'; + if($projectMode == 'noExecution') $project->noExecution = '1'; $this->dao->insert(TABLE_PROJECT)->data($project)->check('name', 'unique', "type='project' AND parent=$programID AND deleted='0'")->exec(); if(dao::isError()) return false; From 78d1de70c21aad44f95372c718f0dcf73f9328c3 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 16 Sep 2022 16:28:50 +0800 Subject: [PATCH 03/12] * 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 "