From c25a79a1f5b78dd65e13ef2c6410119d75def9e7 Mon Sep 17 00:00:00 2001 From: liyang Date: Tue, 15 Nov 2022 11:02:27 +0800 Subject: [PATCH 01/43] * Add cteate yaml file test example. --- test/lib/yaml.class.php | 90 ++++++++++++++++++++++------------- test/model/action/getbyid.php | 13 +++-- 2 files changed, 68 insertions(+), 35 deletions(-) diff --git a/test/lib/yaml.class.php b/test/lib/yaml.class.php index 8e96353772..d96e1e90c2 100644 --- a/test/lib/yaml.class.php +++ b/test/lib/yaml.class.php @@ -1,6 +1,6 @@ * @package ZenTaoPMS - * @version $Id: $ + * @version 1.0 * @link http://www.zentao.net/ */ -class yaml + +/** + * Set fields for test data yaml file. + * + * @copyright Copyright 2009-2022 QingDao Nature Easy Soft Network Technology Co,LTD (www.cnezsoft.com) + * @author liyang + * @package + * @license LGPL + * @version 1.0 + * @Link https://www.zentao.net + */ +class field { /** * Global config. @@ -22,12 +33,12 @@ class yaml public $config; /** - * Filed Arr. + * Field Arr. * * @var array * @access public */ - public $fieldArr = array(); + public $fieldArr = array(); /** * Field. @@ -72,7 +83,7 @@ class yaml } /** - * Set yaml filed. + * Set yaml field. * * @param string $value * @access public @@ -86,7 +97,7 @@ class yaml } /** - * Set filed rang. + * Set field rang. * * @param string $range * @access public @@ -118,7 +129,7 @@ class yaml * @access public * @return object */ - function postfix($postfix) + public function postfix($postfix) { $this->fieldArr[$this->field]['postfix'] = $postfix; return $this; @@ -131,7 +142,7 @@ class yaml * @access public * @return object */ - function type($type) + public function type($type) { $this->fieldArr[$this->field]['type'] = $type; return $this; @@ -144,24 +155,24 @@ class yaml * @access public * @return object */ - function format($format) + public function format($format) { $this->fieldArr[$this->field]['format'] = $format; return $this; } /** - * set field fields. + * Set field fields. * * @param array $fields * @access public * @return object */ - function fields($fields) + public function fields($fields) { if(!is_array($fields)) { - echo "fileds must be an array"; + echo "fields must be an array"; return; } @@ -170,31 +181,32 @@ class yaml } /** - * get field array value. + * Get field array. * * @access public * @return array */ - function getField() + public function getFields() { + var_dump($this->fieldArr); return $this->fieldArr; } /** * Assembly field generation rules. * - * @param array $filedArr + * @param array $fieldArr * @access public * @return array */ - function setFieldRule($filedArr) + public function setFieldRule($fieldArr) { $ruleArr = array(); $index = 0; - foreach($filedArr as $filed => $rule) + foreach($fieldArr as $field => $rule) { - $ruleArr[$index]['field'] = $filed; + $ruleArr[$index]['field'] = $field; if(array_key_exists('fields', $rule)) { @@ -202,7 +214,7 @@ class yaml } else { - if(!empty($rule['range'])) $ruleArr[$index]['range'] = $rule['range']; + if(!empty($rule['range'])) $ruleArr[$index]['range'] = $rule['range']; } if(!empty($rule['prefix'])) $ruleArr[$index]['prefix'] = $rule['prefix']; @@ -224,23 +236,37 @@ class yaml * @access public * @return void */ - function build($model, $name, $version = '') + public function build($model, $name, $version = '') { if(!is_dir($this->yamlDir . "/{$model}/data")) mkdir($this->yamlDir . "/{$model}/data", 0700); $yamlFile = $this->yamlDir . "/{$model}/data/{$name}.yaml"; $yamlDataArr = array(); - $yamlDataArr['title'] = "zt_{$name}"; - $yamlDataArr['author'] = "auto_{$name}"; + $yamlDataArr['title'] = "zt_{$name}"; + $yamlDataArr['author'] = "auto_{$name}"; $version ? $yamlDataArr['version'] = $version : $yamlDataArr['version'] = '1.0'; if(empty($this->fieldArr)) return; $yamlDataArr['fields'] = $this->setFieldRule($this->fieldArr); - yaml_emit_file($yamlFile, $yamlDataArr); + yaml_emit_file($yamlFile, $yamlDataArr, YAML_UTF8_ENCODING); } +} +/** + * Create test data from yaml file. + * + * @copyright Copyright 2009-2022 QingDao Nature Easy Soft Network Technology Co,LTD (www.cnezsoft.com) + * @author liyang + * @package + * @uses field + * @license LGPL + * @version 1.0 + * @Link https://www.zentao.net + */ +class yaml extends field +{ /** * Insert the data into database. * @@ -252,8 +278,8 @@ class yaml */ function insertDB($model, $file, $tableName, $rows, $isClear = false) { - $yamlFile = $this->yamlDir . "/{$model}/data/{$file}.yaml"; - $tableSqlDir = $this->yamlDir . "/{$model}/data/sql"; + $yamlFile = $this->yamlDir . "/{$model}/data/{$file}.yaml"; + $tableSqlDir = $this->yamlDir . "/{$model}/data/sql"; if(!is_dir($tableSqlDir)) mkdir($tableSqlDir, 0700); $dumpCommand = "mysqldump -u%s -p%s -h%s -P%s %s %s > {$tableSqlDir}/{$tableName}.sql"; @@ -269,7 +295,7 @@ class yaml $dbUser = $this->config->db->user; $dbPWD = $this->config->db->password; - $command = "$zdPath -c %s -d %s -n %d -t %s --trim -dns mysql://%s:%s@%s:%s/%s#utf8"; + $command = "$zdPath -c %s -d %s -n %d -t %s -dns mysql://%s:%s@%s:%s/%s#utf8"; if($isClear === true) $command .= ' --clear'; $execYaml = sprintf($command, $configYaml, $yamlFile, $rows, $tableName, $dbUser, $dbPWD, $dbHost, $dbPort, $dbName); $execDump = sprintf($dumpCommand, $dbUser, $dbPWD, $dbHost, $dbPort, $dbName, $tableName); @@ -290,11 +316,11 @@ class yaml $tableSql = $this->yamlDir . "/{$model}/data/sql/$tableName.sql"; if(!is_file($tableSql)) return false; - $dbName = $this->config->db->name; - $dbHost = $this->config->db->host; - $dbPort = $this->config->db->port; - $dbUser = $this->config->db->user; - $dbPWD = $this->config->db->password; + $dbName = $this->config->db->name; + $dbHost = $this->config->db->host; + $dbPort = $this->config->db->port; + $dbUser = $this->config->db->user; + $dbPWD = $this->config->db->password; $command = "mysql -u%s -p%s -h%s -P%s %s < %s"; $execRestore = sprintf($command, $dbUser, $dbPWD, $dbHost, $dbPort, $dbName, $tableSql); diff --git a/test/model/action/getbyid.php b/test/model/action/getbyid.php index 1df040499b..35c9d7b48c 100755 --- a/test/model/action/getbyid.php +++ b/test/model/action/getbyid.php @@ -3,7 +3,13 @@ include dirname(dirname(dirname(__FILE__))) . '/lib/init.php'; include dirname(dirname(dirname(__FILE__))) . '/class/action.class.php'; su('admin'); - +$yaml->id->range('101-105'); +$yaml->objectType->range("product,story,productplan,release"); +$yaml->action->range("common,extra,opened,created,changed"); +$yaml->comment->range("1-5")->prefix("这是一个系统日志测试备注"); +$yaml->getFields(); +$yaml->build('action', 'action_getbyid'); +$yaml->insertDB('action', 'action_getbyid', 'action', 5); /** title=测试 actionModel->getById(); @@ -18,7 +24,7 @@ pid=1 */ -$actionIDList = array('1', '2', '3', '4', '5'); +$actionIDList = array('101', '102', '103', '104', '105'); $action = new actionTest(); @@ -26,4 +32,5 @@ r($action->getByIdTest($actionIDList[0])) && p('objectType,objectId,action,comme r($action->getByIdTest($actionIDList[1])) && p('objectType,objectId,action,comment') && e('story,,extra,这是一个系统日志测试备注2'); // 测试获取动态2的信息 r($action->getByIdTest($actionIDList[2])) && p('objectType,objectId,action,comment') && e('productplan,,opened,这是一个系统日志测试备注3'); // 测试获取动态3的信息 r($action->getByIdTest($actionIDList[3])) && p('objectType,objectId,action,comment') && e('release,,created,这是一个系统日志测试备注4'); // 测试获取动态4的信息 -r($action->getByIdTest($actionIDList[4])) && p('objectType,objectId,action,comment') && e('project,,changed,这是一个系统日志测试备注5'); // 测试获取动态5的信息 \ No newline at end of file +r($action->getByIdTest($actionIDList[4])) && p('objectType,objectId,action,comment') && e('project,,changed,这是一个系统日志测试备注5'); // 测试获取动态5的信息 +$yaml->restoreTable('action', 'action'); From 47398d1cf04390ae2d0567d9975c4d6c0b0d5109 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Wed, 16 Nov 2022 10:52:53 +0800 Subject: [PATCH 02/43] * Fix bug #29869. --- module/story/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/story/model.php b/module/story/model.php index a1f2bee3ed..4201893af4 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -3081,7 +3081,7 @@ class storyModel extends model } elseif($branch !== 'all' and $queryProductID != 'all') { - if($branch and strpos($storyQuery, '`branch` =') === false) $storyQuery .= " AND `branch` in($branch)"; + if($branch and strpos($storyQuery, '`branch` =') === false) $storyQuery .= " AND `branch` in('$branch')"; } $storyQuery = preg_replace("/`plan` +LIKE +'%([0-9]+)%'/i", "CONCAT(',', `plan`, ',') LIKE '%,$1,%'", $storyQuery); From e04c30fa3b9cd8d08b3131184724e7efa80d90ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Wed, 16 Nov 2022 11:00:44 +0800 Subject: [PATCH 03/43] * fix bug #29733. --- module/project/view/createguide.html.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/project/view/createguide.html.php b/module/project/view/createguide.html.php index 8444eea7d5..a26b4a4076 100644 --- a/module/project/view/createguide.html.php +++ b/module/project/view/createguide.html.php @@ -25,7 +25,10 @@ $colClass = $hasWaterfall ? 'col-xs-4' : 'col-xs-6'; ?>
- tab;?> + tab; + if($tab == 'product') $tab = 'project'; + ?>
createLink("project", "create", "model=scrum&programID=$programID©ProjectID=0&extra=productID=$productID,branchID=$branchID"), "", '', "data-app='{$tab}' class='createButton'")?>

project->scrum; ?>

From 197fcd24c3bfe996cd99453430b96f963fdc13d0 Mon Sep 17 00:00:00 2001 From: chaideqing Date: Wed, 16 Nov 2022 11:10:20 +0800 Subject: [PATCH 04/43] * Fix feedback #1441. --- module/doc/view/content.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/doc/view/content.html.php b/module/doc/view/content.html.php index 4a8670fe38..e0bf9ba33c 100644 --- a/module/doc/view/content.html.php +++ b/module/doc/view/content.html.php @@ -291,7 +291,7 @@ contentType == 'markdown'):?> -content);?> +content));?>