* Code for task#47995.
This commit is contained in:
@@ -193,7 +193,7 @@ $lang->action->desc->syncexecution = '$date, starting the task sets the e
|
||||
$lang->action->desc->importfromgitlab = '$date, Issue associate created from gitlab by <strong>$actor</strong>.' . "\n";
|
||||
$lang->action->desc->archived = '$date, archived by <strong>$actor</strong>.' . "\n";
|
||||
$lang->action->desc->restore = '$date, restore by <strong>$actor</strong>.' . "\n";
|
||||
$lang->action->desc->imported = '$date, imported by <strong>$actor</strong> .' . "\n";
|
||||
$lang->action->desc->importedcard = '$date, imported to <strong>$extra</strong> by <strong>$actor</strong>.' . "\n";
|
||||
|
||||
/* Used to describe the history of operations related to parent-child tasks. */
|
||||
$lang->action->desc->createchildren = '$date, <strong>$actor</strong> created a child task <strong>$extra</strong>。' . "\n";
|
||||
@@ -333,7 +333,7 @@ $lang->action->label->closedbychild = 'closed';
|
||||
$lang->action->label->activatedbychild = 'activated';
|
||||
$lang->action->label->createchild = 'activated';
|
||||
$lang->action->label->executed = 'executed';
|
||||
$lang->action->label->imported = 'imported';
|
||||
$lang->action->label->importedcard = 'imported';
|
||||
|
||||
/* Dynamic information is grouped by object. */
|
||||
$lang->action->dynamicAction = new stdclass;
|
||||
|
||||
@@ -193,7 +193,7 @@ $lang->action->desc->syncexecution = '$date, 系统判断由于任务开
|
||||
$lang->action->desc->importfromgitlab = '$date, 由 <strong>$actor</strong> 从Gitlab的Issue关联创建。' . "\n";
|
||||
$lang->action->desc->archived = '$date, 由 <strong>$actor</strong> 归档。' . "\n";
|
||||
$lang->action->desc->restore = '$date, 由 <strong>$actor</strong> 还原。' . "\n";
|
||||
$lang->action->desc->imported = '$date, 由 <strong>$actor</strong> 导入。' . "\n";
|
||||
$lang->action->desc->importedcard = '$date, 由 <strong>$actor</strong> 从看板 <strong>$extra</strong> 导入。' . "\n";
|
||||
|
||||
/* 用来描述和父子任务相关的操作历史记录。*/
|
||||
$lang->action->desc->createchildren = '$date, 由 <strong>$actor</strong> 创建子任务 <strong>$extra</strong>。' . "\n";
|
||||
@@ -333,7 +333,7 @@ $lang->action->label->closedbychild = '关闭了';
|
||||
$lang->action->label->activatedbychild = '激活了';
|
||||
$lang->action->label->createchild = '激活了';
|
||||
$lang->action->label->executed = '执行了';
|
||||
$lang->action->label->imported = '导入了';
|
||||
$lang->action->label->importedcard = '导入了';
|
||||
|
||||
/* 动态信息按照对象分组 */
|
||||
$lang->action->dynamicAction = new stdclass();
|
||||
|
||||
@@ -435,6 +435,11 @@ class actionModel extends model
|
||||
$title = $this->dao->select('title')->from(TABLE_STORY)->where('id')->eq($action->extra)->fetch('title');
|
||||
if($title) $action->extra = common::hasPriv('story', 'view') ? html::a(helper::createLink('story', 'view', "storyID=$action->extra"), "#$action->extra " . $title) : "#$action->extra " . $title;
|
||||
}
|
||||
elseif($actionName == 'importedcard')
|
||||
{
|
||||
$title = $this->dao->select('name')->from(TABLE_KANBAN)->where('id')->eq($action->extra)->fetch('name');
|
||||
if($title) $action->extra = common::hasPriv('kanban', 'view') ? html::a(helper::createLink('kanban', 'view', "kanbanID=$action->extra"), "#$action->extra " . $title) : "#$action->extra " . $title;
|
||||
}
|
||||
elseif($actionName == 'createchildren')
|
||||
{
|
||||
$names = $this->dao->select('id,name')->from(TABLE_TASK)->where('id')->in($action->extra)->fetchPairs('id', 'name');
|
||||
|
||||
@@ -792,6 +792,12 @@ class kanban extends control
|
||||
*/
|
||||
public function importCard($kanbanID = 0, $regionID = 0, $groupID = 0, $columnID = 0, $selectedKanbanID = 0, $recTotal = 0, $recPerPage = 30, $pageID = 1)
|
||||
{
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$cards2Imported = $this->kanban->getImportedCards($selectedKanbanID, $kanbanID, $pager);
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
$importedIDList = $this->kanban->importCard($kanbanID, $regionID, $groupID, $columnID);
|
||||
@@ -799,38 +805,17 @@ class kanban extends control
|
||||
|
||||
foreach($importedIDList as $cardID)
|
||||
{
|
||||
$this->loadModel('action')->create('kanbancard', $cardID, 'imported');
|
||||
$this->loadModel('action')->create('kanbancard', $cardID, 'importedcard', '', $cards2Imported[$cardID]->kanban);
|
||||
}
|
||||
|
||||
return print(js::locate($this->createLink('kanban', 'view', "kanbanID=$kanbanID"), 'parent.parent'));
|
||||
}
|
||||
|
||||
/* Get cards to imported. */
|
||||
$cards2Imported = array();
|
||||
if($selectedKanbanID)
|
||||
{
|
||||
$cards2Imported = $this->kanban->getCardsByObject('kanban', $selectedKanbanID);
|
||||
}
|
||||
else
|
||||
{
|
||||
$allKanbanCards = $this->kanban->getCardsByObject();
|
||||
foreach($allKanbanCards as $card)
|
||||
{
|
||||
if($card->kanban != $kanbanID) $cards2Imported[$card->id] = $card;
|
||||
}
|
||||
}
|
||||
|
||||
/* Pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$recTotal = count($cards2Imported);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
$cards2Imported = array_chunk($cards2Imported, $pager->recPerPage);
|
||||
|
||||
/* Find Kanban other than this kanban. */
|
||||
$kanbanPairs = $this->kanban->getKanbanPairs();
|
||||
unset($kanbanPairs[$kanbanID]);
|
||||
|
||||
$this->view->cards2Imported = empty($cards2Imported) ? $cards2Imported : $cards2Imported[$pageID - 1];
|
||||
$this->view->cards2Imported = $cards2Imported;
|
||||
$this->view->kanbanPairs = array($this->lang->kanban->all) + $kanbanPairs;
|
||||
$this->view->lanePairs = $this->kanban->getLanePairsByGroup($groupID);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted');
|
||||
|
||||
+37
-12
@@ -484,6 +484,8 @@ class kanbanModel extends model
|
||||
$importIDList = $data->cards;
|
||||
$targetLaneID = $data->targetLane;
|
||||
|
||||
$oldCardsKanban = $this->dao->select('id,kanban')->from(TABLE_KANBANCARD)->where('id')->in($importIDList)->fetchPairs();
|
||||
|
||||
$updateData = new stdClass();
|
||||
$updateData->kanban = $kanbanID;
|
||||
$updateData->region = $regionID;
|
||||
@@ -492,7 +494,7 @@ class kanbanModel extends model
|
||||
|
||||
if(!dao::isError())
|
||||
{
|
||||
$this->removeKanbanCell('common', $importIDList);
|
||||
$this->removeKanbanCell('common', $importIDList, $oldCardsKanban);
|
||||
|
||||
$cards = implode(',', $importIDList);
|
||||
$this->addKanbanCell($kanbanID, $targetLaneID, $columnID, 'common', $cards);
|
||||
@@ -2004,25 +2006,27 @@ class kanbanModel extends model
|
||||
/**
|
||||
* Remove kanban cell.
|
||||
*
|
||||
* @param string $type
|
||||
* @param int|array $removeCardID
|
||||
* @param array $cardsKanban
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function removeKanbanCell($type, $removeCardID = 0)
|
||||
public function removeKanbanCell($type, $removeCardID, $cardsKanban)
|
||||
{
|
||||
if(is_array($removeCardID))
|
||||
$removeIDList = is_array($removeCardID) ? $removeCardID : array($removeCardID);
|
||||
foreach($removeIDList as $cardID)
|
||||
{
|
||||
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'");
|
||||
if(empty($cardID)) continue;
|
||||
|
||||
$this->dbh->query("UPDATE " . TABLE_KANBANCELL. " SET `cards` = REPLACE(cards, ',$cardID,', ',') WHERE `type` = '$type' AND `kanban` = {$cardsKanban[$cardID]}");
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_KANBANCELL)->set('cards')->eq('')->where('cards')->eq(',')->andWhere('type')->eq($type)->exec();
|
||||
$this->dao->update(TABLE_KANBANCELL)
|
||||
->set('cards')->eq('')
|
||||
->where('cards')->eq(',')
|
||||
->andWhere('type')->eq($type)
|
||||
->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3019,6 +3023,27 @@ class kanbanModel extends model
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get imported cards.
|
||||
*
|
||||
* @param int $objectID
|
||||
* @param int $excluded
|
||||
* @param obj $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getImportedCards($kanbanID = 0, $excluded = 0, $pager = null)
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_KANBANCARD)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('archived')->eq(0)
|
||||
->beginIF($kanbanID)->andWhere('kanban')->eq($kanbanID)->fi()
|
||||
->beginIF($excluded)->andWhere('kanban')->ne($excluded)->fi()
|
||||
->orderBy('order')
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Kanban cards menus by execution id.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user