* code for task#1657.

This commit is contained in:
xia0ta0
2013-08-01 10:17:36 +08:00
parent 7a2df7dfcc
commit d68ffad251
+18 -2
View File
@@ -545,15 +545,31 @@ class user extends control
*/
public function delete($userID, $confirm = 'no')
{
$user = $this->user->getByID($userID);
if(strpos($this->app->company->admins, ",{$this->app->user->account},") !== false and $this->app->user->account == $user->account) return;
if($confirm == 'no')
{
$user = $this->user->getByID($userID);
if(strpos($this->app->company->admins, ",{$this->app->user->account},") !== false and $this->app->user->account == $user->account) return;
die(js::confirm($this->lang->user->confirmDelete, $this->createLink('user', 'delete', "userID=$userID&confirm=yes")));
}
else
{
$this->user->delete(TABLE_USER, $userID);
/* if ajax request, send result. */
if($this->server->ajax)
{
if(dao::isError())
{
$response['result'] = 'fail';
$response['message'] = dao::getError();
}
else
{
$response['result'] = 'success';
$response['message'] = '';
}
$this->send($response);
}
die(js::locate($this->session->userList, 'parent'));
}
}