From 7c2244c088ae2dcc61c9d5c70ee3d78694cf0e4f Mon Sep 17 00:00:00 2001 From: zenggang Date: Thu, 8 Sep 2022 00:46:20 +0000 Subject: [PATCH] * Code for task#67792 --- db/update17.6.sql | 2 ++ module/tree/model.php | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/db/update17.6.sql b/db/update17.6.sql index 1d60b73fd5..8e93ee9988 100644 --- a/db/update17.6.sql +++ b/db/update17.6.sql @@ -13,3 +13,5 @@ CREATE TABLE `zt_taskteam` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `zt_taskestimate` ADD `order` tinyint unsigned 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'); diff --git a/module/tree/model.php b/module/tree/model.php index e7e402c840..18abfd4038 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -1591,7 +1591,7 @@ class treeModel extends model public function updateOrder($orders) { asort($orders); - $orderInfo = $this->dao->select('id,grade, parent, branch')->from(TABLE_MODULE)->where('id')->in(array_keys($orders))->andWhere('deleted')->eq(0)->fetchAll('id'); + $orderInfo = $this->dao->select('*')->from(TABLE_MODULE)->where('id')->in(array_keys($orders))->andWhere('deleted')->eq(0)->fetchAll('id'); $newOrders = array(); foreach($orders as $moduleID => $order) { @@ -1610,6 +1610,12 @@ class treeModel extends model $newOrder = $newOrders[$parent][$grade][$branch] * 10; $this->dao->update(TABLE_MODULE)->set('`order`')->eq($newOrder)->where('id')->eq((int)$moduleID)->limit(1)->exec(); + + $module = $orderInfo[$moduleID]; + if($module->type == 'story' and $this->config->global->syncProductFeedback >= $module->grade) + { + $this->loadModel('feedback')->syncTrigger($moduleID, 'update', $module); + } } } @@ -1693,6 +1699,11 @@ class treeModel extends model $createIdList[] = $moduleID; $childPath = $parentPath . "$moduleID,"; $this->dao->update(TABLE_MODULE)->set('path')->eq($childPath)->where('id')->eq($moduleID)->limit(1)->exec(); + + if($type == 'story' and $this->config->global->syncProductFeedback >= $module->grade) + { + $this->loadModel('feedback')->syncTrigger($moduleID, 'insert'); + } } else { @@ -1716,6 +1727,11 @@ class treeModel extends model $editIdList[] = $moduleID; $moduleChanges[$moduleID] = common::createChanges($oldModule, $newModule); } + + if($type == 'story' and $this->config->global->syncProductFeedback >= $module->grade) + { + $this->loadModel('feedback')->syncTrigger($moduleID, 'update', $oldModule); + } } } @@ -1922,6 +1938,11 @@ class treeModel extends model $this->dao->update(TABLE_BUG)->set('module')->eq($module->parent)->where('module')->in($childs)->exec(); $this->dao->update(TABLE_CASE)->set('module')->eq($module->parent)->where('module')->in($childs)->exec(); $cookieName = 'storyModule'; + + if($this->config->global->syncProductFeedback >= $module->grade) + { + $this->loadModel('feedback')->syncTrigger($moduleID, 'delete'); + } break; } if(strpos($this->session->{$module->type . 'List'}, 'param=' . $moduleID)) $this->session->set($module->type . 'List', str_replace('param=' . $moduleID, 'param=0', $this->session->{$module->type . 'List'}));