Do not work directly with session in "notify_operator_alive" func

Fixes #57
This commit is contained in:
Dmitriy Simushev 2014-08-05 11:39:44 +00:00
parent 6cdfb4a7bc
commit 4ccd67e28a
3 changed files with 9 additions and 6 deletions

View File

@ -39,6 +39,8 @@ class UsersController extends AbstractController
$status = $request->query->has('away') ? 1 : 0; $status = $request->query->has('away') ? 1 : 0;
notify_operator_alive($operator['operatorid'], $status); notify_operator_alive($operator['operatorid'], $status);
$operator['istatus'] = $status;
$this->getAuthenticationManager()->setOperator($operator);
$_SESSION[SESSION_PREFIX . "operatorgroups"] = get_operator_groups_list($operator['operatorid']); $_SESSION[SESSION_PREFIX . "operatorgroups"] = get_operator_groups_list($operator['operatorid']);

View File

@ -155,6 +155,9 @@ class UsersProcessor extends ClientSideProcessor implements AuthenticationManage
{ {
$operator = $this->checkOperator($args['agentId']); $operator = $this->checkOperator($args['agentId']);
notify_operator_alive($operator['operatorid'], 1); notify_operator_alive($operator['operatorid'], 1);
// Update operator's data thus they will be sent with the response.
$operator['istatus'] = 1;
$this->getAuthenticationManager()->setOperator($operator);
} }
/** /**
@ -168,6 +171,9 @@ class UsersProcessor extends ClientSideProcessor implements AuthenticationManage
{ {
$operator = $this->checkOperator($args['agentId']); $operator = $this->checkOperator($args['agentId']);
notify_operator_alive($operator['operatorid'], 0); notify_operator_alive($operator['operatorid'], 0);
// Update operator's data thus they will be sent with the response.
$operator['istatus'] = 0;
$this->getAuthenticationManager()->setOperator($operator);
} }
/** /**

View File

@ -435,7 +435,7 @@ function delete_operator($operator_id)
/** /**
* Set current status of the operator('available' or 'away') * Set current status of the operator('available' or 'away')
* *
* @param int $operatorid Id of the operator * @param int $operator_id Id of the operator
* @param int $istatus Operator status: '0' means 'available' and '1' means * @param int $istatus Operator status: '0' means 'available' and '1' means
* 'away' * 'away'
*/ */
@ -451,11 +451,6 @@ function notify_operator_alive($operator_id, $istatus)
':operatorid' => $operator_id, ':operatorid' => $operator_id,
) )
); );
if (isset($_SESSION[SESSION_PREFIX . "operator"])) {
if ($_SESSION[SESSION_PREFIX . "operator"]['operatorid'] == $operator_id) {
$_SESSION[SESSION_PREFIX . "operator"]['istatus'] = $istatus;
}
}
} }
/** /**