* fix a bug for http://www.zentao.net/thread-view-83210.html.
This commit is contained in:
@@ -280,12 +280,13 @@ class tree extends control
|
||||
{
|
||||
if($confirm == 'no')
|
||||
{
|
||||
echo js::confirm($this->lang->tree->confirmDelete, $this->createLink('tree', 'delete', "rootID=$rootID&moduleID=$moduleID&confirm=yes"));
|
||||
exit;
|
||||
die(js::confirm($this->lang->tree->confirmDelete, $this->createLink('tree', 'delete', "rootID=$rootID&moduleID=$moduleID&confirm=yes")));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tree->delete($moduleID);
|
||||
$result = $this->tree->delete($moduleID);
|
||||
if(!$result) die();
|
||||
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -751,7 +751,10 @@ class treeModel extends model
|
||||
public function getAllChildId($moduleID)
|
||||
{
|
||||
if($moduleID == 0) return array();
|
||||
|
||||
$module = $this->getById((int)$moduleID);
|
||||
if(empty($module)) return array();
|
||||
|
||||
return $this->dao->select('id')->from(TABLE_MODULE)->where('path')->like($module->path . '%')->fetchPairs();
|
||||
}
|
||||
|
||||
@@ -949,6 +952,8 @@ class treeModel extends model
|
||||
public function delete($moduleID, $null = null)
|
||||
{
|
||||
$module = $this->getById($moduleID);
|
||||
if(empty($module)) return false;
|
||||
|
||||
$childs = $this->getAllChildId($moduleID);
|
||||
$childs[$moduleID] = $moduleID;
|
||||
|
||||
@@ -959,6 +964,8 @@ class treeModel extends model
|
||||
if($module->type == 'story') $this->dao->update(TABLE_STORY)->set('module')->eq($module->parent)->where('module')->in($childs)->exec();
|
||||
if($module->type == 'bug') $this->dao->update(TABLE_BUG)->set('module')->eq($module->parent)->where('module')->in($childs)->exec();
|
||||
if($module->type == 'case') $this->dao->update(TABLE_CASE)->set('module')->eq($module->parent)->where('module')->in($childs)->exec();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user