From 2bfd25b61054394b543ab1d99d2255bdf0a9c7bb Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Fri, 21 Jan 2022 11:15:54 +0800 Subject: [PATCH] * Add function of removeKanbanCell. --- module/kanban/model.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/module/kanban/model.php b/module/kanban/model.php index b0c428638d..b09e9abdbc 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -492,6 +492,8 @@ class kanbanModel extends model if(!dao::isError()) { + $this->removeKanbanCell('common', $importIDList); + $cards = implode(',', $importIDList); $this->addKanbanCell($kanbanID, $targetLaneID, $columnID, 'common', $cards); @@ -1999,6 +2001,30 @@ class kanbanModel extends model } } + /** + * Remove kanban cell. + * + * @param int|array $removeCardID + * @access public + * @return void + */ + public function removeKanbanCell($type, $removeCardID = 0) + { + if(is_array($removeCardID)) + { + foreach($removeCardID as $cardID) + { + $this->dbh->query("UPDATE " . TABLE_KANBANCELL. " SET cards = REPLACE(cards, ',{$cardID},', ',') WHERE type = '$type'"); + } + } + else + { + $this->dbh->query("UPDATE " . TABLE_KANBANCELL. " SET cards = REPLACE(cards, ',{$removeCardID},', ',') WHERE type = '$type'"); + } + + $this->dao->update(TABLE_KANBANCELL)->set('cards')->eq('')->where('cards')->eq(',')->andWhere('type')->eq($type)->exec(); + } + /** * Create a default RD kanban. *