Enable Contact in System Settings
Changes in Campaign:-
Changes required for like search
______________________________ _______________________
in /agc/vdc_db_query.php file modification.
##############################
### SEARCHCONTACTSRESULTSview - display search results for contacts search // Added by Manish date 15-03-2022 LIKE SEARCH RESULTSview for forest department
##############################
if ($ACTION == 'SEARCHCONTACTSRESULTSview')
{
if (strlen($stage) < 3)
{$stage = '670';}
$stmt="SELECT agent_lead_search_method,
if ($non_latin > 0) {$rslt=mysql_to_mysqli("SET NAMES 'UTF8'", $link);}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_
$camps_to_print = mysqli_num_rows($rslt);
if ($camps_to_print > 0)
{
$row=mysqli_fetch_row($rslt);
$agent_lead_search_method = $row[0];
$manual_dial_list_id = $row[1];
$searchSQL='';
$searchmethodSQL='';
$last_name = preg_replace("/\'|\"|\\\\|;/",
$first_name = preg_replace("/\'|\"|\\\\|;/",
$phone_number = preg_replace("/\'|\"|\\\\|;/",
$bu_name = preg_replace("/\'|\"|\\\\|;/",
$department = preg_replace("/\'|\"|\\\\|;/",
$group_name = preg_replace("/\'|\"|\\\\|;/",
$job_title = preg_replace("/\'|\"|\\\\|;/",
$location = preg_replace("/\'|\"|\\\\|;/",
if (strlen($phone_number) >= 2)
{
$searchSQL .= "office_num LIKE '$%phone_number%'";
}
elseif (strlen($last_name) > 0)
{
$searchSQL = "last_name LIKE \"%$last_name%\"";
if (strlen($first_name) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "first_name LIKE \"$first_name\"";
}
if (strlen($bu_name) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "bu_name LIKE \"%$bu_name%\"";
}
if (strlen($department) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "department LIKE \"%$department%\"";
}
if (strlen($group_name) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "group_name LIKE \"%$group_name%\"";
}
if (strlen($job_title) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "job_title LIKE \"%$job_title%\"";
}
if (strlen($location) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "location LIKE \"%$location%\"";
}
}
elseif (strlen($first_name) > 0)
{
$searchSQL = "first_name LIKE \"%$first_name%\"";
if (strlen($bu_name) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "bu_name LIKE \"%$bu_name%\"";
}
if (strlen($department) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "department LIKE \"%$department%\"";
}
if (strlen($group_name) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "group_name LIKE \"%$group_name%\"";
}
if (strlen($job_title) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "job_title LIKE \"%$job_title%\"";
}
if (strlen($location) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "location LIKE \"%$location%\"";
}
}
elseif (strlen($bu_name) > 0)
{
$searchSQL = "bu_name LIKE \"$bu_name\"";
if (strlen($department) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "department LIKE \"%$department%\"";
}
if (strlen($group_name) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "group_name LIKE \"%$group_name%\"";
}
if (strlen($job_title) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "job_title LIKE \"%$job_title%\"";
}
if (strlen($location) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "location LIKE \"%$location%\"";
}
}
elseif (strlen($department) > 0)
{
$searchSQL = "department LIKE \"%$department%\"";
if (strlen($group_name) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "group_name LIKE \"%$group_name%\"";
}
if (strlen($job_title) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "job_title LIKE \"%$job_title%\"";
}
if (strlen($location) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "location LIKE \"%$location%\"";
}
}
elseif (strlen($group_name) > 0)
{
$searchSQL = "group_name LIKE \"%$group_name%\"";
if (strlen($job_title) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "job_title LIKE \"%$job_title%\"";
}
if (strlen($location) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "location LIKE \"%$location%\"";
}
}
elseif (strlen($job_title) > 0)
{
$searchSQL = "job_title LIKE \"%$job_title%\"";
if (strlen($location) > 0)
{
if (strlen($searchSQL) > 10) {$searchSQL .= " and ";}
$searchSQL .= "location LIKE \"%$location%\"";
}
}
elseif (strlen($location) > 0)
{
$searchSQL = "location LIKE \"%$location%\"";
}
else
{
echo _QXZ("ERROR").": "._QXZ("You must enter in search terms, one of these must be populated: office number, last name, first name")."\n";
echo "<BR><BR>";
echo "<a href=\"#\" onclick=\"hideDiv('
echo "</CENTER>";
if ($SSagent_debug_logging > 0) {vicidial_ajax_log($NOW_TIME,$
exit;
}
$ALLsort = array();
$ALLfirst = array();
$ALLlast = array();
$ALLoffice_num = array();
$ALLcell_num = array();
$ALLother_num1 = array();
$ALLother_num2 = array();
$ALLbu_name = array();
$ALLdepartment = array();
$ALLgroup_name = array();
$ALLjob_title = array();
$ALLlocation = array();
##### BEGIN search queries and output #####
$stmt="SELECT count(*) from contact_information where $searchSQL;";
### LOG INSERTION Search Log Table ###
$SQL_log = "$stmt|";
$SQL_log = preg_replace('/;/','',$SQL_
$SQL_log = addslashes($SQL_log);
$stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";";
if ($DB) {echo "|$stmtL|\n";}
$rslt=mysql_to_mysqli($stmtL, $link);
if ($mel > 0) {mysql_error_logging($NOW_
$search_log_id = mysqli_insert_id($link);
if ( (preg_match("/contact_
{
$linkALT=mysqli_connect("$alt_
if (!$linkALT) {die(_QXZ("Could not connect: ")."$alt_log_server_ip|$alt_
mysqli_select_db($linkALT, "$alt_log_dbname");
}
else
{$linkALT = $link;}
$rsltALT=mysql_to_mysqli($
if ($mel > 0) {mysql_error_logging($NOW_
$counts_to_print = mysqli_num_rows($rsltALT);
if ($counts_to_print > 0)
{
$row=mysqli_fetch_row($
$search_result_count = $row[0];
$end_process_time = date("U");
$search_seconds = ($end_process_time - $StarTtime);
$stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count'
if ($DB) {echo "|$stmtL|\n";}
$rslt=mysql_to_mysqli($stmtL, $link);
if ($mel > 0) {mysql_error_logging($NOW_
echo "<CENTER>\n";
echo "<font style=\"font-size:14px;font-
echo _QXZ("Results Found:")." $search_result_count";
echo "</B></font>\n";
echo "<BR>\n";
echo "<TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0 WIDTH=$stage>";
echo "<TR>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:10px;font-
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-
echo "</TR>";
if ($search_result_count)
{
$stmt="SELECT first_name,last_name,office_
$rsltALT=mysql_to_mysqli($
if ($mel > 0) {mysql_error_logging($NOW_
$out_logs_to_print = mysqli_num_rows($rsltALT);
if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";}
$g=0;
$u=0;
while ($out_logs_to_print > $u)
{
$row=mysqli_fetch_row($
$ALLsort[$g] = "$row[0]-----$g";
$ALLfirst[$g] = $row[0];
$ALLlast[$g] = $row[1];
$ALLoffice_num[$g] = $row[2];
$ALLcell_num[$g] = $row[3];
$ALLother_num1[$g] = $row[4];
$ALLother_num2[$g] = $row[5];
$ALLbu_name[$g] = $row[6];
$ALLdepartment[$g] = $row[7];
$ALLgroup_name[$g] = $row[8];
$ALLjob_title[$g] = $row[9];
$ALLlocation[$g] = $row[10];
$g++;
$u++;
}
if ($g < 1)
{echo "<tr bgcolor=white><td colspan=10 align=center>"._QXZ("No results found")."</td></tr>";}
$u=0;
while ($g > $u)
{
$sort_split = explode("-----",$ALLsort[$u]);
$i = $sort_split[1];
if (preg_match("/1$|3$|5$|7$|9$/
{$bgcolor='bgcolor="#B9CBFD"';
else
{$bgcolor='bgcolor="#9BB9FB"';
$u++;
echo "<tr $bgcolor>";
echo "<td><font size=1>$u </td>";
echo "<td align=left> <font size=3 face=\"Arial, Helvetica, sans-serif\">$ALLfirst[$i] </td>\n";
echo "<td align=left> <font size=3 face=\"Arial, Helvetica, sans-serif\">$ALLlast[$i] </td>\n";
echo "<td align=left> <font size=3 face=\"Arial, Helvetica, sans-serif\"> <a href=\"#\" onclick=\"PresetSelect_submit(
echo "<td align=left> <font size=3 face=\"Arial, Helvetica, sans-serif\"> <a href=\"#\" onclick=\"PresetSelect_submit(
echo "<td align=left> <font size=3 face=\"Arial, Helvetica, sans-serif\"> <a href=\"#\" onclick=\"PresetSelect_submit(
echo "<td align=left> <font size=3 face=\"Arial, Helvetica, sans-serif\"> <a href=\"#\" onclick=\"PresetSelect_submit(
echo "<td align=left> <font size=3 face=\"Arial, Helvetica, sans-serif\">$ALLbu_name[$i] </td>\n";
echo "</tr>\n";
echo "<tr $bgcolor>";
echo "<td colspan=8><font class='sh_text'> <B>"._QXZ("Dept:")."</B> $ALLdepartment[$i] <B>"._QXZ("Group").":</B> $ALLgroup_name[$i] <B>"._QXZ("Job:")."</B> $ALLjob_title[$i] <B>"._QXZ("Location:")."</B> $ALLlocation[$i]</td>";
echo "</tr>\n";
}
$end_process_time = date("U");
$search_seconds = ($end_process_time - $StarTtime);
$stmtL="UPDATE vicidial_lead_search_log set seconds='$search_seconds' where search_log_id='$search_log_id'
if ($DB) {echo "|$stmtL|\n";}
$rslt=mysql_to_mysqli($stmtL, $link);
if ($mel > 0) {mysql_error_logging($NOW_
}
else
{echo "<tr bgcolor=white><td colspan=10 align=center>"._QXZ("No results found")."</td></tr>";}
echo "</TABLE>";
echo "<BR>";
echo "<a href=\"#\" onclick=\"hideDiv('
echo "</CENTER>";
}
else
{
echo _QXZ("ERROR").": "._QXZ("There was a problem with your search terms")."\n";
echo "<BR><BR>";
echo "<a href=\"#\" onclick=\"hideDiv('
echo "</CENTER>";
if ($SSagent_debug_logging > 0) {vicidial_ajax_log($NOW_TIME,$
exit;
}
##### END search queries and output #####
}
else
{
echo _QXZ("ERROR").": "._QXZ("Campaign not found")."\n";
echo "<BR><BR>";
echo "<a href=\"#\" onclick=\"hideDiv('
echo "</CENTER>";
if ($SSagent_debug_logging > 0) {vicidial_ajax_log($NOW_TIME,$
exit;
}
}
Comments
Post a Comment