$blocked = 'false'; $ott = ''; $LastMessageID = 0; $userOwner = 'true'; $checkStatus = 'f'; $breakSync = false; $saveChat = false; $operation = ''; if (is_object($chat) && $chat->hash == $Params['user_parameters']['hash']) { $db = ezcDbInstance::get(); $db->beginTransaction(); try { while (true) { // Auto responder if ($chat->status == erLhcoreClassModelChat::STATUS_PENDING_CHAT && $chat->wait_timeout_send <= 0 && $chat->wait_timeout > 0 && !empty($chat->timeout_message) && time() - $chat->time > $chat->wait_timeout * ($chat->wait_timeout_repeat - abs($chat->wait_timeout_send))) { erLhcoreClassChatWorkflow::timeoutWorkflow($chat); } if ($chat->status == erLhcoreClassModelChat::STATUS_PENDING_CHAT && $chat->transfer_if_na == 1 && $chat->transfer_timeout_ts < time() - $chat->transfer_timeout_ac) { $canExecuteWorkflow = true; if (erLhcoreClassModelChatConfig::fetch('pro_active_limitation')->current_value >= 0) { if ($chat->department !== false && $chat->department->department_transfer_id > 0) { $canExecuteWorkflow = erLhcoreClassChat::getPendingChatsCountPublic($chat->department->department_transfer_id) <= erLhcoreClassModelChatConfig::fetch('pro_active_limitation')->current_value; } } if ($canExecuteWorkflow == true) { erLhcoreClassChatWorkflow::transferWorkflow($chat); } } if ($chat->reinform_timeout > 0 && $chat->unread_messages_informed == 0 && $chat->has_unread_messages == 1 && time() - $chat->last_user_msg_time > $chat->reinform_timeout) { $department = $chat->department; if ($department !== false) {