Added search lead email field

Fixed Performance and status reports to sort by status
Fixed format issue in non-agent api
Fixed email attachment issue in agent interface

git-svn-id: svn://192.168.202.10@2328 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2015-06-03 19:44:50 +00:00
parent 9976905c35
commit 798e66d17a
7 changed files with 244 additions and 144 deletions
+4 -3
View File
@@ -1,4 +1,4 @@
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2015-05-12 NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2015-06-03
This document describes the functions of an API(Application Programming This document describes the functions of an API(Application Programming
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen. Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
@@ -104,6 +104,7 @@ Changes:
150428-1720 - Added web_form_address_three to add_list/update_list functions 150428-1720 - Added web_form_address_three to add_list/update_list functions
150430-0644 - Added API allowed function restrictions and allowed list restrictions 150430-0644 - Added API allowed function restrictions and allowed list restrictions
150512-2028 - Added filtering of hash sign on some input variables, Issue #851 150512-2028 - Added filtering of hash sign on some input variables, Issue #851
150603-1528 - Fixed format issue in recording_lookup
API Functions use the 'function' variable API Functions use the 'function' variable
@@ -160,7 +161,7 @@ moh_list - outputs a list of music on hold classes in the system
NOTE: api user for this function must have user_level set to 7 or higher NOTE: api user for this function must have user_level set to 7 or higher
OPTIONAL FIELDS- OPTIONAL FIELDS-
format - format of the output(tab, link, selectframe) format - format of the output(only 'selectframe' works)
comments - name of the field to populate comments - name of the field to populate
@@ -184,7 +185,7 @@ vm_list - outputs a list of voicemail boxes in the system
NOTE: api user for this function must have user_level set to 7 or higher NOTE: api user for this function must have user_level set to 7 or higher
OPTIONAL FIELDS- OPTIONAL FIELDS-
format - format of the output(tab, link, selectframe) format - format of the output(only 'selectframe' works)
comments - name of the field to populate comments - name of the field to populate
+8 -7
View File
@@ -1,7 +1,7 @@
<?php <?php
# vdc_email_display.php - VICIDIAL agent email display script # vdc_email_display.php - VICIDIAL agent email display script
# #
# Copyright (C) 2014 Matt Florell, Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2015 Matt Florell, Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
# #
# This page displays any incoming emails in the Vicidial user interface. It # This page displays any incoming emails in the Vicidial user interface. It
# also allows the user to download and view any attachments sent in the email, # also allows the user to download and view any attachments sent in the email,
@@ -20,10 +20,11 @@
# 141118-1426 - Added agent_email variable # 141118-1426 - Added agent_email variable
# 141128-0850 - Code cleanup for QXZ functions # 141128-0850 - Code cleanup for QXZ functions
# 141216-2117 - Added language settings lookups and user/pass variable standardization # 141216-2117 - Added language settings lookups and user/pass variable standardization
# 150603-1541 - Fixed email attachments issue
# #
$version = '2.10-10'; $version = '2.12-11';
$build = '141216-2117'; $build = '150603-1541';
require_once("dbconnect_mysqli.php"); require_once("dbconnect_mysqli.php");
require_once("functions.php"); require_once("functions.php");
@@ -197,7 +198,7 @@ if ($REPLY)
$semi_rand = md5(time()); $semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
$message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"utf-8\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"utf-8\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $reply_message . "\n\n";
$message .= "--{$mime_boundary}\n"; $message .= "--{$mime_boundary}\n";
for ($i=1; $i<=5; $i++) for ($i=1; $i<=5; $i++)
@@ -206,7 +207,7 @@ if ($REPLY)
$attachment_path="A".$i."_path"; $attachment_path="A".$i."_path";
$LF_orig=$$attachment_orig_name; $LF_orig=$$attachment_orig_name;
$LF_path=$$attachment_path; $LF_path=$$attachment_path;
#echo "<p>".$$attachment_name."<BR/>".$$attachment_orig_name."<BR/>".$$attachment_path."<BR/><p>"; # echo "<p>".$$attachment_name."<BR/>".$$attachment_orig_name."<BR/>".$$attachment_path."<BR/><p>";
if ($LF_orig) if ($LF_orig)
{ {
if (preg_match("/;|:|\/|\^|\[|\]|\"|\'|\*/",$LF_orig)) if (preg_match("/;|:|\/|\^|\[|\]|\"|\'|\*/",$LF_orig))
@@ -284,7 +285,7 @@ if ($lead_id) {
if (mysqli_num_rows($att_rslt)>0) { if (mysqli_num_rows($att_rslt)>0) {
$EMAIL_form.="<tr bgcolor=white><td align='right' valign='top' width='150'>"._QXZ("Attachments:")."</td><td align='left' valign='top' width='*'><pre>"; $EMAIL_form.="<tr bgcolor=white><td align='right' valign='top' width='150'>"._QXZ("Attachments:")."</td><td align='left' valign='top' width='*'><pre>";
while($att_row=mysqli_fetch_array($att_rslt)) { while($att_row=mysqli_fetch_array($att_rslt)) {
$EMAIL_form.="<LI><a href='$_SERVER[PHP_SELF]?attachment_id=$att_row[attachment_id]&lead_id=$lead_id'>$att_row[filename]</a>\n"; $EMAIL_form.="<LI><a href='$_SERVER[PHP_SELF]?attachment_id=$att_row[attachment_id]&lead_id=$lead_id&user=$user&pass=$pass'>$att_row[filename]</a>\n";
} }
$EMAIL_form.="</pre></td></tr>"; $EMAIL_form.="</pre></td></tr>";
} }
@@ -384,7 +385,7 @@ if ($lead_id) {
pre { white-space: pre-wrap; } pre { white-space: pre-wrap; }
</style> </style>
<body> <body>
<form action='<?php echo $_SERVER['PHP_SELF']; ?>' method='get' name="email_display_form" id="email_display_form" onSubmit="if (this.submitted) return false; this.submitted=true" enctype="multipart/form-data"> <form action='<?php echo $_SERVER['PHP_SELF']; ?>' method='post' name="email_display_form" id="email_display_form" onSubmit="if (this.submitted) return false; this.submitted=true" enctype="multipart/form-data">
<?php echo $EMAIL_form; ?> <?php echo $EMAIL_form; ?>
</form> </form>
</body> </body>
@@ -48,6 +48,7 @@
# 141230-0945 - Added code for on-the-fly language translations display # 141230-0945 - Added code for on-the-fly language translations display
# 150210-1357 - Added option to show time in seconds # 150210-1357 - Added option to show time in seconds
# 150516-1308 - Fixed Javascript element problem, Issue #857 # 150516-1308 - Fixed Javascript element problem, Issue #857
# 150603-1533 - Statuses are now sorted in alphabetical order
# #
$startMS = microtime(); $startMS = microtime();
@@ -647,11 +648,6 @@ while ($UG_row=mysqli_fetch_row($recent_UG_rslt)) {
$recent_user_groups[$UG_row[1]]=$Ugrp_row[0]; $recent_user_groups[$UG_row[1]]=$Ugrp_row[0];
} }
$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status,sum(dead_sec), vicidial_users.user_group from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 $group_SQL $user_group_SQL $user_SQL group by user,full_name,user_group,status order by full_name,user,status desc limit 500000;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {$HTML_text.="$stmt\n";}
$rows_to_print = mysqli_num_rows($rslt);
$graph_stats=array(); $graph_stats=array();
$max_calls=1; $max_calls=1;
$max_time=1; $max_time=1;
@@ -685,61 +681,99 @@ $DEADAVG_graph=$graph_header."<th class='thgraph' scope='col'>"._QXZ("DEAD AVG")
$CUST_graph=$graph_header."<th class='thgraph' scope='col'>"._QXZ("CUST")."</th></tr>"; $CUST_graph=$graph_header."<th class='thgraph' scope='col'>"._QXZ("CUST")."</th></tr>";
$CUSTAVG_graph=$graph_header."<th class='thgraph' scope='col'>"._QXZ("CUST AVG")."</th></tr>"; $CUSTAVG_graph=$graph_header."<th class='thgraph' scope='col'>"._QXZ("CUST AVG")."</th></tr>";
$i=0; $user_stmt="select distinct full_name,vicidial_users.user from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user $group_SQL $user_group_SQL order by full_name asc";
if ($DB) {echo "$user_stmt\n";}
$user_rslt=mysql_to_mysqli($user_stmt, $link);
$q=0;
while($q<mysqli_num_rows($user_rslt))
{
$user_row=mysqli_fetch_row($user_rslt);
$full_name[$q] = $user_row[0];
$user[$q] = $user_row[1];
if (!preg_match("/\-$user[$q]\-/i", $users))
{
$users .= "$user[$q]-";
$usersARY[$k] = $user[$q];
$user_namesARY[$k] = $full_name[$q];
$k++;
}
$q++;
}
$stat_stmt="select distinct status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 $group_SQL $user_group_SQL $user_SQL order by status asc";
$stat_rslt=mysql_to_mysqli($stat_stmt, $link);
if ($DB) {$HTML_text.="$stat_stmt\n";}
$q=0;
$userTOTcalls=array(); $userTOTcalls=array();
while ($i < $rows_to_print)
{
$row=mysqli_fetch_row($rslt);
# $row[0] = ($row[0] - 1); # subtract 1 for login/logout event compensation
$calls[$i] = $row[0];
$talk_sec[$i] = $row[1];
$full_name[$i] = $row[2];
$user[$i] = $row[3];
$pause_sec[$i] = $row[4];
$wait_sec[$i] = $row[5];
$dispo_sec[$i] = $row[6];
$status[$i] = strtoupper($row[7]);
$dead_sec[$i] = $row[8];
$user_group[$i] = $row[9];
$customer_sec[$i] = ($talk_sec[$i] - $dead_sec[$i]);
if (strlen($status[$i])>0) {$userTOTcalls[$row[3]]+=$row[0];} while ($stat_row=mysqli_fetch_row($stat_rslt)) {
$current_status=$stat_row[0];
$max_varname="max_".$status[$i]; $stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status,sum(dead_sec), vicidial_users.user_group from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 and status='$current_status' $group_SQL $user_group_SQL $user_SQL group by user,full_name,user_group,status order by full_name,user,status desc limit 500000;";
$$max_varname=1; $rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {$HTML_text.="$stmt\n";}
if ($customer_sec[$i] < 1) $rows_to_print+=mysqli_num_rows($rslt);
{$customer_sec[$i]=0;}
if ( (!preg_match("/\-$status[$i]\-/i", $statuses)) and (strlen($status[$i])>0) ) $stat_rows_to_print = mysqli_num_rows($rslt);
$i=0;
while ($i < $stat_rows_to_print)
{ {
$statusesTXT = sprintf("%8s", $status[$i]); $row=mysqli_fetch_row($rslt);
# $row[0] = ($row[0] - 1); # subtract 1 for login/logout event compensation
$calls[$q] = $row[0];
$talk_sec[$q] = $row[1];
$full_name[$q] = $row[2];
$user[$q] = $row[3];
$pause_sec[$q] = $row[4];
$wait_sec[$q] = $row[5];
$dispo_sec[$q] = $row[6];
$status[$q] = strtoupper($row[7]);
$dead_sec[$q] = $row[8];
$user_group[$q] = $row[9];
$customer_sec[$q] = ($talk_sec[$q] - $dead_sec[$q]);
$statusesHEAD .= "----------+"; if (strlen($status[$q])>0) {$userTOTcalls[$row[3]]+=$row[0];}
$statusesHTML .= " $statusesTXT |";
$CSV_header.=",\"$status[$i]\"";
if($show_percentages) { $max_varname="max_".$status[$q];
$statusesHEAD .= "------------+"; $$max_varname=1;
$statusesHTML .= " $statusesTXT % |";
$CSV_header.=",\"$status[$i] %\""; if ($customer_sec[$q] < 1)
{$customer_sec[$q]=0;}
if ( (!preg_match("/\-$status[$q]\-/i", $statuses)) and (strlen($status[$q])>0) )
{
$statusesTXT = sprintf("%8s", $status[$q]);
$statusesHEAD .= "----------+";
$statusesHTML .= " $statusesTXT |";
$CSV_header.=",\"$status[$q]\"";
if($show_percentages) {
$statusesHEAD .= "------------+";
$statusesHTML .= " $statusesTXT % |";
$CSV_header.=",\"$status[$q] %\"";
}
$statuses .= "$status[$q]-";
$statusesARY[$j] = $status[$q];
$j++;
}
if (!preg_match("/\-$user[$q]\-/i", $users))
{
$users .= "$user[$q]-";
$usersARY[$k] = $user[$q];
$user_namesARY[$k] = $full_name[$q];
$user_groupsARY[$k] = $user_group[$q];
$k++;
}
$i++;
$q++;
} }
}
$statuses .= "$status[$i]-";
$statusesARY[$j] = $status[$i];
$j++;
}
if (!preg_match("/\-$user[$i]\-/i", $users))
{
$users .= "$user[$i]-";
$usersARY[$k] = $user[$i];
$user_namesARY[$k] = $full_name[$i];
$user_groupsARY[$k] = $user_group[$i];
$k++;
}
$i++;
}
$CSV_header.="\n"; $CSV_header.="\n";
$CSV_lines=''; $CSV_lines='';
@@ -1314,45 +1348,57 @@ $TOTAL_graph=$graph_header."<th class='thgraph' scope='col'>"._QXZ("TOTAL")." </
$NONPAUSE_graph=$graph_header."<th class='thgraph' scope='col'>"._QXZ("NONPAUSE")."</th></tr>"; $NONPAUSE_graph=$graph_header."<th class='thgraph' scope='col'>"._QXZ("NONPAUSE")."</th></tr>";
$PAUSE_graph=$graph_header."<th class='thgraph' scope='col'>"._QXZ("PAUSE")."</th></tr>"; $PAUSE_graph=$graph_header."<th class='thgraph' scope='col'>"._QXZ("PAUSE")."</th></tr>";
$stmt="select full_name,vicidial_users.user,sum(pause_sec),sub_status,sum(wait_sec + talk_sec + dispo_sec), vicidial_users.user_group from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and pause_sec<65000 $group_SQL $user_group_SQL $user_SQL group by user,full_name,sub_status order by user,full_name,sub_status desc limit 100000;"; $sub_status_stmt="select distinct sub_status from vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and pause_sec > 0 and pause_sec < 65000 $group_SQL $user_SQL order by sub_status asc limit 10000000;";
$rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$sub_status_stmt\n";}
if ($DB) {$ASCII_text.="$stmt\n";} $sub_status_rslt=mysql_to_mysqli($sub_status_stmt, $link);
$subs_to_print = mysqli_num_rows($rslt); $subs_to_print=0;
$i=0; $q=0;
while ($i < $subs_to_print) while($ss_row=mysqli_fetch_row($sub_status_rslt)) {
{ $current_ss=$ss_row[0];
$row=mysqli_fetch_row($rslt);
$PCfull_name[$i] = $row[0];
$PCuser[$i] = $row[1];
$PCpause_sec[$i] = $row[2];
$sub_status[$i] = $row[3];
$PCnon_pause_sec[$i] = $row[4];
$PCuser_group[$i] = $row[5];
$max_varname="max_".$sub_status[$i];
$$max_varname=1;
# echo "$sub_status[$i]|$PCpause_sec[$i]\n"; $stmt="select full_name,vicidial_users.user,sum(pause_sec),sub_status,sum(wait_sec + talk_sec + dispo_sec), vicidial_users.user_group from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and sub_status='$current_ss' and vicidial_users.user=vicidial_agent_log.user and pause_sec<65000 $group_SQL $user_group_SQL $user_SQL group by user,full_name,sub_status order by user,full_name,sub_status desc limit 100000;";
# if ( (!preg_match("/\-$sub_status[$i]\-/i", $sub_statuses)) and (strlen($sub_status[$i])>0) ) $rslt=mysql_to_mysqli($stmt, $link);
if (!preg_match("/\-$sub_status[$i]\-/i", $sub_statuses)) if ($DB) {$ASCII_text.="$stmt\n";}
# $subs_to_print = mysqli_num_rows($rslt);
$sub_subs_to_print = mysqli_num_rows($rslt);
$subs_to_print+=$sub_subs_to_print;
$i=0;
while ($i < $sub_subs_to_print)
{ {
$sub_statusesTXT = sprintf("%8s", $sub_status[$i]); $row=mysqli_fetch_row($rslt);
$sub_statusesHEAD .= "----------+"; $PCfull_name[$q] = $row[0];
$sub_statusesHTML .= " $sub_statusesTXT |"; $PCuser[$q] = $row[1];
$sub_statuses .= "$sub_status[$i]-"; $PCpause_sec[$q] = $row[2];
$sub_statusesARY[$j] = $sub_status[$i]; $sub_status[$q] = $row[3];
$CSV_statuses.=",\"$sub_status[$i]\""; $PCnon_pause_sec[$q] = $row[4];
$j++; $PCuser_group[$q] = $row[5];
} $max_varname="max_".$sub_status[$q];
if (!preg_match("/\-$PCuser[$i]\-/i", $PCusers)) $$max_varname=1;
{
$PCusers .= "$PCuser[$i]-";
$PCusersARY[$k] = $PCuser[$i];
$PCuser_namesARY[$k] = $PCfull_name[$i];
$PCuser_groupsARY[$k] = $PCuser_group[$i];
$k++;
}
$i++; # echo "$sub_status[$i]|$PCpause_sec[$i]\n";
# if ( (!preg_match("/\-$sub_status[$i]\-/i", $sub_statuses)) and (strlen($sub_status[$i])>0) )
if (!preg_match("/\-$sub_status[$q]\-/i", $sub_statuses))
{
$sub_statusesTXT = sprintf("%8s", $sub_status[$q]);
$sub_statusesHEAD .= "----------+";
$sub_statusesHTML .= " $sub_statusesTXT |";
$sub_statuses .= "$sub_status[$q]-";
$sub_statusesARY[$j] = $sub_status[$q];
$CSV_statuses.=",\"$sub_status[$q]\"";
$j++;
}
if (!preg_match("/\-$PCuser[$q]\-/i", $PCusers))
{
$PCusers .= "$PCuser[$q]-";
$PCusersARY[$k] = $PCuser[$q];
$PCuser_namesARY[$k] = $PCfull_name[$q];
$PCuser_groupsARY[$k] = $PCuser_group[$q];
$k++;
}
$i++;
$q++;
}
} }
$ASCII_text.=_QXZ("PAUSE CODE BREAKDOWN",20).": <a href=\"$LINKbase&stage=$stage&file_download=2\">["._QXZ("DOWNLOAD")."]</a>\n\n"; $ASCII_text.=_QXZ("PAUSE CODE BREAKDOWN",20).": <a href=\"$LINKbase&stage=$stage&file_download=2\">["._QXZ("DOWNLOAD")."]</a>\n\n";
@@ -1426,8 +1472,8 @@ while ($m < $k)
} }
if ($status_found < 1) if ($status_found < 1)
{ {
$SstatusesHTML .= " 0 |"; $SstatusesHTML .= " 0:00 |";
$CSV_statuses.=",\"0\""; $CSV_statuses.=",\"0:00\"";
$graph_stats[$m][(4+$n)]=0; $graph_stats[$m][(4+$n)]=0;
} }
### END loop through each stat line ### ### END loop through each stat line ###
@@ -26,6 +26,7 @@
# 140108-0711 - Added webserver and hostname to report logging # 140108-0711 - Added webserver and hostname to report logging
# 140328-0005 - Converted division calculations to use MathZDC function # 140328-0005 - Converted division calculations to use MathZDC function
# 150516-1310 - Fixed Javascript element problem, Issue #857 # 150516-1310 - Fixed Javascript element problem, Issue #857
# 150603-1532 - Statuses are now sorted in alphabetical order
# #
$startMS = microtime(); $startMS = microtime();
@@ -478,46 +479,78 @@ else
$user_namesARY[0]=''; $user_namesARY[0]='';
$k=0; $k=0;
$stmt="select count(*) as calls,full_name,vicidial_users.user,status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user $group_SQL $user_group_SQL group by user,full_name,status order by full_name,user,status desc limit 500000;"; $user_stmt="select distinct full_name,vicidial_users.user from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and status is not null $group_SQL $user_group_SQL order by full_name asc";
$rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$user_stmt\n";}
if ($DB) {echo "$stmt\n";} $user_rslt=mysql_to_mysqli($user_stmt, $link);
$rows_to_print = mysqli_num_rows($rslt); $q=0;
$i=0; $sub_status_count=0; while($q<mysqli_num_rows($user_rslt))
while ($i < $rows_to_print)
{ {
$row=mysqli_fetch_row($rslt); $user_row=mysqli_fetch_row($user_rslt);
$full_name[$q] = $user_row[0];
$user[$q] = $user_row[1];
if ( ($row[0] > 0) and (strlen($row[3]) > 0) and (!preg_match("/NULL/i",$row[3]))) if (!preg_match("/\-$user[$q]\-/i", $users))
{ {
$calls[$i] = $row[0]; $users .= "$user[$q]-";
$full_name[$i] = $row[1]; $usersARY[$k] = $user[$q];
$user[$i] = $row[2]; $user_namesARY[$k] = $full_name[$q];
$status[$i] = $row[3]; $k++;
if ( (!preg_match("/-$status[$i]-/i", $statuses)) and (strlen($status[$i])>0) ) }
{ $q++;
$statusesTXT = sprintf("%8s", $status[$i]); }
$statusesHEAD .= "----------+";
$statusesHTML .= " $statusesTXT |"; $status_stmt="select distinct status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user $group_SQL $user_group_SQL order by status";
$statusesFILE .= "$statusesTXT,"; if ($DB) {echo "$status_stmt\n";}
$statuses .= "$status[$i]-"; $status_rslt=mysql_to_mysqli($status_stmt, $link);
$statusesARY[$j] = $status[$i]; $q=0;
$status_rows_to_print=0;
$sub_statusesARY[$sub_status_count] = $status[$i]; while($status_row=mysqli_fetch_row($status_rslt))
$sub_status_count++; {
$max_varname="max_".$status[$i]; $current_status=$status_row[0];
$$max_varname=1;
$stmt="select count(*) as calls,full_name,vicidial_users.user,status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and status='$current_status' $group_SQL $user_group_SQL group by user,full_name,status order by full_name,user,status desc limit 500000;";
$j++; $rslt=mysql_to_mysqli($stmt, $link);
} if ($DB) {echo "$stmt\n";}
if (!preg_match("/\-$user[$i]\-/i", $users)) $status_rows_to_print = mysqli_num_rows($rslt);
{ $rows_to_print+=$status_rows_to_print;
$users .= "$user[$i]-"; $i=0; $sub_status_count=0;
$usersARY[$k] = $user[$i]; while ($i < $status_rows_to_print)
$user_namesARY[$k] = $full_name[$i]; {
$k++; $row=mysqli_fetch_row($rslt);
}
if ( ($row[0] > 0) and (strlen($row[2]) > 0) and (strlen($row[3]) > 0) and (!preg_match("/NULL/i",$row[3])))
{
$calls[$q] = $row[0];
$full_name[$q] = $row[1];
$user[$q] = $row[2];
$status[$q] = $row[3];
if ( (!preg_match("/-$status[$q]-/i", $statuses)) and (strlen($status[$q])>0) )
{
$statusesTXT = sprintf("%8s", $status[$q]);
$statusesHEAD .= "----------+";
$statusesHTML .= " $statusesTXT |";
$statusesFILE .= "$statusesTXT,";
$statuses .= "$status[$q]-";
$statusesARY[$j] = $status[$q];
$sub_statusesARY[$sub_status_count] = $status[$q];
$sub_status_count++;
$max_varname="max_".$status[$q];
$$max_varname=1;
$j++;
}
if (!preg_match("/\-$user[$q]\-/i", $users))
{
$users .= "$user[$q]-";
$usersARY[$k] = $user[$q];
$user_namesARY[$k] = $full_name[$q];
$k++;
}
}
$i++;
$q++;
} }
$i++;
} }
if ($file_download < 1) if ($file_download < 1)
@@ -68,6 +68,7 @@
# 150114-2321 - Added date_of_birth as editable field # 150114-2321 - Added date_of_birth as editable field
# 150312-1506 - Fixed minor Iframe form bug related to custom fields # 150312-1506 - Fixed minor Iframe form bug related to custom fields
# 150514-1522 - Added $gmt_offset lookup for adding a new lead # 150514-1522 - Added $gmt_offset lookup for adding a new lead
# 150603-1527 - Allow non-digit characters in alt_phone field
# #
require("dbconnect_mysqli.php"); require("dbconnect_mysqli.php");
@@ -232,7 +233,7 @@ if ($non_latin < 1)
$old_phone = preg_replace('/[^0-9]/','',$old_phone); $old_phone = preg_replace('/[^0-9]/','',$old_phone);
$phone_number = preg_replace('/[^0-9]/','',$phone_number); $phone_number = preg_replace('/[^0-9]/','',$phone_number);
$alt_phone = preg_replace('/[^0-9]/','',$alt_phone); $alt_phone = preg_replace('/[^- \'\+\_\.0-9a-zA-Z]/','',$alt_phone);
} # end of non_latin } # end of non_latin
else else
{ {
@@ -42,6 +42,7 @@
# 141229-1748 - Added code for on-the-fly language translations display # 141229-1748 - Added code for on-the-fly language translations display
# 150107-1728 - Added ignore_group_on_search user option # 150107-1728 - Added ignore_group_on_search user option
# 150312-1507 - Allow for single quotes in vicidial_list data fields # 150312-1507 - Allow for single quotes in vicidial_list data fields
# 150602-1207 - Allow for searching by email address
# #
require("dbconnect_mysqli.php"); require("dbconnect_mysqli.php");
@@ -56,6 +57,8 @@ if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
if (isset($_GET["email"])) {$email=$_GET["email"];}
elseif (isset($_POST["email"])) {$email=$_POST["email"];}
if (isset($_GET["phone"])) {$phone=$_GET["phone"];} if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
@@ -308,7 +311,7 @@ echo " "._QXZ("Lead search").": $vendor_id $phone $lead_id $status $list_id $use
echo date("l F j, Y G:i:s A"); echo date("l F j, Y G:i:s A");
echo "<BR>\n"; echo "<BR>\n";
if ( (!$vendor_id) and (!$phone) and (!$lead_id) and (!$log_phone) and (!$log_lead_id) and (!$log_phone_archive) and (!$log_lead_id_archive) and ( (strlen($status)<1) and (strlen($list_id)<1) and (strlen($user)<1) and (strlen($owner)<1) ) and ( (strlen($first_name)<1) and (strlen($last_name)<1) )) if ( (!$vendor_id) and (!$phone) and (!$lead_id) and (!$log_phone) and (!$log_lead_id) and (!$log_phone_archive) and (!$log_lead_id_archive) and ( (strlen($status)<1) and (strlen($list_id)<1) and (strlen($user)<1) and (strlen($owner)<1) ) and ( (strlen($first_name)<1) and (strlen($last_name)<1) and (strlen($email)<1) ))
{ {
### Lead search ### Lead search
echo "<br><center>\n"; echo "<br><center>\n";
@@ -368,6 +371,12 @@ if ( (!$vendor_id) and (!$phone) and (!$lead_id) and (!$log_phone) and (!$log_
echo "<TD rowspan=2><INPUT TYPE=SUBMIT NAME=SUBMIT VALUE='"._QXZ("SUBMIT")."'></TD>\n"; echo "<TD rowspan=2><INPUT TYPE=SUBMIT NAME=SUBMIT VALUE='"._QXZ("SUBMIT")."'></TD>\n";
echo "</TR><TR bgcolor=#B9CBFD>"; echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>$label_last_name: &nbsp; </TD><TD ALIGN=left><input type=text name=last_name size=15 maxlength=30></TD>"; echo "<TD ALIGN=right>$label_last_name: &nbsp; </TD><TD ALIGN=left><input type=text name=last_name size=15 maxlength=30></TD>";
echo "</TR><TR bgcolor=#015B91>";
echo "<TD colspan=3 align=center height=1></TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>$label_email: &nbsp; </TD><TD ALIGN=left><input type=text name=email size=15 maxlength=30></TD>";
echo "<TD><INPUT TYPE=SUBMIT NAME=SUBMIT VALUE='"._QXZ("SUBMIT")."'></TD>\n";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "</TR>"; echo "</TR>";
@@ -976,8 +985,16 @@ else
} }
else else
{ {
print _QXZ("ERROR: you must search for something! Go back and search for something"); if ( (strlen($email)>0) )
exit; {
$email_SQL = "email='" . mysqli_real_escape_string($link, $email) . "'";
$stmt="SELECT $vicidial_list_fields from $vl_table where $email_SQL $LOGallowed_listsSQL";
}
else
{
print _QXZ("ERROR: you must search for something! Go back and search for something");
exit;
}
} }
} }
} }
+4 -3
View File
@@ -99,10 +99,11 @@
# 150430-0644 - Added API allowed function restrictions and allowed list restrictions # 150430-0644 - Added API allowed function restrictions and allowed list restrictions
# 150512-2028 - Added filtering of hash sign on some input variables, Issue #851 # 150512-2028 - Added filtering of hash sign on some input variables, Issue #851
# 150516-1138 - Fixed conflict with functions.php # 150516-1138 - Fixed conflict with functions.php
# 150603-1528 - Fixed format issue in recording_lookup
# #
$version = '2.12-75'; $version = '2.12-76';
$build = '150516-1138'; $build = '150603-1528';
$api_url_log = 0; $api_url_log = 0;
$startMS = microtime(); $startMS = microtime();
@@ -4373,7 +4374,7 @@ if ($function == 'recording_lookup')
if ($stage == 'pipe') if ($stage == 'pipe')
{$DL = '|'; $DLset++;} {$DL = '|'; $DLset++;}
if ($DLset < 1) if ($DLset < 1)
{$DL='pipe';} {$DL='|';}
if ($header == 'YES') if ($header == 'YES')
{$output .= 'start_time' . $DL . 'user' . $DL . 'recording_id' . $DL . 'lead_id' . $DL . "location\n";} {$output .= 'start_time' . $DL . 'user' . $DL . 'recording_id' . $DL . 'lead_id' . $DL . "location\n";}