Merge branch 'pailei2_mayue_task50240' into 'pailei2'

* Fix bug #50240.

See merge request easycorp/zentaopms!2160
This commit is contained in:
孙广明
2022-03-09 06:01:55 +00:00
6 changed files with 23 additions and 31 deletions
+5 -11
View File
@@ -1835,15 +1835,16 @@ class bug extends control
*
* @param int $bugID
* @param string $confirm yes|no
* @param string $from taskkanban
* @access public
* @return void
*/
public function delete($bugID, $confirm = 'no')
public function delete($bugID, $confirm = 'no', $from = '')
{
$bug = $this->bug->getById($bugID);
if($confirm == 'no')
{
return print(js::confirm($this->lang->bug->confirmDelete, inlink('delete', "bugID=$bugID&confirm=yes")));
return print(js::confirm($this->lang->bug->confirmDelete, inlink('delete', "bugID=$bugID&confirm=yes&from=$from")));
}
else
{
@@ -1864,15 +1865,8 @@ class bug extends control
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess));
if($this->app->tab == 'execution')
{
$execution = $this->loadModel('execution')->getByID($bug->execution);
if($execution->type == 'kanban')
{
$locateLink = $this->createLink("execution", "kanban", "executionID={$bug->execution}");
return print(js::locate($locateLink, 'parent.parent'));
}
}
if(isonlybody()) return print(js::reload('parent.parent'));
if($from == 'taskkanban') return print(js::reload('parent'));
$locateLink = $this->session->bugList ? $this->session->bugList : inlink('browse', "productID={$bug->product}");
return print(js::locate($locateLink, 'parent'));
+1
View File
@@ -969,6 +969,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
modalTrigger.show();
}
}
/**
* Delete a card.
*
+1
View File
@@ -859,6 +859,7 @@ function createStoryMenu(options)
if(this.size) item.attrs['data-width'] = this.size;
if(this.icon == 'unlink') item = {label: this.label, icon: this.icon, url: this.url, attrs: {'target': 'hiddenwin'}};
if(this.icon == 'trash') item = {label: this.label, icon: this.icon, url: this.url, attrs: {'target': 'hiddenwin'}};
items.push(item);
});
+3
View File
@@ -3448,6 +3448,7 @@ class kanbanModel extends model
if(common::hasPriv('task', 'batchCreate') and $toTaskPriv) $menu[] = array('label' => $this->lang->execution->batchWBS, 'icon' => 'pluses', 'url' => helper::createLink('task', 'batchCreate', "executionID=$executionID&storyID=$story->id&moduleID=0&taskID=0&iframe=true", '', true), 'size' => '95%');
if(common::hasPriv('story', 'activate') and $this->story->isClickable($story, 'activate')) $menu[] = array('label' => $this->lang->story->activate, 'icon' => 'magic', 'url' => helper::createLink('story', 'activate', "storyID=$story->id", '', true));
if(common::hasPriv('execution', 'unlinkStory')) $menu[] = array('label' => $this->lang->execution->unlinkStory, 'icon' => 'unlink', 'url' => helper::createLink('execution', 'unlinkStory', "executionID=$executionID&storyID=$story->story&confirm=no", '', true));
if(common::hasPriv('story', 'delete')) $menu[] = array('label' => $this->lang->story->delete, 'icon' => 'trash', 'url' => helper::createLink('story', 'delete', "storyID=$story->id&confirm=no&from=taskkanban"));
$menus[$story->id] = $menu;
}
@@ -3466,6 +3467,7 @@ class kanbanModel extends model
if(common::hasPriv('bug', 'create') and $this->bug->isClickable($bug, 'create')) $menu[] = array('label' => $this->lang->bug->copy, 'icon' => 'copy', 'url' => helper::createLink('bug', 'create', "productID=$bug->product&branch=$bug->branch&extras=bugID=$bug->id", '', true), 'size' => '95%');
if(common::hasPriv('bug', 'activate') and $this->bug->isClickable($bug, 'activate')) $menu[] = array('label' => $this->lang->bug->activate, 'icon' => 'magic', 'url' => helper::createLink('bug', 'activate', "bugID=$bug->id", '', true));
if(common::hasPriv('story', 'create') and $bug->status != 'closed') $menu[] = array('label' => $this->lang->bug->toStory, 'icon' => 'lightbulb', 'url' => helper::createLink('story', 'create', "product=$bug->product&branch=$bug->branch&module=0&story=0&execution=0&bugID=$bug->id", '', true), 'size' => '95%');
if(common::hasPriv('bug', 'delete')) $menu[] = array('label' => $this->lang->bug->delete, 'icon' => 'trash', 'url' => helper::createLink('bug', 'delete', "bugID=$bug->id&confirm=no&from=taskkanban"));
$menus[$bug->id] = $menu;
}
@@ -3485,6 +3487,7 @@ class kanbanModel extends model
if(common::hasPriv('task', 'batchCreate') and $this->task->isClickable($task, 'batchCreate')) $menu[] = array('label' => $this->lang->task->children, 'icon' => 'split', 'url' => helper::createLink('task', 'batchCreate', "execution=$task->execution&storyID=$task->story&moduleID=$task->module&taskID=$task->id", '', true), 'size' => '95%');
if(common::hasPriv('task', 'create') and $this->task->isClickable($task, 'create')) $menu[] = array('label' => $this->lang->task->copy, 'icon' => 'copy', 'url' => helper::createLink('task', 'create', "projctID=$task->execution&storyID=$task->story&moduleID=$task->module&taskID=$task->id", '', true), 'size' => '95%');
if(common::hasPriv('task', 'cancel') and $this->task->isClickable($task, 'cancel')) $menu[] = array('label' => $this->lang->task->cancel, 'icon' => 'ban-circle', 'url' => helper::createLink('task', 'cancel', "taskID=$task->id", '', true));
if(common::hasPriv('task', 'delete')) $menu[] = array('label' => $this->lang->task->delete, 'icon' => 'trash', 'url' => helper::createLink('task', 'delete', "executionID=$task->execution&taskID=$task->id&confirm=no&from=taskkanban"));
$menus[$task->id] = $menu;
}
+7 -10
View File
@@ -1153,17 +1153,18 @@ class story extends control
*
* @param int $storyID
* @param string $confirm yes|no
* @param string $from taskkanban
* @access public
* @return void
*/
public function delete($storyID, $confirm = 'no')
public function delete($storyID, $confirm = 'no', $from = '')
{
$story = $this->story->getById($storyID);
if($story->parent < 0) return print(js::alert($this->lang->story->cannotDeleteParent));
if($confirm == 'no')
{
return print(js::confirm($this->lang->story->confirmDelete, $this->createLink('story', 'delete', "story=$storyID&confirm=yes"), ''));
return print(js::confirm($this->lang->story->confirmDelete, $this->createLink('story', 'delete', "story=$storyID&confirm=yes&from=$from"), ''));
}
else
{
@@ -1177,14 +1178,10 @@ class story extends control
$this->executeHooks($storyID);
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success'));
if($this->app->tab == 'execution')
{
$execution = $this->loadModel('execution')->getByID(key($story->executions));
if($execution->type == 'kanban')
{
return print(js::reload('parent.parent'));
}
}
if($this->app->tab == 'execution' and $from == 'taskkanban') return print(js::reload('parent'));
if(isonlybody()) return print(js::reload('parent.parent'));
$locateLink = $this->session->storyList ? $this->session->storyList : $this->createLink('product', 'browse', "productID={$story->product}");
return print(js::locate($locateLink, 'parent'));
+6 -10
View File
@@ -1559,17 +1559,18 @@ class task extends control
* @param int $executionID
* @param int $taskID
* @param string $confirm yes|no
* @param string $from taskkanban
* @access public
* @return void
*/
public function delete($executionID, $taskID, $confirm = 'no')
public function delete($executionID, $taskID, $confirm = 'no', $from = '')
{
$task = $this->task->getById($taskID);
if($task->parent < 0) return print(js::alert($this->lang->task->cannotDeleteParent));
if($confirm == 'no')
{
return print(js::confirm($this->lang->task->confirmDelete, inlink('delete', "executionID=$executionID&taskID=$taskID&confirm=yes")));
return print(js::confirm($this->lang->task->confirmDelete, inlink('delete', "executionID=$executionID&taskID=$taskID&confirm=yes&from=$from")));
}
else
{
@@ -1583,14 +1584,9 @@ class task extends control
if($task->story) $this->loadModel('story')->setStage($task->story);
$this->executeHooks($taskID);
if($this->app->tab == 'execution')
{
$execution = $this->loadModel('execution')->getByID($task->execution);
if($execution->type == 'kanban')
{
return print(js::reload('parent.parent'));
}
}
if(isonlybody()) return print(js::reload('parent.parent'));
if($from == 'taskkanban') return print(js::reload('parent'));
$locateLink = $this->session->taskList ? $this->session->taskList : $this->createLink('execution', 'task', "executionID={$task->execution}");
return print(js::locate($locateLink, 'parent'));