Added Agent Lead Search feature
Added display of lead searches in user stats page Fixed rare performance bug in real time report git-svn-id: svn://192.168.202.10@1603 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
# Based on perl scripts in ViciDial from Matt Florell and post:
|
||||
# http://www.vicidial.org/VICIDIALforum/viewtopic.php?p=22506&sid=ca5347cffa6f6382f56ce3db9fb3d068#22506
|
||||
#
|
||||
# Copyright (C) 2010 I. Taushanov, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2011 I. Taushanov, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
# 90615-1701 - First version
|
||||
@@ -28,6 +28,7 @@
|
||||
# 100103-2052 - Formatting fixes, name change, added initial table counts and added archive tables to official SQL files
|
||||
# 100109-1018 - Added vicidial_carrier_log archiving
|
||||
# 100328-1008 - Added --months CLI option
|
||||
# 110218-1200 - Added notes and search log archiving
|
||||
#
|
||||
|
||||
### begin parsing run-time options ###
|
||||
@@ -97,7 +98,8 @@ $del_time = "$year-$mon-$mday 01:00:00";
|
||||
|
||||
if (!$Q) {print "\n\n-- ADMIN_archive_log_tables.pl --\n\n";}
|
||||
if (!$Q) {print "This program is designed to put all records from call_log, vicidial_log,\n";}
|
||||
if (!$Q) {print "server_performance, vicidial_agent_log and vicidial_carrier_log in relevant\n";}
|
||||
if (!$Q) {print "server_performance, vicidial_agent_log, vicidial_carrier_log, \n";}
|
||||
if (!$Q) {print "vicidial_call_notes and vicidial_lead_search_log in relevant\n";}
|
||||
if (!$Q) {print "_archive tables and delete records in original tables older than\n";}
|
||||
if (!$Q) {print "$CLImonths months ( $del_time ) from current date \n\n";}
|
||||
|
||||
@@ -382,6 +384,108 @@ if (!$T)
|
||||
}
|
||||
|
||||
|
||||
|
||||
##### vicidial_call_notes
|
||||
$stmtA = "SELECT count(*) from vicidial_call_notes;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$vicidial_call_notes_count = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA = "SELECT count(*) from vicidial_call_notes_archive;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$vicidial_call_notes_archive_count = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if (!$Q) {print "\nProcessing vicidial_call_notes table... ($vicidial_call_notes_count|$vicidial_call_notes_archive_count)\n";}
|
||||
$stmtA = "INSERT IGNORE INTO vicidial_call_notes_archive SELECT * from vicidial_call_notes;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
|
||||
$sthArows = $sthA->rows;
|
||||
if (!$Q) {print "$sthArows rows inserted into vicidial_call_notes_archive table \n";}
|
||||
|
||||
$rv = $sthA->err();
|
||||
if (!$rv)
|
||||
{
|
||||
$stmtA = "DELETE FROM vicidial_call_notes WHERE call_date < '$del_time';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows = $sthA->rows;
|
||||
if (!$Q) {print "$sthArows rows deleted from vicidial_call_notes table \n";}
|
||||
|
||||
$stmtA = "optimize table vicidial_call_notes;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
|
||||
$stmtA = "optimize table vicidial_call_notes_archive;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
##### vicidial_lead_search_log
|
||||
$stmtA = "SELECT count(*) from vicidial_lead_search_log;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$vicidial_lead_search_log_count = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA = "SELECT count(*) from vicidial_lead_search_log_archive;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$vicidial_lead_search_log_archive_count = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if (!$Q) {print "\nProcessing vicidial_lead_search_log table... ($vicidial_lead_search_log_count|$vicidial_lead_search_log_archive_count)\n";}
|
||||
$stmtA = "INSERT IGNORE INTO vicidial_lead_search_log_archive SELECT * from vicidial_lead_search_log;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
|
||||
$sthArows = $sthA->rows;
|
||||
if (!$Q) {print "$sthArows rows inserted into vicidial_lead_search_log_archive table \n";}
|
||||
|
||||
$rv = $sthA->err();
|
||||
if (!$rv)
|
||||
{
|
||||
$stmtA = "DELETE FROM vicidial_lead_search_log WHERE event_date < '$del_time';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows = $sthA->rows;
|
||||
if (!$Q) {print "$sthArows rows deleted from vicidial_lead_search_log table \n";}
|
||||
|
||||
$stmtA = "optimize table vicidial_lead_search_log;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
|
||||
$stmtA = "optimize table vicidial_lead_search_log_archive;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
}
|
||||
|
||||
|
||||
#$dbhA->disconnect();
|
||||
#print "$del_time\n\n";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user