From 7f0e4e13f8fa94ef6d957abc8bbce8969bc8a7f6 Mon Sep 17 00:00:00 2001 From: z Date: Tue, 24 Nov 2020 10:17:24 +0800 Subject: [PATCH 1/3] * adjust for upgrade. --- module/upgrade/model.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 12cd436d86..757d06878a 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -632,6 +632,16 @@ class upgradeModel extends model $this->setWork2Full(); $this->initUserView(); $this->appendExec('20_0_alpha'); + case '20_0_alpha1': + $this->saveLogs('Execute 20_0_alpha1'); + + if(strpos($fromVersion, '20') !== 0) + { + $this->execSQL($this->getUpgradeFile('12.4.4')); + $this->adjustPriv12_5(); + } + + $this->appendExec('20_0_alpha1'); } $this->deletePatch(); From 3c7da6dc609dd9742bb807c9bf4f2cd0bd8fd901 Mon Sep 17 00:00:00 2001 From: z Date: Tue, 24 Nov 2020 14:15:37 +0800 Subject: [PATCH 2/3] * code for task #8496. --- module/common/lang/zh-cn.php | 1 + module/custom/control.php | 4 ++-- module/custom/lang/zh-cn.php | 3 +-- module/custom/view/header.html.php | 2 +- module/testcase/model.php | 18 ++++++++++-------- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index 12db180906..85f118b02c 100755 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -492,6 +492,7 @@ $lang->admin->menu = new stdclass(); $lang->admin->menu->index = array('link' => '首页|admin|index', 'alias' => 'register,certifytemail,certifyztmobile,ztcompany'); $lang->admin->menu->company = array('link' => '人员|company|browse|', 'subModule' => ',user,dept,group,', 'alias' => ',dynamic,view,'); $lang->admin->menu->message = array('link' => '通知|message|index', 'subModule' => 'message,mail,webhook'); +$lang->admin->menu->custom = array('link' => '自定义|custom|index', 'subModule' => 'custom'); $lang->admin->menu->data = array('link' => '数据|backup|index', 'subModule' => 'backup,action'); $lang->admin->menu->safe = array('link' => '安全|admin|safe', 'alias' => 'checkweak'); $lang->admin->menu->system = array('link' => '系统|cron|index', 'subModule' => 'cron,search'); diff --git a/module/custom/control.php b/module/custom/control.php index ba819e2221..31ca3af33c 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -19,9 +19,9 @@ class custom extends control */ public function index() { + if(common::hasPriv('custom', 'set')) die(js::locate(inlink('set', "module=program&field=" . key($this->lang->custom->program->fields)))); if(common::hasPriv('custom', 'product')) die(js::locate(inlink('product'))); if(common::hasPriv('custom', 'project')) die(js::locate(inlink('project'))); - if(common::hasPriv('custom', 'set')) die(js::locate(inlink('set'))); foreach($this->lang->custom->system as $sysObject) { @@ -41,7 +41,7 @@ class custom extends control public function set($module = 'story', $field = 'priList', $lang = '') { if(empty($lang)) $lang = $this->app->getClientLang(); - if($module == 'user' and $field == 'priList') $field = 'roleList'; + if($module == 'user' and $field == 'priList') $field = 'statusList'; if($module == 'block' and $field == 'priList')$field = 'closed'; $currentLang = $this->app->getClientLang(); diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php index b06e07ab56..1c0809b32f 100644 --- a/module/custom/lang/zh-cn.php +++ b/module/custom/lang/zh-cn.php @@ -125,12 +125,11 @@ $lang->custom->todo->fields['typeList'] = '类型'; $lang->custom->todo->fields['statusList'] = '状态'; $lang->custom->user = new stdClass(); -$lang->custom->user->fields['roleList'] = '职位'; $lang->custom->user->fields['statusList'] = '状态'; $lang->custom->user->fields['contactField'] = '可用联系方式'; $lang->custom->user->fields['deleted'] = '列出已删除用户'; -$lang->custom->system = array('flow', 'working', 'required', 'score', 'estimate'); +$lang->custom->system = array('required', 'score', 'estimate'); $lang->custom->block->fields['closed'] = '关闭的区块'; diff --git a/module/custom/view/header.html.php b/module/custom/view/header.html.php index 5d505b1c84..f2644be41e 100644 --- a/module/custom/view/header.html.php +++ b/module/custom/view/header.html.php @@ -5,7 +5,7 @@ foreach($lang->custom->object as $object => $name) { if(strpos('project|product', $object) !== false) common::printLink('custom', $object, "", "{$lang->custom->$object}", '', "class='btn btn-link' id='{$object}Tab'"); - if(strpos('project|product', $object) === false) common::printLink('custom', 'set', "module=$object", "{$name}", '', "class='btn btn-link' id='{$object}Tab'"); + if(strpos('project|product', $object) === false) common::printLink('custom', 'set', "module=$object&field=" . key($lang->custom->{$object}->fields), "{$name}", '', "class='btn btn-link' id='{$object}Tab'"); } foreach($lang->custom->system as $sysObject) diff --git a/module/testcase/model.php b/module/testcase/model.php index 1c0048ec8d..f96178707b 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -1275,6 +1275,7 @@ class testcaseModel extends model $libCases = $this->dao->select('*')->from(TABLE_CASE)->where('deleted')->eq(0)->andWhere('id')->in($data->caseIdList)->fetchAll('id'); $libSteps = $this->dao->select('*')->from(TABLE_CASESTEP)->where('`case`')->in($data->caseIdList)->orderBy('id')->fetchGroup('case'); + $libFiles = $this->dao->select('*')->from(TABLE_FILE)->where('objectID')->in($data->caseIdList)->andWhere('objectType')->eq('testcase')->fetchGroup('objectID', 'id'); foreach($libCases as $libCaseID => $case) { $case->fromCaseID = $case->id; @@ -1298,16 +1299,17 @@ class testcaseModel extends model $this->dao->insert(TABLE_CASESTEP)->data($step)->exec(); } } + /* Fix bug #1518. */ - $oldFile = $this->dao->select('*')->from(TABLE_FILE)->where('objectID')->eq($case->fromCaseID)->fetchAll(); - foreach($oldFile as $fileID => $File) + $oldFiles = zget($libFiles, $libCaseID, array()); + foreach($oldFiles as $fileID => $file) { - $File->objectID = $caseID; - $File->addedBy = $this->app->user->account; - $File->addedDate = helper::today(); - $File->downloads = 0; - unset($File->id); - $this->dao->insert(TABLE_FILE)->data($File)->exec(); + $file->objectID = $caseID; + $file->addedBy = $this->app->user->account; + $file->addedDate = helper::now(); + $file->downloads = 0; + unset($file->id); + $this->dao->insert(TABLE_FILE)->data($file)->exec(); } $this->loadModel('action')->create('case', $caseID, 'fromlib', '', $case->lib); } From bef31945493298705b2eba6b15942e6d7a16e50e Mon Sep 17 00:00:00 2001 From: z Date: Tue, 24 Nov 2020 15:34:00 +0800 Subject: [PATCH 3/3] * code for task #8496. --- module/custom/config.php | 9 ++++++-- module/custom/model.php | 7 +++++- module/program/model.php | 31 +++++++++++++++++++------- module/program/view/pgmcreate.html.php | 7 +++--- module/program/view/pgmedit.html.php | 7 +++--- module/program/view/prjcreate.html.php | 7 +++--- module/program/view/prjedit.html.php | 7 +++--- 7 files changed, 52 insertions(+), 23 deletions(-) diff --git a/module/custom/config.php b/module/custom/config.php index f2efb71885..3afd1d0b25 100644 --- a/module/custom/config.php +++ b/module/custom/config.php @@ -12,6 +12,7 @@ $config->custom->canAdd['program'] = 'unitList'; $config->custom->noModuleMenu = array(); +$config->custom->requiredModules[10] = 'program'; $config->custom->requiredModules[15] = 'product'; $config->custom->requiredModules[20] = 'story'; $config->custom->requiredModules[25] = 'productplan'; @@ -32,8 +33,12 @@ $config->custom->requiredModules[80] = 'doc'; $config->custom->requiredModules[85] = 'user'; -$config->custom->fieldList['product']['create'] = 'line,PO,QD,RD,type,desc'; -$config->custom->fieldList['product']['edit'] = 'line,PO,QD,RD,type,desc,status'; +$config->custom->fieldList['program']['PGMCreate'] = 'budget,PM,desc'; +$config->custom->fieldList['program']['PGMEdit'] = 'budget,PM,desc'; +$config->custom->fieldList['program']['PRJCreate'] = 'budget,PM,desc'; +$config->custom->fieldList['program']['PRJEdit'] = 'budget,PM,desc'; +$config->custom->fieldList['product']['create'] = 'PO,QD,RD,type,desc'; +$config->custom->fieldList['product']['edit'] = 'PO,QD,RD,type,desc,status'; $config->custom->fieldList['story']['create'] = 'module,plan,source,pri,estimate,keywords'; $config->custom->fieldList['story']['change'] = 'comment'; $config->custom->fieldList['story']['close'] = 'comment'; diff --git a/module/custom/model.php b/module/custom/model.php index 377264e00a..5eabf7e608 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -476,6 +476,12 @@ class customModel extends model if($moduleName == 'user' and $method == 'edit' and strpos($this->config->user->contactField, $fieldName) === false) continue; if($fieldName == 'comment') $fields[$fieldName] = $this->lang->comment; if(isset($moduleLang->$fieldName) and is_string($moduleLang->$fieldName)) $fields[$fieldName] = $moduleLang->$fieldName; + + if($moduleName == 'program') + { + $fieldKey = substr($method, 0, 3) . ucfirst($fieldName); + if(isset($moduleLang->$fieldKey) and is_string($moduleLang->$fieldKey)) $fields[$fieldName] = $moduleLang->$fieldKey; + } } } return $fields; @@ -502,7 +508,6 @@ class customModel extends model { foreach($data->requiredFields as $method => $fields) { - $method = strtolower($method); $systemField = $this->config->$moduleName->$method->requiredFields; $fields = join(',', $fields); diff --git a/module/program/model.php b/module/program/model.php index d15a18c4e1..ec84affc81 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -145,8 +145,11 @@ class programModel extends model } /* Redefines the language entries for the fields in the project table. */ - $this->lang->project->code = $this->lang->program->PGMCode; - $this->lang->project->name = $this->lang->program->PGMName; + foreach(explode(',', $this->config->program->PGMCreate->requiredFields) as $fieldName) + { + $fieldKey = 'PGM' . ucfirst($fieldName); + if(isset($this->lang->program->$fieldKey)) $this->lang->project->$fieldName = $this->lang->program->$fieldKey; + } $program = $this->loadModel('file')->processImgURL($program, $this->config->program->editor->pgmcreate['id'], $this->post->uid); $this->dao->insert(TABLE_PROGRAM)->data($program) @@ -246,8 +249,12 @@ class programModel extends model if(dao::isError()) return false; /* Redefines the language entries for the fields in the project table. */ - $this->lang->project->code = $this->lang->program->PGMCode; - $this->lang->project->name = $this->lang->program->PGMName; + foreach(explode(',', $this->config->program->PGMCreate->requiredFields) as $fieldName) + { + $fieldKey = 'PGM' . ucfirst($fieldName); + if(isset($this->lang->program->$fieldKey)) $this->lang->project->$fieldName = $this->lang->program->$fieldKey; + } + $this->dao->update(TABLE_PROGRAM)->data($program) ->autoCheck($skipFields = 'begin,end') ->batchcheck($this->config->program->PGMEdit->requiredFields, 'notempty') @@ -1226,8 +1233,12 @@ class programModel extends model if($this->post->delta == 999) $requiredFields = trim(str_replace(',end,', ',', ",{$requiredFields},"), ','); /* Redefines the language entries for the fields in the project table. */ - $this->lang->project->name = $this->lang->program->PRJName; - $this->lang->project->code = $this->lang->program->PRJCode; + foreach(explode(',', $requiredFields) as $fieldName) + { + $fieldKey = 'PRJ' . ucfirst($fieldName); + if(isset($this->lang->program->$fieldKey)) $this->lang->project->$fieldName = $this->lang->program->$fieldKey; + } + $project = $this->loadModel('file')->processImgURL($project, $this->config->program->editor->prjcreate['id'], $this->post->uid); $this->dao->insert(TABLE_PROJECT)->data($project) ->autoCheck() @@ -1361,8 +1372,12 @@ class programModel extends model if($this->post->delta == 999) $requiredFields = trim(str_replace(',end,', ',', ",{$requiredFields},"), ','); /* Redefines the language entries for the fields in the project table. */ - $this->lang->project->name = $this->lang->program->PRJName; - $this->lang->project->code = $this->lang->program->PRJCode; + foreach(explode(',', $requiredFields) as $fieldName) + { + $fieldKey = 'PRJ' . ucfirst($fieldName); + if(isset($this->lang->program->$fieldKey)) $this->lang->project->$fieldName = $this->lang->program->$fieldKey; + } + $this->dao->update(TABLE_PROJECT)->data($project) ->autoCheck($skipFields = 'begin,end') ->batchcheck($requiredFields, 'notempty') diff --git a/module/program/view/pgmcreate.html.php b/module/program/view/pgmcreate.html.php index 286243ba69..c7e8126b5b 100644 --- a/module/program/view/pgmcreate.html.php +++ b/module/program/view/pgmcreate.html.php @@ -34,6 +34,7 @@ project->weekend);?> project->placeholder);?> project->errorSameProducts);?> +program->PGMCreate->requiredFields;?>
@@ -57,7 +58,7 @@ program->PGMPM;?> - + program->PO;?> @@ -67,7 +68,7 @@ program->PGMBudget;?>
- + program->unitList, empty($parentProgram->budgetUnit) ? 'yuan' : $parentProgram->budgetUnit, "class='form-control'");?>
@@ -97,7 +98,7 @@ program->PGMDesc;?> fetch('user', 'ajaxPrintTemplates', 'type=project&link=desc');?> - + diff --git a/module/program/view/pgmedit.html.php b/module/program/view/pgmedit.html.php index af6fda1c73..6eb00316c2 100644 --- a/module/program/view/pgmedit.html.php +++ b/module/program/view/pgmedit.html.php @@ -14,6 +14,7 @@ project->weekend);?> parent ? $lang->program->subPGMAclList : $lang->program->PGMAclList;?> +program->PGMEdit->requiredFields;?>
@@ -36,7 +37,7 @@ program->PGMPM;?> - PM, "class='form-control chosen'");?> + PM, "class='form-control chosen'" . (strpos($requiredFields, 'PM') !== false ? ' required' : ''));?> program->PO;?> @@ -44,7 +45,7 @@ program->PGMBudget;?> - budget, "class='form-control'");?> + budget, "class='form-control'" . (strpos($requiredFields, 'budget') !== false ? ' required' : ''));?> program->unitList, $program->budgetUnit, "class='form-control'");?> @@ -68,7 +69,7 @@ program->PGMDesc;?> fetch('user', 'ajaxPrintTemplates', 'type=program&link=desc');?> - desc, "rows='6' class='form-control kindeditor' hidefocus='true'");?> + desc, "rows='6' class='form-control kindeditor' hidefocus='true'" . (strpos($requiredFields, 'desc') !== false ? ' required' : ''));?> diff --git a/module/program/view/prjcreate.html.php b/module/program/view/prjcreate.html.php index 2764b130a0..b21d68e427 100644 --- a/module/program/view/prjcreate.html.php +++ b/module/program/view/prjcreate.html.php @@ -45,6 +45,7 @@ else project->weekend);?> program->errorSameProducts);?> +program->PRJCreate->requiredFields;?>
@@ -120,13 +121,13 @@ else program->PRJPM;?> - + program->PRJBudget;?>
- + program->unitList, empty($parentProgram->budgetUnit) ? 'yuan' : $parentProgram->budgetUnit, "class='form-control'");?>
@@ -160,7 +161,7 @@ else program->PRJDesc;?> fetch('user', 'ajaxPrintTemplates', 'type=project&link=desc');?> - + diff --git a/module/program/view/prjedit.html.php b/module/program/view/prjedit.html.php index edfa69b101..0af9033e3f 100644 --- a/module/program/view/prjedit.html.php +++ b/module/program/view/prjedit.html.php @@ -19,6 +19,7 @@ id);?> program->PGMChangeTips);?> parent ? $lang->program->PGMPRJAclList : $lang->program->PRJAclList;?> +program->PRJEdit->requiredFields;?>
@@ -91,13 +92,13 @@ program->PRJPM;?> - PM, "class='form-control chosen'");?> + PM, "class='form-control chosen'" . (strpos($requiredFields, 'PM') !== false ? ' required' : ''));?> program->PRJBudget;?>
- budget, "class='form-control'");?> + budget, "class='form-control'" . (strpos($requiredFields, 'budget') !== false ? ' required' : ''));?> program->unitList, $project->budgetUnit, "class='form-control'");?>
@@ -136,7 +137,7 @@ program->PRJDesc;?> fetch('user', 'ajaxPrintTemplates', 'type=project&link=desc');?> - desc, "rows='6' class='form-control kindeditor' hidefocus='true'");?> + desc, "rows='6' class='form-control kindeditor' hidefocus='true'" . (strpos($requiredFields, 'desc') !== false ? ' required' : ''));?>