why are closer logs updated this way?
Posted: Mon Aug 26, 2013 8:48 pm
how come in many areas we search from 4 hours ago or 1 hour ago? why not jsut order by call_date desc?
this is from the svn trunk but also all other versions:
this is from the svn trunk but also all other versions:
- Code: Select all
$four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y")));
if ($VLA_inOUT == 'INBOUND')
{
$vcl_statusSQL='';
if ($VDstatus == 'INCALL') {$vcl_statusSQL = ",status='$status_dispo'";}
$stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' $vcl_statusSQL where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00062',$user,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($link);
if ($affected_rows > 0)
{
echo "$uniqueid\n$channel\n";
# $fp = fopen ("./vicidial_debug.txt", "a");
# fwrite ($fp, "$NOW_TIME|INBND_LOG_4|$VDstatus|$uniqueid|$lead_id|$user|$inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$start_epoch|$stmt|\n");
# fclose($fp);
}
else
{
$fp = fopen ("./vicidial_debug.txt", "a");
fwrite ($fp, "$NOW_TIME|INBND_LOG_2|$uniqueid|$lead_id|$user|$inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$start_epoch|\n");
fclose($fp);
}
}