* Finish task #72201,72130,72129.

This commit is contained in:
tanghucheng
2022-10-18 15:04:35 +08:00
parent e32b0bf2ff
commit ccd017af47
8 changed files with 68 additions and 9 deletions
+1
View File
@@ -4,3 +4,4 @@ ALTER TABLE `zt_kanban` ADD `maxColWidth` smallint(4) NOT NULL DEFAULT '384' AFT
ALTER TABLE `zt_project` ADD `colWidth` smallint(4) NOT NULL DEFAULT '264' AFTER `fluidBoard`;
ALTER TABLE `zt_project` ADD `minColWidth` smallint(4) NOT NULL DEFAULT '180' AFTER `colWidth`;
ALTER TABLE `zt_project` ADD `maxColWidth` smallint(4) NOT NULL DEFAULT '384' AFTER `minColWidth`;
REPLACE INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', 'global', 'syncProductFeedback', '{}');
-2
View File
@@ -13,7 +13,5 @@ CREATE TABLE `zt_taskteam` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `zt_taskestimate` ADD `order` tinyint unsigned NOT NULL DEFAULT '0';
ALTER TABLE `zt_effort` ADD `order` tinyint unsigned NOT NULL DEFAULT '0' AFTER `end`;
REPLACE INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', 'global', 'syncProductFeedback', '0');
ALTER TABLE `zt_storyspec` ADD `files` text NOT NULL AFTER `verify`;
ALTER TABLE `zt_block` CHANGE `block` `block` varchar(30) COLLATE 'utf8_general_ci' NOT NULL AFTER `source`;
+1 -1
View File
@@ -6309,7 +6309,7 @@ INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'project', '', 'unitList', 'CNY,USD');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'project', '', 'defaultCurrency', 'CNY');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'story', '', 'reviewRules', 'allpass');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', 'global', 'syncProductFeedback', '0');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', 'global', 'syncProductFeedback', '{}');
-- DROP TABLE IF EXISTS `zt_im_chat`;
CREATE TABLE IF NOT EXISTS `zt_im_chat` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+1 -1
View File
@@ -2313,7 +2313,7 @@ class productModel extends model
}
elseif($module == 'feedback')
{
return helper::createLink($module, $method, "browseType=byProduct&productID=%s");
return helper::createLink('feedback', 'admin', "browseType=byProduct&productID=%s");
}
return $link;
+1 -1
View File
@@ -139,7 +139,7 @@ $closedProductsHtml .= '</ul>';
<a class='pull-right toggle-right-col not-list-item'><?php echo $lang->product->closed?><i class='icon icon-angle-right'></i></a>
<?php if($this->app->tab == 'feedback'):?>
<?php $selected = !$productID ? 'selected' : '';?>
<?php echo html::a(helper::createLink('feedback', 'admin', 'browseType=wait'), $lang->product->all, '', "class='not-list-item pull-left toggle-left-col $selected'"); ?>
<?php echo html::a(helper::createLink('feedback', 'admin', 'browseType=byProduct&param=all'), $lang->product->all, '', "class='not-list-item pull-left toggle-left-col $selected'"); ?>
<?php endif;?>
</div>
</div>
-1
View File
@@ -143,7 +143,6 @@ class tree extends control
$this->view->root = $root;
$title = $this->lang->tree->manageFeedback;
$this->lang->feedback->menu->browse['subMenu'] = new stdclass();
$position[] = html::a($this->createLink('feedback', 'admin'), $this->lang->tree->manageFeedback);
}
elseif($viewType == 'case')
+9 -3
View File
@@ -80,7 +80,10 @@ class treeModel extends model
$startModule = $this->getById($startModule);
if($startModule) $startModulePath = $startModule->path . '%';
}
if($type == 'feedback' and strpos($param, 'noproduct') === false) $type = 'story,' . $type;
/* If feedback module is merge add story module.*/
$syncConfig = json_decode($this->config->global->syncProductFeedback, true);
if($type == 'feedback' and strpos($param, 'noproduct') === false and isset($syncConfig[$rootID])) $type = 'story,' . $type;
if($this->isMergeModule($rootID, $type))
{
return $this->dao->select('*')->from(TABLE_MODULE)
@@ -1378,10 +1381,13 @@ class treeModel extends model
{
if($type == 'line') $rootID = 0;
$syncConfig = json_decode($this->config->global->syncProductFeedback, true);
if($type == 'feedback' and isset($syncConfig[$rootID])) $type = "$type,story";
/* if createVersion <= 4.1 or type == 'story', only get modules of its type. */
if(!$this->isMergeModule($rootID, $type) or $type == 'story')
{
if($type == 'feedback') $type = "$type,story";
return $this->dao->select('*')->from(TABLE_MODULE)
->where('root')->eq((int)$rootID)
->andWhere('parent')->eq((int)$moduleID)
@@ -1397,7 +1403,7 @@ class treeModel extends model
}
/* else get modules of its type and story type. */
if(strpos('task|case|bug|feedback', $type) !== false) $type = "$type,story";
if(strpos('task|case|bug', $type) !== false) $type = "$type,story";
return $this->dao->select('*')->from(TABLE_MODULE)
->where('root')->eq((int)$rootID)
+55
View File
@@ -713,6 +713,9 @@ class upgradeModel extends model
$this->addFlowActions('biz7.4');
$this->addFlowFields('biz7.4');
break;
case 'biz7_6_2':
$this->processFeedbackModule();
}
}
@@ -7508,4 +7511,56 @@ class upgradeModel extends model
}
return true;
}
/**
* Process feedback module
*
* @access public
* @return void
*/
public function processFeedbackModule()
{
$products = $this->dao->select('id, name')->from(TABLE_PRODUCT)->fetchAll();
$modules = $this->dao->select('*')->from(TABLE_MODULE)->where('type')->eq('feedback')->andWhere('root')->eq(0)->fetchAll('id');
$feedbacks = $this->dao->select('*')->from(TABLE_FEEDBACK)->fetchAll();
$allProductRelation = array();
foreach($products as $product)
{
$productID = $product->id;
$relation = array();
foreach($modules as $moduleID => $module)
{
unset($module->id);
$module->root = $productID;
$this->dao->insert(TABLE_MODULE)->data($module)->exec();
$newModuleID = $this->dao->lastInsertID();
$relation[$moduleID] = $newModuleID;
$allProductRelation[$productID][$moduleID] = $newModuleID;
$newPaths = array();
foreach(explode(',', trim($module->path, ',')) as $path)
{
if(isset($relation[$path])) $newPaths[] = $relation[$path];
}
$newPaths = join(',', $newPaths);
$parent = !empty($module->parent) ? $relation[$module->parent] : 0;
$this->dao->update(TABLE_MODULE)->set('path')->eq($newPaths)->set('parent')->eq($parent)->where('id')->eq($newModuleID)->exec();
}
}
/* Update feedback module */
foreach($feedbacks as $feedback)
{
$moduleID = $feedback->module;
$product = $feedback->product;
if(empty($moduleID)) continue;
$newModuleID = isset($allProductRelation[$product][$moduleID]) ? $allProductRelation[$product][$moduleID] : 0;
if(empty($newModuleID)) continue;
$this->dao->update(TABLE_FEEDBACK)->set('module')->eq($newModuleID)->where('id')->eq($feedback->id)->exec();
}
/* Delete history module */
$this->dao->delete()->from(TABLE_MODULE)->where('type')->eq('feedback')->andWhere('root')->eq(0)->exec();
}
}