Added new campaign setting for Manual Dial Hopper Check, Issue #881
Added realtime check to see whether sub chats are still running, Issue #910 Changed some mysqli_query to mysql_to_mysqli for consistency in several scripts git-svn-id: svn://192.168.202.10@2465 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -233,6 +233,11 @@ OTHER CHANGES:
|
||||
59. Added available_agents and status_link button options as well as validation
|
||||
of active in-group to the chat_customer screen.
|
||||
|
||||
60. Added campaign setting Manual Dial Hopper Check that will check for a lead
|
||||
in the hopper with the same phone number as any manual call being
|
||||
placed from the agent screen, and if one exists it will be deleted
|
||||
before the manual dial call is placed.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -947,7 +947,8 @@ customer_gone_seconds SMALLINT(5) UNSIGNED default '30',
|
||||
agent_display_fields VARCHAR(50) default '',
|
||||
am_message_wildcards ENUM('Y','N') default 'N',
|
||||
manual_dial_timeout VARCHAR(3) default '',
|
||||
routing_initiated_recordings ENUM('Y','N') default 'N'
|
||||
routing_initiated_recordings ENUM('Y','N') default 'N',
|
||||
manual_dial_hopper_check ENUM('Y','N') default 'N'
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
CREATE TABLE vicidial_lists (
|
||||
@@ -3257,7 +3258,11 @@ message_date DATETIME DEFAULT NULL,
|
||||
message_viewed_date DATETIME DEFAULT NULL,
|
||||
message_posted_by VARCHAR(20) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
audio_alerted ENUM('Y','N') COLLATE utf8_unicode_ci DEFAULT 'N',
|
||||
PRIMARY KEY (manager_chat_message_id)
|
||||
PRIMARY KEY (manager_chat_message_id),
|
||||
KEY manager_chat_id_key (manager_chat_id),
|
||||
KEY manager_chat_subid_key (manager_chat_subid),
|
||||
KEY manager_chat_manager_key (manager),
|
||||
KEY manager_chat_user_key (user)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
CREATE TABLE vicidial_manager_chat_log_archive (
|
||||
@@ -3271,7 +3276,9 @@ message_date DATETIME DEFAULT NULL,
|
||||
message_viewed_date DATETIME DEFAULT NULL,
|
||||
message_posted_by VARCHAR(20) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
audio_alerted ENUM('Y','N') COLLATE utf8_unicode_ci DEFAULT 'N',
|
||||
PRIMARY KEY (manager_chat_message_id)
|
||||
PRIMARY KEY (manager_chat_message_id),
|
||||
KEY manager_chat_id_archive_key (manager_chat_id),
|
||||
KEY manager_chat_subid_archive_key (manager_chat_subid)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
CREATE TABLE vicidial_manager_chats (
|
||||
@@ -3690,4 +3697,4 @@ UPDATE vicidial_configuration set value='1766' where name='qc_database_version';
|
||||
|
||||
UPDATE system_settings set vdc_agent_api_active='1';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1449',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
||||
UPDATE system_settings SET db_schema_version='1450',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
||||
|
||||
@@ -477,3 +477,15 @@ UPDATE system_settings SET db_schema_version='1448',db_schema_update_date=NOW()
|
||||
ALTER TABLE vicidial_inbound_groups ADD on_hook_cid_number VARCHAR(18) default '';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1449',db_schema_update_date=NOW() where db_schema_version < 1449;
|
||||
|
||||
ALTER TABLE vicidial_campaigns ADD manual_dial_hopper_check ENUM('Y','N') default 'N';
|
||||
|
||||
CREATE INDEX manager_chat_id_key on vicidial_manager_chat_log (manager_chat_id);
|
||||
CREATE INDEX manager_chat_subid_key on vicidial_manager_chat_log (manager_chat_subid);
|
||||
CREATE INDEX manager_chat_manager_key on vicidial_manager_chat_log (manager);
|
||||
CREATE INDEX manager_chat_user_key on vicidial_manager_chat_log (user);
|
||||
|
||||
CREATE INDEX manager_chat_id_archive_key on vicidial_manager_chat_log_archive (manager_chat_id);
|
||||
CREATE INDEX manager_chat_subid_archive_key on vicidial_manager_chat_log_archive (manager_chat_subid);
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1450',db_schema_update_date=NOW() where db_schema_version < 1450;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# agc_agent_manager_chat_interface.php
|
||||
#
|
||||
# Copyright (C) 2015 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2016 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This page is for agents to chat with managers via the agent interface.
|
||||
#
|
||||
@@ -10,10 +10,11 @@
|
||||
# 151213-1108 - Added variable filtering
|
||||
# 151218-1141 - Added missing translation code and user auth, merged js code into file
|
||||
# 151231-0842 - Added agent_allowed_chat_groups setting
|
||||
# 160108-2300 - Changed some mysqli_query to mysql_to_mysqli for consistency
|
||||
#
|
||||
|
||||
$admin_version = '2.12-4';
|
||||
$build = '151231-0842';
|
||||
$admin_version = '2.12-5';
|
||||
$build = '160108-2300';
|
||||
|
||||
$sh="managerchats";
|
||||
|
||||
@@ -100,7 +101,7 @@ if ($SSallow_chats < 1)
|
||||
# Get a count on unread messages where the user is involved but not the chat manager/initiator in order to create the ChatReloadIDNumber variable
|
||||
$chat_reload_id_number_array=array();
|
||||
$unread_stmt="select manager_chat_id, manager_chat_subid, sum(if(message_viewed_date is not null, 0, 1)) as unread_count from vicidial_manager_chat_log where vicidial_manager_chat_log.user='$user' group by manager_chat_id, manager_chat_subid order by manager_chat_id, manager_chat_subid";
|
||||
$unread_rslt=mysqli_query($link, $unread_stmt);
|
||||
$unread_rslt=mysql_to_mysqli($unread_stmt, $link);
|
||||
while ($unread_row=mysqli_fetch_array($unread_rslt)) {
|
||||
$IDNumber=$unread_row["manager_chat_id"]."-".$unread_row["manager_chat_subid"]."-".$unread_row["unread_count"];
|
||||
array_push($chat_reload_id_number_array, "$IDNumber");
|
||||
@@ -108,7 +109,7 @@ while ($unread_row=mysqli_fetch_array($unread_rslt)) {
|
||||
|
||||
# Pull the most recently posted-to chat that has not been viewed, then the most recent period, and display that as the default window
|
||||
$stmt="select distinct vicidial_manager_chat_log.manager_chat_id, vicidial_manager_chat_log.manager_chat_subid, vicidial_users.full_name, vicidial_manager_chats.chat_start_date, sum(if(vicidial_manager_chat_log.message_viewed_date is null, 1, 0)),vicidial_manager_chat_log.user from vicidial_manager_chat_log, vicidial_manager_chats, vicidial_users where vicidial_manager_chat_log.user='$user' and vicidial_manager_chat_log.manager_chat_id=vicidial_manager_chats.manager_chat_id and vicidial_manager_chats.manager=vicidial_users.user group by manager_chat_id, manager_chat_subid order by message_viewed_date asc, message_date desc";
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
|
||||
$active_chats_array=array();
|
||||
$chat_subid_array=array();
|
||||
@@ -134,7 +135,7 @@ while ($row=mysqli_fetch_row($rslt)) {
|
||||
|
||||
# Get a count on unread messages where the user is the chat manager/initiator in order to create the ChatReloadIDNumber variable
|
||||
$unread_stmt="select manager_chat_id, manager_chat_subid, sum(if(message_viewed_date is not null, 0, 1)) as unread_count from vicidial_manager_chat_log where vicidial_manager_chat_log.manager='$user' group by manager_chat_id, manager_chat_subid order by manager_chat_id, manager_chat_subid";
|
||||
$unread_rslt=mysqli_query($link, $unread_stmt);
|
||||
$unread_rslt=mysql_to_mysqli($unread_stmt, $link);
|
||||
while ($unread_row=mysqli_fetch_array($unread_rslt)) {
|
||||
$IDNumber=$unread_row["manager_chat_id"]."-".$unread_row["manager_chat_subid"]."-".$unread_row["unread_count"];
|
||||
array_push($chat_reload_id_number_array, "$IDNumber");
|
||||
@@ -145,7 +146,7 @@ while ($row=mysqli_fetch_row($rslt)) {
|
||||
### which will now happen because agents can now start their own chats. Added vicidial_manager_chat_log.user to this query on 2/4/15 for
|
||||
### manager override
|
||||
$stmt="select distinct vicidial_manager_chat_log.manager_chat_id, vicidial_manager_chat_log.manager_chat_subid, vicidial_users.full_name, vicidial_manager_chats.chat_start_date, sum(if(vicidial_manager_chat_log.message_viewed_date is null, 1, 0)),vicidial_manager_chat_log.user from vicidial_manager_chat_log, vicidial_manager_chats, vicidial_users where vicidial_manager_chat_log.manager='$user' and vicidial_manager_chat_log.manager_chat_id=vicidial_manager_chats.manager_chat_id and vicidial_manager_chat_log.user=vicidial_users.user group by manager_chat_id, manager_chat_subid order by message_viewed_date asc, message_date desc";
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
while ($row=mysqli_fetch_row($rslt)) {
|
||||
if ($row[0]!="") {
|
||||
if (!$priority_chat) {$priority_chat=$row[0];} # The priority_chat is the most recent chat that has not been viewed.
|
||||
|
||||
+37
-24
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# chat_db_query.php
|
||||
#
|
||||
# Copyright (C) 2015 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2016 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# Called by vdc_chat_display.php and vicidial_chat_agent.js. This contains all actions taken by the
|
||||
# agent's interface when chatting with customers, other agents, and managers, through
|
||||
@@ -13,6 +13,8 @@
|
||||
# 150901-2348 - First build
|
||||
# 151218-1052 - Added missing translation code and user auth
|
||||
# 151231-0841 - Added agent_allowed_chat_groups setting
|
||||
# 160107-2318 - Bug fix for agent ending chat with manager
|
||||
# 160108-2300 - Changed some mysqli_query to mysql_to_mysqli for consistency
|
||||
#
|
||||
|
||||
require("dbconnect_mysqli.php");
|
||||
@@ -136,7 +138,7 @@ if ($action=="CreateAgentToAgentChat" && $agent_manager && $agent_user && $manag
|
||||
|
||||
# Check that you aren't already chatting with the agent - also checks for chats where the other agent is the manager and you are the requested chat recipient
|
||||
$dupe_chat_stmt="select * from vicidial_manager_chats where (manager='$agent_manager' and selected_agents like '%|$agent_user|%') or (manager='$agent_user' and selected_agents like '%|$agent_manager|%')";
|
||||
$dupe_chat_rslt=mysqli_query($link, $dupe_chat_stmt);
|
||||
$dupe_chat_rslt=mysql_to_mysqli($dupe_chat_stmt, $link);
|
||||
if (mysqli_num_rows($dupe_chat_rslt)>0) {
|
||||
echo _QXZ("Error: You already have an open chat with this agent");
|
||||
} else {
|
||||
@@ -144,7 +146,7 @@ if ($action=="CreateAgentToAgentChat" && $agent_manager && $agent_user && $manag
|
||||
# This is slightly different from the manager-to-agent chat because it's only one agent you're chatting to so for reporting all that agent's specific information is grabbed and used to make the vicidial_manager_chats entry. Since the query should only return one result there's no while loop to insert subid chat info.
|
||||
|
||||
$stmt="select vicidial_live_agents.user, vicidial_users.full_name, vicidial_users.user_group, vicidial_live_agents.campaign_id from vicidial_live_agents, vicidial_users where vicidial_live_agents.user=vicidial_users.user and vicidial_live_agents.user='$agent_user' and vicidial_users.user!='$agent_manager' order by vicidial_users.full_name asc";
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if (mysqli_num_rows($rslt)>0) {
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$user = $row[0];
|
||||
@@ -152,7 +154,7 @@ if ($action=="CreateAgentToAgentChat" && $agent_manager && $agent_user && $manag
|
||||
$campaign_id = $row[3];
|
||||
|
||||
$ins_stmt="insert into vicidial_manager_chats(chat_start_date, manager, selected_agents, selected_user_groups, selected_campaigns, allow_replies) VALUES(now(), '$agent_manager', '|$agent_user|', '|$user_group|', '|$campaign_id|', 'Y')";
|
||||
$ins_rslt=mysqli_query($link, $ins_stmt);
|
||||
$ins_rslt=mysql_to_mysqli($ins_stmt, $link);
|
||||
$manager_chat_id=mysqli_insert_id($link);
|
||||
|
||||
$subid=1;
|
||||
@@ -163,7 +165,7 @@ if ($action=="CreateAgentToAgentChat" && $agent_manager && $agent_user && $manag
|
||||
# $manager_message=addslashes(trim("$manager_message"));
|
||||
|
||||
$ins_chat_stmt="insert into vicidial_manager_chat_log(manager_chat_id, manager_chat_subid, manager, user, message, message_date, message_posted_by) VALUES('$manager_chat_id', '$subid', '$agent_manager', '$agent_user', '".mysqli_real_escape_string($link, $manager_message)."', now(), '$agent_manager')";
|
||||
$ins_chat_rslt=mysqli_query($link, $ins_chat_stmt);
|
||||
$ins_chat_rslt=mysql_to_mysqli($ins_chat_stmt, $link);
|
||||
echo "$manager_chat_id|$subid";
|
||||
}
|
||||
}
|
||||
@@ -221,20 +223,31 @@ if ($action=="DisplayMgrAgentChat" && $manager_chat_id && $manager_chat_subid &&
|
||||
}
|
||||
}
|
||||
|
||||
if ($action=="EndAgentToAgentChat" && $manager_chat_id) {
|
||||
$archive_stmt="insert ignore into vicidial_manager_chat_log_archive select * from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id'";
|
||||
$archive_rslt=mysqli_query($link, $archive_stmt);
|
||||
|
||||
$archive_stmt="insert ignore into vicidial_manager_chats_archive select * from vicidial_manager_chats where manager_chat_id='$manager_chat_id'";
|
||||
$archive_rslt=mysqli_query($link, $archive_stmt);
|
||||
|
||||
$delete_stmt="delete from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id'";
|
||||
$delete_rslt=mysqli_query($link, $delete_stmt);
|
||||
|
||||
if (mysqli_affected_rows($link)>0) {
|
||||
$archive_stmt="delete from vicidial_manager_chats where manager_chat_id='$manager_chat_id'";
|
||||
$archive_rslt=mysqli_query($link, $archive_stmt);
|
||||
if ($action=="EndAgentToAgentChat" && $manager_chat_id && $user) {
|
||||
$subid_lookup="select distinct manager_chat_subid from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id' and user='$user'";
|
||||
$subid_rslt=mysql_to_mysqli($subid_lookup, $link);
|
||||
# should only be one, but making array just in case
|
||||
$manager_chat_subid_array=array();
|
||||
while ($subid_row=mysqli_fetch_row($subid_rslt)) {
|
||||
$manager_chat_subid=$subid_row[0];
|
||||
array_push($manager_chat_subid_array, "$subid_row[0]");
|
||||
}
|
||||
|
||||
|
||||
$archive_stmt="insert ignore into vicidial_manager_chat_log_archive select * from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id' and manager_chat_subid in ('".implode("','",$manager_chat_subid_array)."')";
|
||||
$archive_rslt=mysql_to_mysqli($archive_stmt, $link);
|
||||
|
||||
# JCJ 1/7/16 - do not do this, as it will end the chat for all agents.
|
||||
# $archive_stmt="insert ignore into vicidial_manager_chats_archive select * from vicidial_manager_chats where manager_chat_id='$manager_chat_id'";
|
||||
# $archive_rslt=mysqli_query($link, $archive_stmt);
|
||||
|
||||
$delete_stmt="delete from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id' and manager_chat_subid in ('".implode("','",$manager_chat_subid_array)."')";
|
||||
$delete_rslt=mysql_to_mysqli($delete_stmt, $link);
|
||||
|
||||
#if (mysqli_affected_rows($link)>0) {
|
||||
# $archive_stmt="delete from vicidial_manager_chats where manager_chat_id='$manager_chat_id'";
|
||||
# $archive_rslt=mysqli_query($link, $archive_stmt);
|
||||
#}
|
||||
echo mysqli_affected_rows($link);
|
||||
}
|
||||
|
||||
@@ -242,7 +255,7 @@ if ($action=="RefreshActiveChatView" && $user) {
|
||||
# Get a count on unread messages where the user is involved but not the chat manager/initiator in order to create the ChatReloadIDNumber variable
|
||||
$chat_reload_id_number_array=array();
|
||||
$unread_stmt="select manager_chat_id, manager_chat_subid, sum(if(message_viewed_date is not null, 0, 1)) as unread_count from vicidial_manager_chat_log where vicidial_manager_chat_log.user='$user' group by manager_chat_id, manager_chat_subid order by manager_chat_id, manager_chat_subid";
|
||||
$unread_rslt=mysqli_query($link, $unread_stmt);
|
||||
$unread_rslt=mysql_to_mysqli($unread_stmt, $link);
|
||||
while ($unread_row=mysqli_fetch_array($unread_rslt)) {
|
||||
$IDNumber=$unread_row["manager_chat_id"]."-".$unread_row["manager_chat_subid"]."-".$unread_row["unread_count"];
|
||||
array_push($chat_reload_id_number_array, "$IDNumber");
|
||||
@@ -250,7 +263,7 @@ if ($action=="RefreshActiveChatView" && $user) {
|
||||
|
||||
# Pull the most recently posted-to chat that has not been viewed, then the most recent period, and display that as the default window
|
||||
$stmt="select distinct vicidial_manager_chat_log.manager_chat_id, vicidial_manager_chat_log.manager_chat_subid, vicidial_users.full_name, vicidial_manager_chats.chat_start_date, sum(if(vicidial_manager_chat_log.message_viewed_date is null, 1, 0)) from vicidial_manager_chat_log, vicidial_manager_chats, vicidial_users where vicidial_manager_chat_log.user='$user' and vicidial_manager_chat_log.manager_chat_id=vicidial_manager_chats.manager_chat_id and vicidial_manager_chats.manager=vicidial_users.user group by manager_chat_id, manager_chat_subid order by message_viewed_date asc, message_date desc";
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
|
||||
$active_chats_array=array();
|
||||
$chat_subid_array=array();
|
||||
@@ -270,7 +283,7 @@ if ($action=="RefreshActiveChatView" && $user) {
|
||||
|
||||
# Get a count on unread messages where the user is the chat manager/initiator in order to create the ChatReloadIDNumber variable
|
||||
$unread_stmt="select manager_chat_id, manager_chat_subid, sum(if(message_viewed_date is not null, 0, 1)) as unread_count from vicidial_manager_chat_log where vicidial_manager_chat_log.manager='$user' group by manager_chat_id, manager_chat_subid order by manager_chat_id, manager_chat_subid";
|
||||
$unread_rslt=mysqli_query($link, $unread_stmt);
|
||||
$unread_rslt=mysql_to_mysqli($unread_stmt, $link);
|
||||
while ($unread_row=mysqli_fetch_array($unread_rslt)) {
|
||||
$IDNumber=$unread_row["manager_chat_id"]."-".$unread_row["manager_chat_subid"]."-".$unread_row["unread_count"];
|
||||
array_push($chat_reload_id_number_array, "$IDNumber");
|
||||
@@ -280,7 +293,7 @@ if ($action=="RefreshActiveChatView" && $user) {
|
||||
### which will now happen because agents can now start their own chats. Added vicidial_manager_chat_log.user to this query on 2/4/15 for
|
||||
### manager override
|
||||
$stmt="select distinct vicidial_manager_chat_log.manager_chat_id, vicidial_manager_chat_log.manager_chat_subid, vicidial_users.full_name, vicidial_manager_chats.chat_start_date, sum(if(vicidial_manager_chat_log.message_viewed_date is null, 1, 0)),vicidial_manager_chat_log.user from vicidial_manager_chat_log, vicidial_manager_chats, vicidial_users where vicidial_manager_chat_log.manager='$user' and vicidial_manager_chat_log.manager_chat_id=vicidial_manager_chats.manager_chat_id and vicidial_manager_chat_log.user=vicidial_users.user group by manager_chat_id, manager_chat_subid order by message_viewed_date asc, message_date desc";
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
while ($row=mysqli_fetch_row($rslt)) {
|
||||
if ($row[0]!="") {
|
||||
array_push($active_chats_array, "$row[0]");
|
||||
@@ -396,7 +409,7 @@ if ($action=="SendMgrChatMessage" && $manager_chat_id && $manager_chat_subid) {
|
||||
$chat_message = preg_replace("/\n/i",' ',$chat_message);
|
||||
|
||||
$mgr_stmt="select manager from vicidial_manager_chats where manager_chat_id='$manager_chat_id'";
|
||||
$mgr_rslt=mysqli_query($link, $mgr_stmt);
|
||||
$mgr_rslt=mysql_to_mysqli($mgr_stmt, $link);
|
||||
$mgr_row=mysqli_fetch_row($mgr_rslt);
|
||||
$manager=$mgr_row[0];
|
||||
|
||||
@@ -405,7 +418,7 @@ if ($action=="SendMgrChatMessage" && $manager_chat_id && $manager_chat_subid) {
|
||||
|
||||
if ($manager) {
|
||||
$ins_chat_stmt="insert into vicidial_manager_chat_log(manager_chat_id, manager_chat_subid, manager, user, message, message_date, message_posted_by) VALUES('$manager_chat_id', '$manager_chat_subid', '$manager', '$user', '".mysqli_real_escape_string($link, $chat_message)."', now(), '$message_posted_by')";
|
||||
$ins_chat_rslt=mysqli_query($link, $ins_chat_stmt);
|
||||
$ins_chat_rslt=mysql_to_mysqli($ins_chat_stmt, $link);
|
||||
if (mysqli_insert_id($link)>0) {
|
||||
$reload_chat_span=1;
|
||||
} else {
|
||||
|
||||
+73
-16
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# vdc_db_query.php
|
||||
#
|
||||
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed to exchange information between vicidial.php and the database server for various actions
|
||||
#
|
||||
@@ -397,13 +397,15 @@
|
||||
# 151212-0916 - Added chat-related functions for the agent interface
|
||||
# 151220-1109 - Improved logging of chats, emails, inbound calls
|
||||
# 151229-2316 - Added manual_dial_timeout campaign setting
|
||||
# 160108-2300 - Changed some mysqli_query to mysql_to_mysqli for consistency
|
||||
# 160109-0747 - Added manual_dial_hopper_check campaign setting
|
||||
#
|
||||
|
||||
$version = '2.12-292';
|
||||
$build = '151229-2316';
|
||||
$version = '2.12-293';
|
||||
$build = '160109-0747';
|
||||
$php_script = 'vdc_db_query.php';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=649;
|
||||
$mysql_log_count=654;
|
||||
$one_mysql_log=0;
|
||||
$DB=0;
|
||||
$SSagent_debug_logging=0;
|
||||
@@ -3688,8 +3690,7 @@ if ($ACTION == 'manDiaLnextCaLL')
|
||||
$local_AMP = '@';
|
||||
$Local_out_prefix = '9';
|
||||
$Local_dial_timeout = '60';
|
||||
# $Local_persist = '/n';
|
||||
$Local_persist = '';
|
||||
$Local_persist = ''; # $Local_persist = '/n';
|
||||
if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;}
|
||||
$Local_dial_timeout = ($Local_dial_timeout * 1000);
|
||||
if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";}
|
||||
@@ -3697,7 +3698,7 @@ if ($ACTION == 'manDiaLnextCaLL')
|
||||
if (strlen($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;}
|
||||
### check for custom cid use
|
||||
$use_custom_cid=0;
|
||||
$stmt = "SELECT use_custom_cid FROM vicidial_campaigns where campaign_id='$campaign';";
|
||||
$stmt = "SELECT use_custom_cid,manual_dial_hopper_check FROM vicidial_campaigns where campaign_id='$campaign';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00313',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
@@ -3705,7 +3706,8 @@ if ($ACTION == 'manDiaLnextCaLL')
|
||||
if ($uccid_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$use_custom_cid = $row[0];
|
||||
$use_custom_cid = $row[0];
|
||||
$manual_dial_hopper_check = $row[1];
|
||||
if ( ($use_custom_cid == 'AREACODE') and ($cid_lock < 1) )
|
||||
{
|
||||
$temp_vcca='';
|
||||
@@ -3748,6 +3750,32 @@ if ($ACTION == 'manDiaLnextCaLL')
|
||||
$PADlead_id = sprintf("%010s", $lead_id);
|
||||
while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);}
|
||||
|
||||
#### BEGIN run manual_dial_hopper_check process if enabled
|
||||
if ($manual_dial_hopper_check == 'Y')
|
||||
{
|
||||
$mdhc_lead_ids_SQL='';
|
||||
$stmt = "SELECT lead_id FROM vicidial_list where phone_number='$agent_dialed_number';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00650',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mdhc_ct = mysqli_num_rows($rslt);
|
||||
$d=0;
|
||||
while ($mdhc_ct > $d)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$mdhc_lead_ids_SQL .= "'$row[0]',";
|
||||
$d++;
|
||||
}
|
||||
if ($mdhc_ct > 0)
|
||||
{
|
||||
$stmt = "DELETE FROM vicidial_hopper where lead_id IN($mdhc_lead_ids_SQL'');";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00651',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
#### END run manual_dial_hopper_check process if enabled
|
||||
|
||||
### check for extension append in campaign
|
||||
$use_eac=0;
|
||||
$stmt = "SELECT count(*) FROM vicidial_campaigns where extension_appended_cidname='Y' and campaign_id='$campaign';";
|
||||
@@ -4598,10 +4626,12 @@ if ($ACTION == 'manDiaLonly')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;}
|
||||
|
||||
### check for custom cid use
|
||||
$use_custom_cid=0;
|
||||
$stmt = "SELECT use_custom_cid FROM vicidial_campaigns where campaign_id='$campaign';";
|
||||
$stmt = "SELECT use_custom_cid,manual_dial_hopper_check FROM vicidial_campaigns where campaign_id='$campaign';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00314',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
@@ -4609,7 +4639,8 @@ if ($ACTION == 'manDiaLonly')
|
||||
if ($uccid_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$use_custom_cid = $row[0];
|
||||
$use_custom_cid = $row[0];
|
||||
$manual_dial_hopper_check = $row[1];
|
||||
if ( ($use_custom_cid == 'AREACODE') and ($cid_lock < 1) )
|
||||
{
|
||||
$temp_vcca='';
|
||||
@@ -4645,6 +4676,32 @@ if ($ACTION == 'manDiaLonly')
|
||||
{$temp_CID = preg_replace("/\D/",'',$security_phrase);}
|
||||
if (strlen($temp_CID) > 6)
|
||||
{$CCID = "$temp_CID"; $CCID_on++;}
|
||||
|
||||
#### BEGIN run manual_dial_hopper_check process if enabled
|
||||
if ($manual_dial_hopper_check == 'Y')
|
||||
{
|
||||
$mdhc_lead_ids_SQL='';
|
||||
$stmt = "SELECT lead_id FROM vicidial_list where phone_number='$phone_number';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00652',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mdhc_ct = mysqli_num_rows($rslt);
|
||||
$d=0;
|
||||
while ($mdhc_ct > $d)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$mdhc_lead_ids_SQL .= "'$row[0]',";
|
||||
$d++;
|
||||
}
|
||||
if ($mdhc_ct > 0)
|
||||
{
|
||||
$stmt = "DELETE FROM vicidial_hopper where lead_id IN($mdhc_lead_ids_SQL'');";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00653',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
#### END run manual_dial_hopper_check process if enabled
|
||||
}
|
||||
|
||||
$PADlead_id = sprintf("%010s", $lead_id);
|
||||
@@ -12063,26 +12120,26 @@ if ($ACTION == 'userLOGout')
|
||||
##### End any still-active chats initiated by the agent
|
||||
if ($allow_chats==1) {
|
||||
$stmt="SELECT manager_chat_id from vicidial_manager_chats where manager='$user';";
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
|
||||
while ($row=mysqli_fetch_row($rslt)) {
|
||||
$manager_chat_id=$row[0];
|
||||
|
||||
$archive_stmt="INSERT IGNORE INTO vicidial_manager_chat_log_archive SELECT manager_chat_message_id,manager_chat_id,manager_chat_subid,manager,user,message,message_date,message_viewed_date,message_posted_by,audio_alerted from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id';";
|
||||
$archive_rslt=mysqli_query($link, $archive_stmt);
|
||||
$archive_rslt=mysql_to_mysqli($archive_stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$archive_stmt,'00646',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$archive_stmt="INSERT IGNORE INTO vicidial_manager_chats_archive SELECT manager_chat_id,chat_start_date,manager,selected_agents,selected_user_groups,selected_campaigns,allow_replies from vicidial_manager_chats where manager_chat_id='$manager_chat_id';";
|
||||
$archive_rslt=mysqli_query($link, $archive_stmt);
|
||||
$archive_rslt=mysql_to_mysqli($archive_stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$archive_stmt,'00647',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$delete_stmt="DELETE from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id';";
|
||||
$delete_rslt=mysqli_query($link, $delete_stmt);
|
||||
$delete_rslt=mysql_to_mysqli($delete_stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$delete_stmt,'00648',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
if (mysqli_affected_rows($link)>0) {
|
||||
$archive_stmt="DELETE from vicidial_manager_chats where manager_chat_id='$manager_chat_id';";
|
||||
$archive_rslt=mysqli_query($link, $archive_stmt);
|
||||
$archive_rslt=mysql_to_mysqli($archive_stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$archive_stmt,'00649',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
@@ -14702,7 +14759,7 @@ function status_group_gather($status_group_id,$record_type)
|
||||
$stmt = "SELECT status,status_name,scheduled_callback,min_sec,max_sec from vicidial_campaign_statuses where campaign_id='$status_group_id' and selectable='Y';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00654',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$cs_ct = mysqli_num_rows($rslt);}
|
||||
$i=0;
|
||||
while ($cs_ct > $i)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# AST_chat_log_report.php
|
||||
#
|
||||
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com>, Joe Johnson <freewermadmin@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com>, Joe Johnson <freewermadmin@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This is the report page where you can view report information of any of the dialer's chats. The web page will
|
||||
# display the information about the chat, including the start time and participants, and will also provide links
|
||||
@@ -10,6 +10,7 @@
|
||||
# CHANGES
|
||||
#
|
||||
# 150608-0647 First build
|
||||
# 160108-2300 - Changed some mysqli_query to mysql_to_mysqli for consistency
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -480,7 +481,7 @@ if ($text_search) {
|
||||
$text_stmt="select distinct chat_id from vicidial_chat_log_archive where message like '%".mysqli_real_escape_string($link, $text_search)."%'";
|
||||
}
|
||||
if ($DB) {echo "$text_stmt<BR>\n";}
|
||||
$text_rslt=mysqli_query($link, $text_stmt);
|
||||
$text_rslt=mysql_to_mysqli($text_stmt, $link);
|
||||
while ($text_row=mysqli_fetch_row($text_rslt)) {
|
||||
array_push($matching_text_chats, $text_row[0]);
|
||||
}
|
||||
@@ -747,7 +748,7 @@ else
|
||||
|
||||
$sub_stmt="select manager_chat_subid, v.user, vu.full_name, count(*) from vicidial_manager_chat_log_archive v, vicidial_users vu where manager_chat_id='".$row["manager_chat_id"]."' and v.user=vu.user $matching_text_subid_SQL group by manager_chat_subid, user, full_name order by manager_chat_subid asc";
|
||||
if ($DB) {echo "$sub_stmt<BR>\n";}
|
||||
$sub_rslt=mysqli_query($link, $sub_stmt);
|
||||
$sub_rslt=mysql_to_mysqli($sub_stmt, $link);
|
||||
|
||||
$ASCII_text.="<span id='ChatReport".$row["manager_chat_id"]."' style='display: none;'>";
|
||||
$ASCII_text.="+---------+-------------+------------------------------+\n";
|
||||
@@ -826,7 +827,7 @@ else
|
||||
|
||||
$sub_stmt="select message_time, chat_member_name, message, chat_id from vicidial_chat_log_archive where chat_id='".$row["chat_id"]."' $matching_text_subid_SQL order by message_time asc";
|
||||
if ($DB) {echo "$sub_stmt<BR>\n";}
|
||||
$sub_rslt=mysqli_query($link, $sub_stmt);
|
||||
$sub_rslt=mysql_to_mysqli($sub_stmt, $link);
|
||||
|
||||
$ASCII_text.="<span id='ChatReport".$row["chat_id"]."' style='display: none;'>";
|
||||
$ASCII_text.="+---------+---------------------+------------------------------+-------------------------------------------------------+\n";
|
||||
@@ -869,7 +870,7 @@ else
|
||||
$CSV_text.="\"".$ASCII_rpt_header."\"\n";
|
||||
|
||||
$mgr_stmt="select full_name from vicidial_users where user='$download_manager'";
|
||||
$mgr_rslt=mysqli_query($link, $mgr_stmt);
|
||||
$mgr_rslt=mysql_to_mysqli($mgr_stmt, $link);
|
||||
$mgr_row=mysqli_fetch_row($mgr_rslt);
|
||||
$mgr_name=$mgr_row[0];
|
||||
|
||||
@@ -878,7 +879,7 @@ else
|
||||
if ($chat_log_type=="INTERNAL") {
|
||||
$user_stmt="select vu.user, vu.full_name from vicidial_users vu, vicidial_manager_chat_log_archive v where manager_chat_id='$download_chat_id' and v.user=vu.user";
|
||||
if ($download_chat_subid) {$user_stmt.=" and manager_chat_subid='$download_chat_subid' ";}
|
||||
$user_rslt=mysqli_query($link, $user_stmt);
|
||||
$user_rslt=mysql_to_mysqli($user_stmt, $link);
|
||||
while ($user_row=mysqli_fetch_row($user_rslt)) {
|
||||
$user_name["$user_row[0]"]=$user_row[1];
|
||||
}
|
||||
@@ -886,7 +887,7 @@ else
|
||||
$csv_stmt="select * from vicidial_manager_chat_log_archive where manager_chat_id='$download_chat_id' ";
|
||||
if ($download_chat_subid) {$csv_stmt.=" and manager_chat_subid='$download_chat_subid' ";}
|
||||
$csv_stmt.=" order by message_date asc";
|
||||
$csv_rslt=mysqli_query($link, $csv_stmt);
|
||||
$csv_rslt=mysql_to_mysqli($csv_stmt, $link);
|
||||
if ($DB) {$CSV_text.="|$csv_stmt|\n";}
|
||||
|
||||
$CSV_text.="\""._QXZ("MESSAGE DATE")."\",\""._QXZ("MESSAGE POSTED BY")."\",\""._QXZ("MESSAGE")."\"\n";
|
||||
@@ -898,7 +899,7 @@ else
|
||||
}
|
||||
} else if ($chat_log_type=="CUSTOMER") {
|
||||
$csv_stmt="select * from vicidial_chat_log_archive where chat_id='$download_chat_id' order by message_time asc";
|
||||
$csv_rslt=mysqli_query($link, $csv_stmt);
|
||||
$csv_rslt=mysql_to_mysqli($csv_stmt, $link);
|
||||
|
||||
$CSV_text.="\""._QXZ("MESSAGE TIME")."\",\""._QXZ("MESSAGE POSTED BY")."\",\""._QXZ("MESSAGE")."\"\n";
|
||||
while($csv_row=mysqli_fetch_array($csv_rslt))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# NANPA_running_processes.php
|
||||
#
|
||||
# Copyright (C) 2014 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script shows running NANPA filter batch proccesses
|
||||
#
|
||||
@@ -9,10 +9,11 @@
|
||||
# 130921-0756 - First build of script
|
||||
# 141007-2044 - Finalized adding QXZ translation to all admin files
|
||||
# 141229-2020 - Added code for on-the-fly language translations display
|
||||
# 160108-2300 - Changed some mysqli_query to mysql_to_mysqli for consistency
|
||||
#
|
||||
|
||||
$version = '2.10-3';
|
||||
$build = '141229-2020';
|
||||
$version = '2.12-4';
|
||||
$build = '160108-2300';
|
||||
$startMS = microtime();
|
||||
|
||||
require("dbconnect_mysqli.php");
|
||||
@@ -152,13 +153,13 @@ $oc_SQL=substr($oc_SQL, 0, -1);
|
||||
|
||||
if (!$show_history) {
|
||||
$process_stmt="SELECT output_code,status,server_ip,list_id,start_time,update_time,user,leads_count,filter_count,status_line,script_output from vicidial_nanpa_filter_log where output_code in ($oc_SQL) and status!='COMPLETED'";
|
||||
$process_rslt=mysqli_query($link, $process_stmt);
|
||||
$process_rslt=mysql_to_mysqli($process_stmt, $link);
|
||||
$report_title=_QXZ("Currently running NANPA scrubs");
|
||||
} else {
|
||||
if (!$process_limit) {$process_limit=10;}
|
||||
$process_stmt="SELECT output_code,status,server_ip,list_id,start_time,update_time,user,leads_count,filter_count,status_line,script_output from vicidial_nanpa_filter_log where user='$PHP_AUTH_USER' and status='COMPLETED' order by start_time desc limit $process_limit";
|
||||
|
||||
$process_rslt=mysqli_query($link, $process_stmt);
|
||||
$process_rslt=mysql_to_mysqli($process_stmt, $link);
|
||||
$report_title=_QXZ("Past NANPA scrubs for user")." $PHP_AUTH_USER";
|
||||
|
||||
$past_process_ct=mysqli_num_rows($process_rslt);
|
||||
|
||||
+12
-5
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# admin_NANPA_updater.php
|
||||
#
|
||||
# Copyright (C) 2014 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed to launch NANPA filter batch proccesses through the
|
||||
# triggering process
|
||||
@@ -12,10 +12,11 @@
|
||||
# 131019-1112 - Added help text and several small tweaks
|
||||
# 141007-1123 - Finalized adding QXZ translation to all admin files
|
||||
# 141230-0014 - Added code for on-the-fly language translations display
|
||||
# 160108-2300 - Changed some mysqli_query to mysql_to_mysqli for consistency
|
||||
#
|
||||
|
||||
$version = '2.10-5';
|
||||
$build = '141230-0014';
|
||||
$version = '2.12-6';
|
||||
$build = '160108-2300';
|
||||
$startMS = microtime();
|
||||
|
||||
require("dbconnect_mysqli.php");
|
||||
@@ -171,7 +172,7 @@ if (strlen($active_voicemail_server)<7)
|
||||
if ($delete_trigger_id)
|
||||
{
|
||||
$delete_stmt="delete from vicidial_process_triggers where trigger_id='$delete_trigger_id'";
|
||||
$delete_rslt=mysqli_query($link, $delete_stmt);
|
||||
$delete_rslt=mysql_to_mysqli($delete_stmt, $link);
|
||||
}
|
||||
|
||||
$list_ct=count($lists);
|
||||
@@ -189,7 +190,7 @@ if ($submit_form=="SUBMIT" && $list_ct>0 && (strlen($vl_field_update)>0 || strle
|
||||
### but it needs to be done
|
||||
$j=0;
|
||||
$stmt="SELECT list_id from vicidial_lists where active='N' order by list_id asc";
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
while ($row=mysqli_fetch_array($rslt))
|
||||
{
|
||||
$lists[$j]=$row[0];
|
||||
@@ -225,7 +226,7 @@ if ($submit_form=="SUBMIT" && $list_ct>0 && (strlen($vl_field_update)>0 || strle
|
||||
|
||||
$uniqueid=date("U").".".rand(1, 9999);
|
||||
$ins_stmt="INSERT into vicidial_process_triggers (trigger_id, trigger_name, server_ip, trigger_time, trigger_run, user, trigger_lines) VALUES('NANPA_".$uniqueid."', 'NANPA updater SCREEN', '$active_voicemail_server', now()+INTERVAL $activation_delay MINUTE, '1', '$PHP_AUTH_USER', '/usr/share/astguiclient/nanpa_type_filter.pl --output-to-db $options')";
|
||||
$ins_rslt=mysqli_query($link, $ins_stmt);
|
||||
$ins_rslt=mysql_to_mysqli($ins_stmt, $link);
|
||||
}
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
if ($SSnocache_admin=='1')
|
||||
@@ -236,10 +237,10 @@ if ($SSnocache_admin=='1')
|
||||
|
||||
|
||||
$schedule_stmt="SELECT *, sec_to_time(UNIX_TIMESTAMP(trigger_time)-UNIX_TIMESTAMP(now())) as time_until_execution from vicidial_process_triggers where trigger_name='NANPA updater SCREEN' and user='$PHP_AUTH_USER' and trigger_time>=now()";
|
||||
$schedule_rslt=mysqli_query($link, $schedule_stmt);
|
||||
$schedule_rslt=mysql_to_mysqli($schedule_stmt, $link);
|
||||
|
||||
$running_stmt="SELECT output_code from vicidial_nanpa_filter_log where user='$PHP_AUTH_USER' and status!='COMPLETED' order by output_code asc";
|
||||
$running_rslt=mysqli_query($link, $running_stmt);
|
||||
$running_rslt=mysql_to_mysqli($running_stmt, $link);
|
||||
if (mysqli_num_rows($running_rslt)>0) {
|
||||
$iframe_url="";
|
||||
while ($run_row=mysqli_fetch_array($running_rslt)) {
|
||||
@@ -449,7 +450,7 @@ else
|
||||
echo "<td align='left' valign='top' rowspan='4'><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Inactive lists").":<BR/>\n";
|
||||
|
||||
$stmt="SELECT list_id, list_name from vicidial_lists where active='N' order by list_id asc";
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
echo "<select name='lists[]' multiple size='5'>\n";
|
||||
echo "<option value='---ALL---'>---"._QXZ("ALL LISTS")."---</option>\n";
|
||||
while ($row=mysqli_fetch_array($rslt))
|
||||
@@ -462,7 +463,7 @@ else
|
||||
echo "<td align='left' valign='top' rowspan='2'><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Field to update (optional)").":<BR/>\n";
|
||||
echo "<select name='vl_field_update'>\n";
|
||||
$stmt="SELECT * from vicidial_list limit 1";
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
echo "<option value=''>---"._QXZ("NONE")."---</option>\n";
|
||||
while ($fieldinfo=mysqli_fetch_field($rslt))
|
||||
{
|
||||
@@ -502,7 +503,7 @@ else
|
||||
echo "<td align='left' valign='top' rowspan='2'><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Exclusion field (optional)").":<BR/>\n";
|
||||
echo "<select name='vl_field_exclude'>\n";
|
||||
$stmt="SELECT * from vicidial_list limit 1";
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
echo "<option value=''>---"._QXZ("NONE")."---</option>\n";
|
||||
while ($fieldinfo=mysqli_fetch_field($rslt))
|
||||
{
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
# 160101-0933 - Added entries for routing_initiated_recordings in campaigns and in-groups
|
||||
# 160106-0700 - Added AREACODE description to the inbound_dids-filter_inbound_number entry
|
||||
# 160106-1348 - Added inbound_groups-on_hook_cid_number entry
|
||||
# 160108-2217 - Added campaigns-manual_dial_hopper_check entry
|
||||
#
|
||||
|
||||
|
||||
@@ -899,6 +900,11 @@ if ($SSoutbound_autodial_active > 0)
|
||||
<BR>
|
||||
<B><?php echo _QXZ("Hopper VLC Dup Check"); ?> -</B><?php echo _QXZ("Setting this to Y will result in every lead being inserted into the hopper being checked by vendor_lead_code to make sure there are no duplicate leads inserted with the same vendor_lead_code. This is most useful when Auto-Alt-Dialing with MULTI_LEAD. Default is N."); ?>
|
||||
|
||||
<BR>
|
||||
<A NAME="campaigns-manual_dial_hopper_check">
|
||||
<BR>
|
||||
<B><?php echo _QXZ("Manual Dial Hopper Check"); ?> -</B><?php echo _QXZ("Setting this to Y will mean that any manually dialed campaign phone call through the agent screen will first check for a lead in the hopper with the same phone number, and if one exists it will be deleted before the manual dial call is placed. Default is N."); ?>
|
||||
|
||||
<BR>
|
||||
<A NAME="campaigns-lead_filter_id">
|
||||
<BR>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# manager_chat_actions.php
|
||||
#
|
||||
# Copyright (C) 2015 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2016 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# Contains PHP actions for manager_chat_interface.php - works with vicidial_chat.js
|
||||
#
|
||||
@@ -9,10 +9,12 @@
|
||||
# 150605-2022 First Build
|
||||
# 151213-1114 - Added variable filtering
|
||||
# 151218-0739 - Added translation where missing
|
||||
# 160107-2315 - Bug fix to prevent sending messages on dead chats
|
||||
# 160108-2300 - Changed some mysqli_query to mysql_to_mysqli for consistency
|
||||
#
|
||||
|
||||
$admin_version = '2.12-3';
|
||||
$build = '151218-0739';
|
||||
$admin_version = '2.12-5';
|
||||
$build = '160108-2300';
|
||||
|
||||
$sh="managerchats";
|
||||
|
||||
@@ -116,12 +118,12 @@ $debug=0;
|
||||
|
||||
if ($action=="EndAgentChat") {
|
||||
$archive_stmt="insert ignore into vicidial_manager_chat_log_archive select * from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id' and manager_chat_subid='$chat_sub_id'";
|
||||
$archive_rslt=mysqli_query($link, $archive_stmt);
|
||||
$archive_rslt=mysql_to_mysqli($archive_stmt, $link);
|
||||
|
||||
if ($debug==1) {echo "$archive_stmt<BR>\n";}
|
||||
|
||||
$delete_stmt="delete from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id' and manager_chat_subid='$chat_sub_id'";
|
||||
$delete_rslt=mysqli_query($link, $delete_stmt);
|
||||
$delete_rslt=mysql_to_mysqli($delete_stmt, $link);
|
||||
|
||||
if ($debug==1) {echo "$delete_stmt<BR>\n";}
|
||||
|
||||
@@ -129,15 +131,15 @@ if ($action=="EndAgentChat") {
|
||||
|
||||
if ($debug==1) {echo "$count_stmt<BR>\n";}
|
||||
|
||||
$count_rslt=mysqli_query($link, $count_stmt);
|
||||
$count_rslt=mysql_to_mysqli($count_stmt, $link);
|
||||
$count_row=mysqli_fetch_row($count_rslt);
|
||||
$active_chats=$count_row[0];
|
||||
if ($active_chats==0) {
|
||||
$archive_stmt="insert ignore into vicidial_manager_chats_archive select * from vicidial_manager_chats where manager_chat_id='$manager_chat_id'";
|
||||
$archive_rslt=mysqli_query($link, $archive_stmt);
|
||||
$archive_rslt=mysql_to_mysqli($archive_stmt, $link);
|
||||
|
||||
$del_stmt="delete from vicidial_manager_chats where manager_chat_id='$manager_chat_id'";
|
||||
$del_rslt=mysqli_query($link, $del_stmt);
|
||||
$del_rslt=mysql_to_mysqli($del_stmt, $link);
|
||||
$manager_chat_id="";
|
||||
echo "ALL CHATS CLOSED";
|
||||
exit;
|
||||
@@ -148,7 +150,7 @@ if ($action=="EndAgentChat") {
|
||||
|
||||
if ($action=="CheckNewMessages") {
|
||||
$time_stmt="select distinct manager_chat_subid from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id' and message_date>=now()-INTERVAL 6 SECOND";
|
||||
$time_rslt=mysqli_query($link, $time_stmt);
|
||||
$time_rslt=mysql_to_mysqli($time_stmt, $link);
|
||||
# echo $time_stmt;
|
||||
if (mysqli_num_rows($time_rslt)==0) {
|
||||
echo "0";
|
||||
@@ -161,6 +163,20 @@ if ($action=="CheckNewMessages") {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action=="CheckEndedChats" && $manager_chat_id) {
|
||||
$ended_chat_stmt="select distinct manager_chat_subid from vicidial_manager_chat_log_archive where manager_chat_id='$manager_chat_id'";
|
||||
$ended_chat_rslt=mysql_to_mysqli($ended_chat_stmt, $link);
|
||||
if (mysqli_num_rows($ended_chat_rslt)==0) {
|
||||
echo "0";
|
||||
} else {
|
||||
$sub_id_str="";
|
||||
while ($row=mysqli_fetch_row($ended_chat_rslt)) {
|
||||
$sub_id_str.="$row[0]\n";
|
||||
}
|
||||
echo trim($sub_id_str);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action=="PrintSubChatText") {
|
||||
for ($i=0; $i<$chat_sub_id_ct; $i++) {
|
||||
$chat_sub_id=$chat_sub_ids[$i];
|
||||
@@ -169,7 +185,7 @@ if ($action=="PrintSubChatText") {
|
||||
$stmt="select vm.message_posted_by, vm.message, vm.message_date, vu.full_name, vm.manager, vm.manager_chat_subid from vicidial_manager_chats vmc, vicidial_manager_chat_log vm, vicidial_users vu where vmc.manager_chat_id='$manager_chat_id' and vmc.manager_chat_id=vm.manager_chat_id and vm.manager_chat_subid='$chat_sub_id' and vm.user=vu.user order by vm.manager_chat_subid asc, message_date desc";
|
||||
if ($debug==1) {echo "$stmt<BR>\n";}
|
||||
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if (mysqli_num_rows($rslt)>0) {
|
||||
$prev_chat_subid="";
|
||||
$backlog_limit=20;
|
||||
@@ -188,15 +204,22 @@ if ($action=="PrintSubChatText") {
|
||||
|
||||
if ($action=="SendChatMessage" && $chat_message) {
|
||||
|
||||
$chat_message = preg_replace("/\r/i",'',$chat_message);
|
||||
$chat_message = preg_replace("/\n/i",' ',$chat_message);
|
||||
|
||||
$ins_chat_stmt="insert into vicidial_manager_chat_log(manager_chat_id, manager_chat_subid, manager, user, message, message_date, message_posted_by) VALUES('$manager_chat_id', '$chat_sub_id', '$PHP_AUTH_USER', '$user', '".mysqli_real_escape_string($link, $chat_message)."', now(), '$PHP_AUTH_USER')";
|
||||
$ins_chat_rslt=mysqli_query($link, $ins_chat_stmt);
|
||||
if (mysqli_insert_id($link)>0) {
|
||||
$reload_chat_span=1;
|
||||
$check_live_stmt="select * from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id' and manager_chat_subid='$chat_sub_id'";
|
||||
$check_live_rslt=mysql_to_mysqli($check_live_stmt, $link);
|
||||
if (mysqli_num_rows($check_live_rslt)==0) {
|
||||
echo _QXZ("Error - chat session was ended by the agent");
|
||||
} else {
|
||||
echo "Error sending message.";
|
||||
|
||||
$chat_message = preg_replace("/\r/i",'',$chat_message);
|
||||
$chat_message = preg_replace("/\n/i",' ',$chat_message);
|
||||
|
||||
$ins_chat_stmt="insert into vicidial_manager_chat_log(manager_chat_id, manager_chat_subid, manager, user, message, message_date, message_posted_by) VALUES('$manager_chat_id', '$chat_sub_id', '$PHP_AUTH_USER', '$user', '".mysqli_real_escape_string($link, $chat_message)."', now(), '$PHP_AUTH_USER')";
|
||||
$ins_chat_rslt=mysql_to_mysqli($ins_chat_stmt, $link);
|
||||
if (mysqli_insert_id($link)>0) {
|
||||
$reload_chat_span=1;
|
||||
} else {
|
||||
echo _QXZ("Error sending message.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +287,7 @@ if ($reload_chat_span) {
|
||||
echo "\t<TD align='left' colspan='2'><font FACE=\"ARIAL,HELVETICA\" size=1 color=white>"._QXZ("Message")."</font></TD>\n";
|
||||
echo "</TR>";
|
||||
$stmt="select vm.message_posted_by, vm.message, vm.message_date, vu.full_name, vm.manager, vm.manager_chat_subid, vm.user from vicidial_manager_chats vmc, vicidial_manager_chat_log vm, vicidial_users vu where vmc.manager_chat_id='$manager_chat_id' and vmc.manager_chat_id=vm.manager_chat_id and vm.user=vu.user order by vm.manager_chat_subid asc, message_date desc";
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if (mysqli_num_rows($rslt)>0) {
|
||||
$prev_chat_subid="";
|
||||
$backlog_limit=20;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# manager_chat_interface.php
|
||||
#
|
||||
# Copyright (C) 2015 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2016 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This page is for managers (level 8 or higher) to chat with live agents
|
||||
#
|
||||
@@ -9,10 +9,12 @@
|
||||
# 150608-2041 - First Build
|
||||
# 150909-0118 - Bug fixes, added feature to submit messages when Enter is pressed
|
||||
# 151219-0718 - Added vicidial_chat.js code, translation code where missing
|
||||
# 160107-2241 - Added realtime check to see whether sub chats are still running
|
||||
# 160108-2300 - Changed some mysqli_query to mysql_to_mysqli for consistency
|
||||
#
|
||||
|
||||
$admin_version = '2.12-3';
|
||||
$build = '151219-0718';
|
||||
$admin_version = '2.12-5';
|
||||
$build = '160108-2300';
|
||||
|
||||
$sh="managerchats";
|
||||
|
||||
@@ -163,16 +165,16 @@ if ($SSallow_chats < 1)
|
||||
if ($end_all_chats)
|
||||
{
|
||||
$archive_stmt="insert ignore into vicidial_manager_chat_log_archive select * from vicidial_manager_chat_log where manager_chat_id='$end_all_chats'";
|
||||
$archive_rslt=mysqli_query($link, $archive_stmt);
|
||||
$archive_rslt=mysql_to_mysqli($archive_stmt, $link);
|
||||
|
||||
$archive_stmt="insert ignore into vicidial_manager_chats_archive select * from vicidial_manager_chats where manager_chat_id='$end_all_chats'";
|
||||
$archive_rslt=mysqli_query($link, $archive_stmt);
|
||||
$archive_rslt=mysql_to_mysqli($archive_stmt, $link);
|
||||
|
||||
$delete_stmt="delete from vicidial_manager_chat_log where manager_chat_id='$end_all_chats'";
|
||||
$delete_rslt=mysqli_query($link, $delete_stmt);
|
||||
$delete_rslt=mysql_to_mysqli($delete_stmt, $link);
|
||||
|
||||
$archive_stmt="delete from vicidial_manager_chats where manager_chat_id='$end_all_chats'";
|
||||
$archive_rslt=mysqli_query($link, $archive_stmt);
|
||||
$archive_rslt=mysql_to_mysqli($archive_stmt, $link);
|
||||
}
|
||||
|
||||
if ($submit_chat == _QXZ("ALL LIVE AGENTS"))
|
||||
@@ -235,7 +237,7 @@ else
|
||||
}
|
||||
|
||||
$check_stmt="select manager_chat_id from vicidial_manager_chats where manager='$PHP_AUTH_USER' limit 1";
|
||||
$check_rslt=mysqli_query($link, $check_stmt);
|
||||
$check_rslt=mysql_to_mysqli($check_stmt, $link);
|
||||
$active_chats=mysqli_num_rows($check_rslt);
|
||||
if ($active_chats>0)
|
||||
{
|
||||
@@ -246,13 +248,11 @@ if ($active_chats>0)
|
||||
if ($active_chats<1 && $manager_message && ($submit_chat== _QXZ("ALL LIVE AGENTS") || ($submit_chat== _QXZ("SELECTED AGENTS") && ($available_chat_agents_ct+$available_chat_groups_ct+$available_chat_campaigns_ct)>0)))
|
||||
{
|
||||
$stmt="select vicidial_live_agents.user, vicidial_users.full_name from vicidial_live_agents, vicidial_users where vicidial_live_agents.user=vicidial_users.user $chat_query_SQL and vicidial_users.user!='$PHP_AUTH_USER' order by vicidial_users.full_name asc";
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
echo "<!-- $stmt //-->\n";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if (mysqli_num_rows($rslt)>0)
|
||||
{
|
||||
$ins_stmt="insert into vicidial_manager_chats(chat_start_date, manager, selected_agents, selected_user_groups, selected_campaigns, allow_replies) VALUES(now(), '$PHP_AUTH_USER', '$available_chat_agents_string', '$available_chat_groups_string', '$available_chat_campaigns_string', '$allow_replies')";
|
||||
echo "<!-- $ins_stmt //-->\n";
|
||||
$ins_rslt=mysqli_query($link, $ins_stmt);
|
||||
$ins_rslt=mysql_to_mysqli($ins_stmt, $link);
|
||||
$manager_chat_id=mysqli_insert_id($link);
|
||||
|
||||
$subid=1;
|
||||
@@ -270,8 +270,7 @@ if ($active_chats<1 && $manager_message && ($submit_chat== _QXZ("ALL LIVE AGENTS
|
||||
# $manager_message=addslashes(trim("$manager_message"));
|
||||
|
||||
$ins_chat_stmt="insert into vicidial_manager_chat_log(manager_chat_id, manager_chat_subid, manager, user, message, message_date, message_posted_by) VALUES('$manager_chat_id', '$subid', '".$PHP_AUTH_USER."', '$user', '".mysqli_real_escape_string($link, $manager_message)."', now(), '".$PHP_AUTH_USER."')";
|
||||
$ins_chat_rslt=mysqli_query($link, $ins_chat_stmt);
|
||||
echo "<!-- $ins_chat_stmt //-->\n";
|
||||
$ins_chat_rslt=mysql_to_mysqli($ins_chat_stmt, $link);
|
||||
$subid++;
|
||||
}
|
||||
}
|
||||
@@ -407,7 +406,7 @@ function CheckNewMessages(manager_chat_id) {
|
||||
ChatResponseText = xmlhttp.responseText;
|
||||
if (ChatResponseText==0)
|
||||
{
|
||||
return false;
|
||||
CheckEndedChats(manager_chat_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -476,12 +475,70 @@ function RefreshChatSubIDs(manager_chat_id, sub_ids) {
|
||||
objDiv.scrollTop = objDiv.scrollHeight;
|
||||
}
|
||||
}
|
||||
CheckEndedChats(manager_chat_id);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
}
|
||||
|
||||
function CheckEndedChats(manager_chat_id) {
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
chat_SQL_query = "action=CheckEndedChats&manager_chat_id="+manager_chat_id;
|
||||
// alert(chat_SQL_query);
|
||||
xmlhttp.open('POST', 'manager_chat_actions.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(chat_SQL_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
var ChatResponseText = null;
|
||||
ChatResponseText = xmlhttp.responseText;
|
||||
if (ChatResponseText==0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var ChatText_array=ChatResponseText.split("\n");
|
||||
for (var i=0; i<ChatText_array.length; i++)
|
||||
{
|
||||
var EndedChatSpanName="manager_chat_message_"+manager_chat_id+"_"+ChatText_array[i];
|
||||
if (document.getElementById(EndedChatSpanName))
|
||||
{
|
||||
document.getElementById(EndedChatSpanName).className="chat_box_ended";
|
||||
}
|
||||
// Set style of chat span to nothing
|
||||
}
|
||||
// console.log(sub_ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
}
|
||||
|
||||
function PrintSubChatText(manager_chat_id, chat_sub_id) {
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
@@ -746,7 +803,7 @@ $NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIG
|
||||
echo "\t<TD align='left' colspan='2'><font FACE=\"ARIAL,HELVETICA\" size=1 color=white>"._QXZ("Message")."</font></TD>\n";
|
||||
echo "</TR>";
|
||||
$stmt="select vm.message_posted_by, vm.message, vm.message_date, vu.full_name, vm.manager, vm.manager_chat_subid, vm.user from vicidial_manager_chats vmc, vicidial_manager_chat_log vm, vicidial_users vu where vmc.manager_chat_id='$manager_chat_id' and vmc.manager_chat_id=vm.manager_chat_id and vm.user=vu.user order by vm.manager_chat_subid asc, message_date desc";
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if (mysqli_num_rows($rslt)>0)
|
||||
{
|
||||
$prev_chat_subid="";
|
||||
|
||||
@@ -72,6 +72,14 @@ textarea.chat_box {
|
||||
padding: 2px;
|
||||
border: solid 1px #000066;
|
||||
}
|
||||
textarea.chat_box_ended {
|
||||
font-family: Arial, Sans-Serif;
|
||||
font-size: 10px;
|
||||
margin-bottom: 3px;
|
||||
padding: 2px;
|
||||
border: solid 1px #000066;
|
||||
background-color:#999999;
|
||||
}
|
||||
.cust_form {
|
||||
font-family: Sans-Serif;
|
||||
font-size: 10px;
|
||||
|
||||
Reference in New Issue
Block a user