* Finish task#41822

This commit is contained in:
zenggang
2021-08-26 18:03:50 +08:00
parent d392f0e44c
commit c840abc9c7
4 changed files with 78 additions and 2 deletions

View File

@@ -88,6 +88,7 @@ class dept extends control
if(!empty($_POST))
{
$this->dept->update($deptID);
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success'));
die(js::alert($this->lang->dept->successSave) . js::reload('parent'));
}
@@ -120,8 +121,16 @@ class dept extends control
/* Check this dept when delete. */
$sons = $this->dept->getSons($deptID);
$users = $this->dept->getUsers('all', $deptID);
if($sons) die(js::alert($this->lang->dept->error->hasSons));
if($users) die(js::alert($this->lang->dept->error->hasUsers));
if($sons)
{
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'message' => $this->lang->dept->error->hasSons));
die(js::alert($this->lang->dept->error->hasSons));
}
if($users)
{
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'message' => $this->lang->dept->error->hasUsers));
die(js::alert($this->lang->dept->error->hasUsers));
}
if($confirm == 'no')
{
@@ -130,6 +139,7 @@ class dept extends control
else
{
$this->dept->delete($deptID);
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success'));
die(js::reload('parent'));
}
}