From 980facb4516877779663223a3d59c1b82ddd0f84 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 25 Jan 2022 16:20:25 +0800 Subject: [PATCH 1/2] * Fix bug #18890. --- module/upgrade/model.php | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 4d450bcc0b..489d77199a 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -750,6 +750,11 @@ class upgradeModel extends model $this->execSQL($this->getUpgradeFile('16.1')); $this->moveKanbanData(); $this->appendExec('16_1'); + case '16_2': + $this->saveLogs('Execute 16_2'); + $this->execSQL($this->getUpgradeFile('16.2')); + $this->addSpaceTeam(); + $this->appendExec('16_2'); } $this->deletePatch(); @@ -5372,8 +5377,8 @@ class upgradeModel extends model } /** - * Move kanban card data to kanbancell table. - * + * Move kanban card data to kanbancell table. + * * @access public * @return void */ @@ -5445,6 +5450,33 @@ class upgradeModel extends model $this->dao->exec("ALTER TABLE " . TABLE_KANBANCOLUMN . " DROP COLUMN `cards`;"); } + /** + * Update kanban space team. + * + * @access public + * @return void + */ + public function updateSpaceTeam() + { + $kanbanUsers = $this->dao->select("space, CONCAT(owner, ',', team) as users") ->from(TABLE_KANBAN)->fetchAll('space'); + $spaceUsers = $this->dao->select("id, CONCAT(owner, ',', team) as users")->from(TABLE_KANBANSPACE)->fetchAll('id'); + + foreach($kanbanUsers as $spaceID => $kanban) + { + $team = trim(zget($spaceUsers, $spaceID)->users, ','); + $team = $team . ',' . $kanban->users; + $team = explode(',', $team); + $team = array_filter($team); + $team = array_flip($team); + $team = array_unique($team); + $team = array_flip($team); + $team = implode(',', $team); + $team = trim($team, ','); + + $this->dao->update(TABLE_KANBANSPACE)->set('`team`')->eq($team)->where('id')->eq($spaceID)->exec(); + } + } + /** * Adjust for bug required field. * From 644f0fe851027326073b8a22844bae2801fbe417 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 25 Jan 2022 16:43:15 +0800 Subject: [PATCH 2/2] * Fix bug #18890. --- module/upgrade/model.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 489d77199a..2e6cec50c4 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -5463,13 +5463,11 @@ class upgradeModel extends model foreach($kanbanUsers as $spaceID => $kanban) { - $team = trim(zget($spaceUsers, $spaceID)->users, ','); + $team = zget($spaceUsers, $spaceID)->users; $team = $team . ',' . $kanban->users; $team = explode(',', $team); $team = array_filter($team); - $team = array_flip($team); $team = array_unique($team); - $team = array_flip($team); $team = implode(',', $team); $team = trim($team, ',');