This commit is contained in:
wyd621
2014-03-18 07:14:27 +00:00
parent 45b10add2b
commit 7ce1b3428d
2 changed files with 11 additions and 3 deletions
+4 -3
View File
@@ -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'));
}
}
+7
View File
@@ -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;
}
/**