diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE
index f2d569a6..0db69140 100644
--- a/agc_2-X/trunk/UPGRADE
+++ b/agc_2-X/trunk/UPGRADE
@@ -211,6 +211,10 @@ OTHER CHANGES:
SXC - OpenOffice.org First Generation Spreadsheet
ODS - OpenOffice.org OpenDocument Spreadsheet
+46. Added the ability to run selected reports from a MySQL slave server. This is
+ definable in the System Settings in the admin.php interface. You must
+ already have MySQL Master/Slave replication set up for this to work.
+
diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql
index e676e03f..27a98ff3 100644
--- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql
+++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql
@@ -307,6 +307,7 @@ called_count SMALLINT(5) UNSIGNED default '0',
last_local_call_time DATETIME,
rank SMALLINT(5) NOT NULL default '0',
owner VARCHAR(20) default '',
+entry_list_id BIGINT(14) UNSIGNED NOT NULL DEFAULT '0',
index (phone_number),
index (list_id),
index (called_since_last_reset),
@@ -1291,7 +1292,9 @@ label_phone_code VARCHAR(40) default '',
label_alt_phone VARCHAR(40) default '',
label_security_phrase VARCHAR(40) default '',
label_email VARCHAR(40) default '',
-label_comments VARCHAR(40) default ''
+label_comments VARCHAR(40) default '',
+slave_db_server VARCHAR(50) default '',
+reports_use_slave_db VARCHAR(2000) default ''
);
CREATE TABLE vicidial_campaigns_list_mix (
@@ -2273,7 +2276,7 @@ ALTER TABLE vicidial_agent_log_archive MODIFY agent_log_id INT(9) UNSIGNED NOT N
CREATE TABLE vicidial_carrier_log_archive LIKE vicidial_carrier_log;
-UPDATE system_settings SET db_schema_version='1233',db_schema_update_date=NOW();
+UPDATE system_settings SET db_schema_version='1234',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
diff --git a/agc_2-X/trunk/extras/upgrade_2.4.sql b/agc_2-X/trunk/extras/upgrade_2.4.sql
index 7345f476..aa50c424 100644
--- a/agc_2-X/trunk/extras/upgrade_2.4.sql
+++ b/agc_2-X/trunk/extras/upgrade_2.4.sql
@@ -407,3 +407,10 @@ UPDATE system_settings SET db_schema_version='1232',db_schema_update_date=NOW();
ALTER TABLE vicidial_hopper ENGINE=MEMORY;
UPDATE system_settings SET db_schema_version='1233',db_schema_update_date=NOW();
+
+ALTER TABLE system_settings ADD slave_db_server VARCHAR(50) default '';
+ALTER TABLE system_settings ADD reports_use_slave_db VARCHAR(2000) default '';
+
+ALTER TABLE vicidial_list ADD entry_list_id BIGINT(14) UNSIGNED NOT NULL DEFAULT '0';
+
+UPDATE system_settings SET db_schema_version='1234',db_schema_update_date=NOW();
diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt
index ba9863b0..50e8f5de 100644
--- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt
+++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt
@@ -247,6 +247,10 @@ If custom list fields are enabled on your system, FORM will open the FORM tab up
Enable Custom List Fields||
This setting enables the custom list fields feature that allows for custom data fields to be defined in the administration web interface on a per-list basis and then have those fields available in a FORM tab to the agent in the agent web interface. Default is 0 for disabled||
CUSTOM FIELDS FOR THIS LEAD||
+Slave Database Server||
+If you have a MySQL slave database server then enter the local IP address for that server here. This option is currently only used by the selected reports in the next option and has nothing to do with automatically configuring MySQL master-slave replication. Default is empty for disabled||
+Reports to use Slave DB||
+This option allows you to select the reports that you want to have use the MySQL slave database as defined in the option above instead of the master database that your live ViciDial system is running on. You must set up the MySQL slave replication before you can enable this option. Default is empty for disabled||
AST_VICIDIAL_ingrouplist.php
diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php
index fe10f21b..6ffaae6b 100644
--- a/agc_2-X/trunk/www/agc/vdc_db_query.php
+++ b/agc_2-X/trunk/www/agc/vdc_db_query.php
@@ -249,10 +249,11 @@
# 100622-2217 - Added field labels
# 100624-1401 - Fix for dispo call url bug related to dialed number and label
# 100625-0915 - Fix for auto-dial bug for presets and timer actions
+# 100712-1447 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
#
-$version = '2.4-156';
-$build = '100625-0915';
+$version = '2.4-157';
+$build = '100712-1447';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=333;
$one_mysql_log=0;
@@ -1673,7 +1674,7 @@ if ($ACTION == 'manDiaLnextCaLL')
if ($affected_rows > 0)
{
- $stmt="SELECT lead_id,list_id,gmt_offset_now,state FROM vicidial_list where status='QUEUE' and user='$user' order by modify_date desc LIMIT 1;";
+ $stmt="SELECT lead_id,list_id,gmt_offset_now,state,entry_list_id FROM vicidial_list where status='QUEUE' and user='$user' order by modify_date desc LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00243',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -1685,6 +1686,7 @@ if ($ACTION == 'manDiaLnextCaLL')
$list_id = $row[1];
$gmt_offset_now = $row[2];
$state = $row[3];
+ $entry_list_id = $row[4];
$stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='QUEUE',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='MAIN',user='$user',priority='0';";
if ($DB) {echo "$stmt\n";}
@@ -1719,7 +1721,7 @@ if ($ACTION == 'manDiaLnextCaLL')
}
##### grab the data from vicidial_list for the lead_id
- $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner FROM vicidial_list where lead_id='$lead_id' LIMIT 1;";
+ $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='$lead_id' LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00026',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -1759,6 +1761,7 @@ if ($ACTION == 'manDiaLnextCaLL')
$called_count = trim("$row[30]");
$rank = trim("$row[32]");
$owner = trim("$row[33]");
+ $entry_list_id = trim("$row[34]");
}
$called_count++;
@@ -2189,6 +2192,7 @@ if ($ACTION == 'manDiaLnextCaLL')
$LeaD_InfO .= $VDCL_xferconf_c_number . "\n";
$LeaD_InfO .= $VDCL_xferconf_d_number . "\n";
$LeaD_InfO .= $VDCL_xferconf_e_number . "\n";
+ $LeaD_InfO .= $entry_list_id . "\n";
echo $LeaD_InfO;
}
@@ -3185,7 +3189,7 @@ if ($stage == "end")
{$Xlast=0;}
$VD_altdialx='';
- $stmt="SELECT gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$lead_id';";
+ $stmt="SELECT gmt_offset_now,state,list_id,entry_list_id FROM vicidial_list where lead_id='$lead_id';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00073',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -3196,6 +3200,7 @@ if ($stage == "end")
$EA_gmt_offset_now = $row[0];
$EA_state = $row[1];
$EA_list_id = $row[2];
+ $EA_entry_list_id = $row[3];
}
$alt_dial_phones_count=0;
$stmt="SELECT count(*) FROM vicidial_list_alt_phones where lead_id='$lead_id';";
@@ -3964,7 +3969,7 @@ if ($ACTION == 'VDADcheckINCOMING')
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00107',$user,$server_ip,$session_name,$one_mysql_log);}
##### grab the data from vicidial_list for the lead_id
- $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner FROM vicidial_list where lead_id='$lead_id' LIMIT 1;";
+ $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='$lead_id' LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00108',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -4002,6 +4007,7 @@ if ($ACTION == 'VDADcheckINCOMING')
$called_count = trim("$row[30]");
$rank = trim("$row[32]");
$owner = trim("$row[33]");
+ $entry_list_id = trim("$row[34]");
}
##### if lead is a callback, grab the callback comments
@@ -4576,6 +4582,7 @@ if ($ACTION == 'VDADcheckINCOMING')
$LeaD_InfO .= $rank . "\n";
$LeaD_InfO .= $owner . "\n";
$LeaD_InfO .= $script_recording_delay . "\n";
+ $LeaD_InfO .= $entry_list_id . "\n";
echo $LeaD_InfO;
@@ -5998,7 +6005,7 @@ if ($ACTION == 'updateDISPO')
##### grab the data from vicidial_list for the lead_id
- $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner FROM vicidial_list where lead_id='$lead_id' LIMIT 1;";
+ $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='$lead_id' LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00290',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -6036,6 +6043,7 @@ if ($ACTION == 'updateDISPO')
$called_count = urlencode(trim($row[30]));
$rank = urlencode(trim($row[32]));
$owner = urlencode(trim($row[33]));
+ $entry_list_id = urlencode(trim($row[34]));
}
$dispo_call_url = preg_replace('/^VAR/','',$dispo_call_url);
@@ -7254,7 +7262,7 @@ if ($ACTION == 'LEADINFOview')
echo "
\n";
echo "
";
- $stmt="select status,vendor_lead_code,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner from vicidial_list where lead_id='$lead_id'limit 1;";
+ $stmt="select status,vendor_lead_code,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id from vicidial_list where lead_id='$lead_id'limit 1;";
$rslt=mysql_query($stmt, $link);
$info_to_print = mysql_num_rows($rslt);
if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";}
@@ -7290,6 +7298,7 @@ if ($ACTION == 'LEADINFOview')
echo "
Last Local Call Time:
$row[25]
";
# echo "
Rank:
$row[26]
";
# echo "
Owner:
$row[27]
";
+ # echo "
Entry List ID:
$row[28]
";
}
echo "
";
diff --git a/agc_2-X/trunk/www/agc/vdc_form_display.php b/agc_2-X/trunk/www/agc/vdc_form_display.php
index 7479647e..f3c81228 100644
--- a/agc_2-X/trunk/www/agc/vdc_form_display.php
+++ b/agc_2-X/trunk/www/agc/vdc_form_display.php
@@ -10,10 +10,11 @@
# CHANGELOG:
# 100630-1119 - First build of script
# 100703-1124 - Added submit_button,admin_submit fields, which will log to admin log
+# 100712-2322 - Added code to log vicidial_list.entry_list_id field if data altered
#
-$version = '2.4-2';
-$build = '100703-1124';
+$version = '2.4-3';
+$build = '100712-2322';
require("dbconnect.php");
require("functions.php");
@@ -233,19 +234,7 @@ if ($stage=='SUBMIT')
$o++;
}
- if (strlen($VL_update_SQL)>3)
- {
- $VL_update_SQL = preg_replace("/,$/","",$VL_update_SQL);
- $list_table_update_SQL = "UPDATE vicidial_list SET $VL_update_SQL where lead_id='$lead_id';";
-
- $rslt=mysql_query($list_table_update_SQL, $link);
- $list_update_count = mysql_affected_rows($link);
- if ($DB) {echo "$field_update|$list_table_update_SQL\n";}
- if (!$rslt) {die('Could not execute: ' . mysql_error());}
-
- $update_sent++;
- }
-
+ $custom_update_count=0;
if (strlen($update_SQL)>3)
{
$custom_record_lead_count=0;
@@ -266,12 +255,39 @@ if ($stage=='SUBMIT')
$rslt=mysql_query($custom_table_update_SQL, $link);
$custom_update_count = mysql_affected_rows($link);
- if ($DB) {echo "$field_update|$custom_table_update_SQL\n";}
+ if ($DB) {echo "$custom_update_count|$custom_table_update_SQL\n";}
if (!$rslt) {die('Could not execute: ' . mysql_error());}
$update_sent++;
}
+ if (strlen($VL_update_SQL)>3)
+ {
+ $custom_update_vl_SQL='';
+ if ($custom_update_count > 0)
+ {$custom_update_vl_SQL = "entry_list_id='$list_id',";}
+ $VL_update_SQL = preg_replace("/,$/","",$VL_update_SQL);
+ $list_table_update_SQL = "UPDATE vicidial_list SET $custom_update_vl_SQL $VL_update_SQL where lead_id='$lead_id';";
+
+ $rslt=mysql_query($list_table_update_SQL, $link);
+ $list_update_count = mysql_affected_rows($link);
+ if ($DB) {echo "$list_update_count|$list_table_update_SQL\n";}
+ if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+ $update_sent++;
+ }
+ else
+ {
+ if ($custom_update_count > 0)
+ {
+ $list_table_update_SQL = "UPDATE vicidial_list SET entry_list_id='$list_id' where lead_id='$lead_id';";
+ $rslt=mysql_query($list_table_update_SQL, $link);
+ $list_update_count = mysql_affected_rows($link);
+ if ($DB) {echo "$list_update_count|$list_table_update_SQL\n";}
+ if (!$rslt) {die('Could not execute: ' . mysql_error());}
+ }
+ }
+
if ( ($admin_submit=='YES') and ($update_sent > 0) )
{
### LOG INSERTION Admin Log Table ###
diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php
index 1c0c6d41..cf2969f0 100644
--- a/agc_2-X/trunk/www/agc/vicidial.php
+++ b/agc_2-X/trunk/www/agc/vicidial.php
@@ -300,10 +300,11 @@
# 100625-1118 - Added poor-network-connection-mitigating code
# 100629-1158 - Added initial code for custom list fields
# 100702-1315 - Custom List Fields functionality enabled
+# 100712-1441 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
#
-$version = '2.4-278';
-$build = '100702-1315';
+$version = '2.4-279';
+$build = '100712-1441';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=66;
$one_mysql_log=0;
@@ -5739,6 +5740,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
CalL_XC_c_NuMber = MDnextResponse_array[41];
CalL_XC_d_NuMber = MDnextResponse_array[42];
CalL_XC_e_NuMber = MDnextResponse_array[43];
+ document.vicidial_form.entry_list_id.value = MDnextResponse_array[44];
timer_action = campaign_timer_action;
timer_action_message = campaign_timer_action_message;
@@ -6198,6 +6200,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
document.vicidial_form.lead_id.value ='';
document.vicidial_form.vendor_lead_code.value='';
document.vicidial_form.list_id.value ='';
+ document.vicidial_form.entry_list_id.value ='';
document.vicidial_form.gmt_offset_now.value ='';
document.vicidial_form.phone_code.value ='';
if ( (disable_alter_custphone=='Y') || (disable_alter_custphone=='HIDE') )
@@ -6967,6 +6970,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
document.vicidial_form.rank.value = check_VDIC_array[44];
document.vicidial_form.owner.value = check_VDIC_array[45];
script_recording_delay = check_VDIC_array[46];
+ document.vicidial_form.entry_list_id.value = check_VDIC_array[47];
var gIndex = 0;
if (document.vicidial_form.gender.value == 'M') {var gIndex = 1;}
@@ -8482,6 +8486,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
document.vicidial_form.lead_id.value ='';
document.vicidial_form.vendor_lead_code.value='';
document.vicidial_form.list_id.value ='';
+ document.vicidial_form.entry_list_id.value ='';
document.vicidial_form.gmt_offset_now.value ='';
document.vicidial_form.phone_code.value ='';
if ( (disable_alter_custphone=='Y') || (disable_alter_custphone=='HIDE') )
@@ -10179,7 +10184,13 @@ function phone_number_format(formatphone) {
// Refresh the FORM content
function FormContentsLoad()
{
- document.getElementById('vcFormIFrame').src='./vdc_form_display.php?lead_id=' + document.vicidial_form.lead_id.value + '&list_id=' + document.vicidial_form.list_id.value + '&user=' + user + '&pass=' + pass + '&campaign=' + campaign + '&server_ip=' + server_ip + '&session_id=' + '&uniqueid=' + document.vicidial_form.uniqueid.value + '&stage=DISPLAY';
+ var form_list_id = document.vicidial_form.list_id.value;
+ var form_entry_list_id = document.vicidial_form.entry_list_id.value;
+ if (form_entry_list_id.length > 2)
+ {form_list_id = form_entry_list_id}
+ document.getElementById('vcFormIFrame').src='./vdc_form_display.php?lead_id=' + document.vicidial_form.lead_id.value + '&list_id=' + form_list_id + '&user=' + user + '&pass=' + pass + '&campaign=' + campaign + '&server_ip=' + server_ip + '&session_id=' + '&uniqueid=' + document.vicidial_form.uniqueid.value + '&stage=DISPLAY';
+ form_list_id = '';
+ form_entry_list_id = '';
}
// ################################################################################
@@ -11451,6 +11462,7 @@ $zi=1;