From dd36fdd3a41b3b3285eb72db3574779f4fd37dcf Mon Sep 17 00:00:00 2001 From: wyd621 Date: Tue, 30 Jul 2013 10:11:41 +0800 Subject: [PATCH] * finish task #1660. --- module/dept/control.php | 8 ++++++-- module/dept/lang/en.php | 4 ++++ module/dept/lang/zh-cn.php | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/module/dept/control.php b/module/dept/control.php index c9cc82a75e..c003d07a64 100644 --- a/module/dept/control.php +++ b/module/dept/control.php @@ -89,8 +89,12 @@ class dept extends control { if($confirm == 'no') { - echo js::confirm($this->lang->dept->confirmDelete, $this->createLink('dept', 'delete', "deptID=$deptID&confirm=yes")); - exit; + $sons = $this->dept->getSons($deptID); + $users = $this->dept->getUsers($deptID); + if($sons) die(js::alert($this->lang->dept->error->hasSons)); + if($users) die(js::alert($this->lang->dept->error->hasUsers)); + + die(js::confirm($this->lang->dept->confirmDelete, $this->createLink('dept', 'delete', "deptID=$deptID&confirm=yes"))); } else { diff --git a/module/dept/lang/en.php b/module/dept/lang/en.php index d801d84878..ec398b8128 100644 --- a/module/dept/lang/en.php +++ b/module/dept/lang/en.php @@ -21,3 +21,7 @@ $lang->dept->users = "Users"; $lang->dept->saveButton = " Save (S) "; $lang->dept->confirmDelete = "Are you sure to delete this department?"; + +$lang->dept->error = new stdclass(); +$lang->dept->error->hasSons = "Can't delete this dept, because that has child."; +$lang->dept->error->hasUsers = "Can't delete this dept, because that has users."; diff --git a/module/dept/lang/zh-cn.php b/module/dept/lang/zh-cn.php index 60faa7649c..cfdb87e0be 100644 --- a/module/dept/lang/zh-cn.php +++ b/module/dept/lang/zh-cn.php @@ -21,3 +21,7 @@ $lang->dept->users = "成员列表"; $lang->dept->saveButton = " 保存 (S) "; $lang->dept->confirmDelete = " 您确定删除该部门吗?"; + +$lang->dept->error = new stdclass(); +$lang->dept->error->hasSons = '该部门有子部门,不能删除!'; +$lang->dept->error->hasUsers = '该部门有职员,不能删除!';