$baseURL = isset($Params['user_parameters_unordered']['mode']) && $Params['user_parameters_unordered']['mode'] == 'widget' ? erLhcoreClassDesign::baseurl('chat/chatwidget') : erLhcoreClassDesign::baseurl('chat/startchat'); $ru = $baseURL . '/(department)/' . $department->id . '/(offline)/true/(leaveamessage)/true/(chatprefill)/' . $chat->id . '_' . $chat->hash; $msg = new erLhcoreClassModelmsg(); $msg->msg = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/checkchatstatus', 'Visitor has been redirected to contact form'); $msg->chat_id = $chat->id; $msg->user_id = -1; $msg->time = time(); erLhcoreClassChat::getSession()->save($msg); // We do not store last msg time for chat here, because in any case none of opeators has opened it $contactRedirected = true; if ($chat->status_sub != erLhcoreClassModelChat::STATUS_SUB_CONTACT_FORM) { $chat->status_sub = erLhcoreClassModelChat::STATUS_SUB_CONTACT_FORM; $chat->updateThis(); } } else { erLhcoreClassChatWorkflow::autoAssign($chat, $department); } } } if (erLhcoreClassChat::isOnline($chat->dep_id, false, array('online_timeout' => (int) erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['online_timeout']))) { $tpl->set('is_online', true); } else { $tpl->set('is_online', false); } if ($chat->chat_initiator == erLhcoreClassModelChat::CHAT_INITIATOR_PROACTIVE) { $tpl->set('is_proactive_based', true); } else { $tpl->set('is_proactive_based', false); } if ($chat->status == erLhcoreClassModelChat::STATUS_ACTIVE_CHAT) { $activated = 'true';