From d88e6d3669b964ebf23ba8122d9ba20a860d640d Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Fri, 17 Mar 2017 10:17:05 +0800 Subject: [PATCH 1/2] * add bug's deadline field to user custom fields in DB. --- module/bug/config.php | 2 +- module/upgrade/model.php | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/module/bug/config.php b/module/bug/config.php index 0818cbe1c4..7b21db695a 100644 --- a/module/bug/config.php +++ b/module/bug/config.php @@ -43,7 +43,7 @@ $config->bug->list->customBatchEditFields = 'type,severity,pri,productplan,ass $config->bug->custom = new stdclass(); $config->bug->custom->createFields = $config->bug->list->customCreateFields; $config->bug->custom->batchCreateFields = 'module,project,steps,type,severity,os,browser'; -$config->bug->custom->batchEditFields = 'type,severity,pri,assignedTo,status,resolvedBy,resolution'; +$config->bug->custom->batchEditFields = 'type,severity,pri,assignedTo,deadline,status,resolvedBy,resolution'; $config->bug->editor = new stdclass(); $config->bug->editor->create = array('id' => 'steps', 'tools' => 'bugTools'); diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 2d1ebd53de..fffc2edd2e 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -166,6 +166,8 @@ class upgradeModel extends model $this->adjustPriv9_0(); case '9_0': $this->fixProjectProductData(); + case '9_0_1': + $this->addBugDeadlineToCustomFields(); } $this->deletePatch(); @@ -1587,4 +1589,31 @@ class upgradeModel extends model if(strpos($fromVersion, 'pro') === false ? $fromVersion < '8.3' : $fromVersion < 'pro5.4') $needProcess['updateFile'] = true; return $needProcess; } + + public function addBugDeadlineToCustomFields() + { + $createFieldsItems = $this->dao->select('id, value')->from(TABLE_CONFIG) + ->where('module')->eq('bug') + ->andWhere('section')->eq('custom') + ->andWhere('`key`')->eq('createFields') + ->fetchAll(); + $batchEditFieldsItems = $this->dao->select('id, value')->from(TABLE_CONFIG) + ->where('module')->eq('bug') + ->andWhere('section')->eq('custom') + ->andWhere('`key`')->eq('batchEditFields') + ->fetchAll(); + + foreach($createFieldsItems as $createFieldsItem) + { + $value = empty($createFieldsItem->value) ? 'deadline' : $createFieldsItem->value . ",deadline"; + $this->dao->update(TABLE_CONFIG)->set('value')->eq($value)->where('id')->eq($createFieldsItem->id)->exec(); + } + foreach($batchEditFieldsItems as $batchEditFieldsItem) + { + $value = empty($batchEditFieldsItem->value) ? 'deadline' : $batchEditFieldsItem->value . ",deadline"; + $this->dao->update(TABLE_CONFIG)->set('value')->eq($value)->where('id')->eq($batchEditFieldsItem->id)->exec(); + } + + return true; + } } From bf66b705d4468ac39e76b4ff5c70d545189bb9d1 Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Fri, 17 Mar 2017 10:19:00 +0800 Subject: [PATCH 2/2] * remove duplicate deadline in view file of bug's edit method. --- module/bug/view/edit.html.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/module/bug/view/edit.html.php b/module/bug/view/edit.html.php index 7584d014ab..95441cef29 100644 --- a/module/bug/view/edit.html.php +++ b/module/bug/view/edit.html.php @@ -201,10 +201,6 @@ js::set('oldResolvedBuild' , $bug->resolvedBuild); - - bug->deadline;?> - deadline, "class='form-control form-date'");?> - bug->resolvedBy;?> resolvedBy, "class='form-control chosen'");?>