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 ""; # echo ""; # echo ""; + # echo ""; } echo "
Last Local Call Time:   $row[25]
Rank:   $row[26]
Owner:   $row[27]
Entry List ID:   $row[28]
"; 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; align=left valign=top> + diff --git a/agc_2-X/trunk/www/vicidial/AST_CLOSER_service_level.php b/agc_2-X/trunk/www/vicidial/AST_CLOSER_service_level.php index 4626cef0..e327ebeb 100644 --- a/agc_2-X/trunk/www/vicidial/AST_CLOSER_service_level.php +++ b/agc_2-X/trunk/www/vicidial/AST_CLOSER_service_level.php @@ -14,6 +14,7 @@ # 90801-0923 - Added in-group name to pulldown # 100214-1421 - Sort menu alphabetically # 100216-0042 - Added popup date selector +# 100712-1324 - Added system setting slave server option # require("dbconnect.php"); @@ -39,9 +40,12 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); if (strlen($shift)<2) {$shift='ALL';} +$report_name = 'Inbound Service Level Report'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -49,10 +53,22 @@ if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';"; if ($DB) {echo "|$stmt|\n";} if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} @@ -106,7 +122,7 @@ echo "\n"; echo "\n"; echo "\n"; -echo "Inbound Service Level Report\n"; +echo "$report_name\n"; $short_header=1; @@ -979,7 +995,7 @@ echo "+-------------+-------+-----------------------------------------+ +------+ $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); -echo "\nRun Time: $RUNtime seconds\n"; +echo "\nRun Time: $RUNtime seconds|$db_source\n"; } diff --git a/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php b/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php index a4650fc2..7fbf34d3 100644 --- a/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php +++ b/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php @@ -27,6 +27,7 @@ # 100206-1454 - Fixed TMR(service level) calculation # 100214-1421 - Sort menu alphabetically # 100216-0042 - Added popup date selector +# 100709-1809 - Added system setting slave server option # require("dbconnect.php"); @@ -56,9 +57,12 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); $MT[0]='0'; if (strlen($shift)<2) {$shift='ALL';} +$report_name = 'Inbound Report'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -66,10 +70,23 @@ if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + + $stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} @@ -175,7 +192,7 @@ echo "\n"; echo "\n"; echo "\n"; -echo "Inbound Stats\n"; +echo "$report_name\n"; $short_header=1; @@ -1524,7 +1541,7 @@ echo "+------+------------------------------------------------------------------ $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); -echo "\nRun Time: $RUNtime seconds\n"; +echo "\nRun Time: $RUNtime seconds|$db_source\n"; } diff --git a/agc_2-X/trunk/www/vicidial/AST_CLOSERsummary_hourly.php b/agc_2-X/trunk/www/vicidial/AST_CLOSERsummary_hourly.php index 2c5f60dc..cc8a00a0 100644 --- a/agc_2-X/trunk/www/vicidial/AST_CLOSERsummary_hourly.php +++ b/agc_2-X/trunk/www/vicidial/AST_CLOSERsummary_hourly.php @@ -9,6 +9,7 @@ # 90809-0216 - Added Exclude Outbound Drop Group option # 100214-1421 - Sort menu alphabetically # 100216-0042 - Added popup date selector +# 100712-1324 - Added system setting slave server option # require("dbconnect.php"); @@ -52,9 +53,12 @@ $MT[0]='0'; if (strlen($shift)<2) {$shift='ALL';} if (strlen($exclude_rollover)<2) {$exclude_rollover='NO';} +$report_name = 'Inbound Summary Hourly Report'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -62,10 +66,22 @@ if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} @@ -187,7 +203,7 @@ echo "\n"; echo "\n"; echo "\n"; -echo "Inbound Summary Hourly Report\n"; +echo "$report_name\n"; if ($bareformat < 1) { @@ -676,7 +692,7 @@ else $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); - echo "\n\nRun Time: $RUNtime seconds\n"; + echo "\n\nRun Time: $RUNtime seconds|$db_source\n"; } diff --git a/agc_2-X/trunk/www/vicidial/AST_DIDstats.php b/agc_2-X/trunk/www/vicidial/AST_DIDstats.php index b111c10a..0a2b1a05 100644 --- a/agc_2-X/trunk/www/vicidial/AST_DIDstats.php +++ b/agc_2-X/trunk/www/vicidial/AST_DIDstats.php @@ -9,6 +9,7 @@ # 100116-0620 - Bug fixes # 100214-1421 - Sort menu alphabetically # 100216-0042 - Added popup date selector +# 100712-1324 - Added system setting slave server option # require("dbconnect.php"); @@ -37,20 +38,35 @@ $PHP_AUTH_PW = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_PW); if (strlen($shift)<2) {$shift='ALL';} +$report_name = 'Inbound DID Report'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); - $non_latin = $row[0]; + $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';"; if ($DB) {echo "|$stmt|\n";} if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} @@ -127,7 +143,7 @@ echo "\n"; echo "\n"; echo "\n"; -echo "Inbound DIDs Report\n"; +echo "$report_name\n"; $short_header=1; @@ -829,7 +845,7 @@ else $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); - echo "\nRun Time: $RUNtime seconds\n"; + echo "\nRun Time: $RUNtime seconds|$db_source\n"; } diff --git a/agc_2-X/trunk/www/vicidial/AST_IVRstats.php b/agc_2-X/trunk/www/vicidial/AST_IVRstats.php index 855d7f04..5e8cb448 100644 --- a/agc_2-X/trunk/www/vicidial/AST_IVRstats.php +++ b/agc_2-X/trunk/www/vicidial/AST_IVRstats.php @@ -13,6 +13,7 @@ # 91112-0719 - Added in-group names to select list # 100214-1421 - Sort menu alphabetically # 100301-1401 - Added popup date selector +# 100712-1324 - Added system setting slave server option # require("dbconnect.php"); @@ -40,9 +41,12 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); if (strlen($shift)<2) {$shift='ALL';} +$report_name = 'Inbound IVR Report'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -50,10 +54,22 @@ if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';"; if ($DB) {echo "|$stmt|\n";} if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} @@ -198,7 +214,7 @@ $end_date_T = $end_dateARRAY[1]; \n"; -echo "IVR Stats Report\n"; +echo "$report_name\n"; $short_header=1; @@ -721,7 +737,7 @@ else $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); - echo "\nRun Time: $RUNtime seconds\n"; + echo "\nRun Time: $RUNtime seconds|$db_source\n"; } diff --git a/agc_2-X/trunk/www/vicidial/AST_LIST_UPDATEstats.php b/agc_2-X/trunk/www/vicidial/AST_LIST_UPDATEstats.php index 8fd08268..3427050b 100644 --- a/agc_2-X/trunk/www/vicidial/AST_LIST_UPDATEstats.php +++ b/agc_2-X/trunk/www/vicidial/AST_LIST_UPDATEstats.php @@ -1,12 +1,13 @@ LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # # CHANGES # # 90627-2055 - First build # 90907-0636 - Added list id to results +# 100712-1324 - Added system setting slave server option # require("dbconnect.php"); @@ -31,22 +32,35 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); if (strlen($shift)<2) {$shift='ALL';} +$report_name = 'List Update Stats'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); -$i=0; -while ($i < $qm_conf_ct) +if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; - $i++; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';"; if ($DB) {echo "|$stmt|\n";} if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} @@ -85,7 +99,7 @@ if (!isset($end_date)) {$end_date = "$NOW_DATE 23:59:59";} \n"; -echo "List Update Process Report\n"; +echo "$report_name\n"; $short_header=1; @@ -188,7 +202,7 @@ while ($i < $records_to_grab) $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); -echo "
\nRun Time: $RUNtime seconds\n"; +echo "
\nRun Time: $RUNtime seconds|$db_source\n"; } diff --git a/agc_2-X/trunk/www/vicidial/AST_OUTBOUNDsummary_interval.php b/agc_2-X/trunk/www/vicidial/AST_OUTBOUNDsummary_interval.php index 69c465c1..d133c667 100644 --- a/agc_2-X/trunk/www/vicidial/AST_OUTBOUNDsummary_interval.php +++ b/agc_2-X/trunk/www/vicidial/AST_OUTBOUNDsummary_interval.php @@ -9,6 +9,7 @@ # 091129-0017 - Added Sales-type and DNC-type tallies # 100214-1421 - Sort menu alphabetically # 100216-0042 - Added popup date selector +# 100712-1324 - Added system setting slave server option # require("dbconnect.php"); @@ -50,9 +51,12 @@ $MT[0]='0'; if (strlen($shift)<2) {$shift='ALL';} if (strlen($include_rollover)<2) {$include_rollover='NO';} +$report_name = 'Outbound Summary Interval Report'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -60,10 +64,22 @@ if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} @@ -336,7 +352,7 @@ echo "\n"; echo "\n"; echo "\n"; -echo "Outbound Summary Interval Report\n"; +echo "$report_name\n"; if ($bareformat < 1) { @@ -1268,7 +1284,7 @@ else $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); - echo "\n\nRun Time: $RUNtime seconds\n"; + echo "\n\nRun Time: $RUNtime seconds|$db_source\n"; } diff --git a/agc_2-X/trunk/www/vicidial/AST_VDADstats.php b/agc_2-X/trunk/www/vicidial/AST_VDADstats.php index 5f8c5519..6997dc1a 100644 --- a/agc_2-X/trunk/www/vicidial/AST_VDADstats.php +++ b/agc_2-X/trunk/www/vicidial/AST_VDADstats.php @@ -26,6 +26,7 @@ # 100202-1034 - Added statuses to no-answer section # 100214-1421 - Sort menu alphabetically # 100216-0042 - Added popup date selector +# 100712-1324 - Added system setting slave server option # header ("Content-type: text/html; charset=utf-8"); @@ -73,10 +74,12 @@ if (strlen($bottom_graph)<2) {$bottom_graph='NO';} if (strlen($carrier_stats)<2) {$carrier_stats='NO';} if (strlen($include_rollover)<2) {$include_rollover='NO';} +$report_name = 'Outbound Calling Report'; +$db_source = 'M'; ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -84,10 +87,22 @@ if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + ##### SERVER CARRIER LOGGING LOOKUP ##### $stmt = "SELECT count(*) FROM servers where carrier_logging_active='Y' and max_vicidial_trunks > 0;"; $rslt=mysql_query($stmt, $link); @@ -252,7 +267,7 @@ echo "\n"; echo "\n"; echo "\n"; -echo "Outbound Stats\n"; +echo "$report_name\n"; $short_header=1; @@ -1446,7 +1461,7 @@ else $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); - echo "\nRun Time: $RUNtime seconds\n"; + echo "\nRun Time: $RUNtime seconds|$db_source\n"; } diff --git a/agc_2-X/trunk/www/vicidial/AST_agent_days_detail.php b/agc_2-X/trunk/www/vicidial/AST_agent_days_detail.php index 875b2759..5c33589f 100644 --- a/agc_2-X/trunk/www/vicidial/AST_agent_days_detail.php +++ b/agc_2-X/trunk/www/vicidial/AST_agent_days_detail.php @@ -11,6 +11,7 @@ # 90508-0644 - Changed to PHP long tags # 100214-1421 - Sort menu alphabetically # 100216-0042 - Added popup date selector +# 100712-1324 - Added system setting slave server option # @@ -42,9 +43,12 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} if (strlen($shift)<2) {$shift='ALL';} +$report_name = 'Single Agent Daily'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -52,10 +56,22 @@ if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -164,7 +180,7 @@ if ($file_download < 1) echo "\n"; echo "\n"; - echo "Agent Days Status Report\n"; + echo "Single Agent Daily\n"; echo ""; $short_header=1; @@ -596,7 +612,7 @@ else echo "REPORTS \n"; echo ""; -echo "\n\n"; +echo "\n\n
$db_source"; echo "
\n"; echo "\n"; diff --git a/agc_2-X/trunk/www/vicidial/AST_agent_performance_detail.php b/agc_2-X/trunk/www/vicidial/AST_agent_performance_detail.php index c74699d6..0e797b98 100644 --- a/agc_2-X/trunk/www/vicidial/AST_agent_performance_detail.php +++ b/agc_2-X/trunk/www/vicidial/AST_agent_performance_detail.php @@ -23,6 +23,7 @@ # 100203-1131 - Added CUSTOMER time statistics # 100214-1421 - Sort menu alphabetically # 100216-0042 - Added popup date selector +# 100712-1324 - Added system setting slave server option # require("dbconnect.php"); @@ -55,9 +56,12 @@ if (strlen($shift)<2) {$shift='ALL';} $LINKbase = "$PHP_SELF?query_date=$query_date&end_date=$end_date&group=$group&user_group=$user_group&shift=$shift&DB=$DB"; +$report_name = 'Agent Performance Detail'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -65,10 +69,22 @@ if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -174,7 +190,7 @@ echo "\n"; echo "\n"; echo "\n"; -echo "Agent Performance Detail\n"; +echo "$report_name\n"; $short_header=1; @@ -863,7 +879,7 @@ echo "+-----------------+----------+----------+----------+----------+ +$sub_sta echo "| TOTALS AGENTS:$TOT_AGENTS |$TOTtotTOTAL_MS|$TOTtotNONPAUSE_MS|$TOTtotPAUSE_MS| |$SUMstatusesHTML\n"; echo "+----------------------------+----------+----------+----------+ +$sub_statusesHEAD\n"; -echo "\n\n"; +echo "\n\n
$db_source"; } diff --git a/agc_2-X/trunk/www/vicidial/AST_agent_status_detail.php b/agc_2-X/trunk/www/vicidial/AST_agent_status_detail.php index 48f67b5b..3ca13b34 100644 --- a/agc_2-X/trunk/www/vicidial/AST_agent_status_detail.php +++ b/agc_2-X/trunk/www/vicidial/AST_agent_status_detail.php @@ -12,6 +12,7 @@ # 100119-0935 - Fixed bug 291 # 100214-1421 - Sort menu alphabetically # 100216-0042 - Added popup date selector +# 100712-1324 - Added system setting slave server option # @@ -43,9 +44,12 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} if (strlen($shift)<2) {$shift='ALL';} +$report_name = 'Agent Status Detail'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -53,10 +57,22 @@ if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -210,7 +226,7 @@ if ($file_download < 1) echo "\n"; echo "\n"; - echo "Agent Status Detail Report\n"; + echo "$report_name\n"; echo ""; $short_header=1; @@ -663,7 +679,7 @@ echo " REPORTS \n"; echo "\n"; echo ""; -echo "\n\n"; +echo "\n\n
$db_source"; echo "
\n"; echo "\n"; diff --git a/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php b/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php index bc97301f..f7cee69a 100644 --- a/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php +++ b/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php @@ -12,6 +12,7 @@ # 100203-1147 - Added CUSTOMER time statistics # 100214-1421 - Sort menu alphabetically # 100216-0042 - Added popup date selector +# 100712-1324 - Added system setting slave server option # require("dbconnect.php"); @@ -44,9 +45,12 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} if (strlen($shift)<2) {$shift='ALL';} if (strlen($stage)<2) {$stage='NAME';} +$report_name = 'Agent Time Detail'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -54,10 +58,22 @@ if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -183,7 +199,7 @@ if ($file_download < 1) echo "\n"; echo "\n"; - echo "Agent Time Detail\n"; + echo "$report_name\n"; echo ""; $short_header=1; @@ -861,7 +877,7 @@ echo " REPORTS \n"; echo "\n"; echo ""; -echo "\n\n"; +echo "\n\n
$db_source"; ############################################################################ ##### END HTML form section ############################################################################ diff --git a/agc_2-X/trunk/www/vicidial/AST_agent_time_sheet.php b/agc_2-X/trunk/www/vicidial/AST_agent_time_sheet.php index 1321df46..d2e012ae 100644 --- a/agc_2-X/trunk/www/vicidial/AST_agent_time_sheet.php +++ b/agc_2-X/trunk/www/vicidial/AST_agent_time_sheet.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -11,27 +11,42 @@ # 90310-0745 - Added admin header # 90508-0644 - Changed to PHP long tags # 90524-2231 - Changed to use functions.php for seconds to HH:MM:SS conversion +# 100712-1324 - Added system setting slave server option # require("dbconnect.php"); require("functions.php"); +$report_name = 'User Time Sheet'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,outbound_autodial_active,user_territories_active FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,user_territories_active FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} -$ss_conf_ct = mysql_num_rows($rslt); -if ($ss_conf_ct > 0) +$qm_conf_ct = mysql_num_rows($rslt); +if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); - $non_latin = $row[0]; - $SSoutbound_autodial_active = $row[1]; - $user_territories_active = $row[2]; + $non_latin = $row[0]; + $SSoutbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; + $user_territories_active = $row[4]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['PHP_SELF']; @@ -86,7 +101,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} \n"; -echo "Agent Time Sheet"; +echo "<TITLE>$report_name"; ##### BEGIN Set variables to make header show properly ##### @@ -298,7 +313,7 @@ echo "<td align=right><font size=2> </td>\n"; echo "<td align=right colspan=2><font size=2><font size=2>TOTAL </td>\n"; echo "<td align=right><font size=2> $total_login_hours_minutes </td></tr>\n"; -echo "</TABLE>\n"; +echo "</TABLE><BR>$db_source\n"; diff --git a/agc_2-X/trunk/www/vicidial/AST_agent_timeclock_detail.php b/agc_2-X/trunk/www/vicidial/AST_agent_timeclock_detail.php index e3d7b036..a7604f79 100644 --- a/agc_2-X/trunk/www/vicidial/AST_agent_timeclock_detail.php +++ b/agc_2-X/trunk/www/vicidial/AST_agent_timeclock_detail.php @@ -8,6 +8,7 @@ # CHANGES # 90602-2244 - First build # 100301-1401 - Added popup date selector +# 100712-1324 - Added system setting slave server option and added user stats link dates # @@ -41,9 +42,12 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} if (strlen($shift)<2) {$shift='ALL';} if (strlen($stage)<2) {$stage='ID';} +$report_name = 'User Timeclock Detail Report'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -51,10 +55,22 @@ if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "<!-- Using slave server $slave_db_server $db_source -->\n"; + } + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -189,7 +205,7 @@ if ($file_download < 1) <?php echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n"; - echo "<TITLE>User Time-Clock Detail\n"; + echo "$report_name\n"; echo ""; $short_header=1; @@ -429,7 +445,7 @@ else if ($file_download < 1) { - $Toutput = "| $Sname[$m] | $Suser[$m] | $Sgroup[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $TCdetail\n"; + $Toutput = "| $Sname[$m] | $Suser[$m] | $Sgroup[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $TCdetail\n"; } else { @@ -685,7 +701,7 @@ echo "\n\n"; $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); -echo "$RUNtime\n"; +echo "$RUNtime|$db_source\n"; ?> diff --git a/agc_2-X/trunk/www/vicidial/AST_server_performance.php b/agc_2-X/trunk/www/vicidial/AST_server_performance.php index 3688ca34..2a66591a 100644 --- a/agc_2-X/trunk/www/vicidial/AST_server_performance.php +++ b/agc_2-X/trunk/www/vicidial/AST_server_performance.php @@ -13,6 +13,7 @@ # 90310-2151 - Added admin header # 90508-0644 - Changed to PHP long tags # 100214-1421 - Sort menu alphabetically +# 100712-1324 - Added system setting slave server option # require("dbconnect.php"); @@ -36,6 +37,35 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$report_name = 'Server Perforrmance Report'; +$db_source = 'M'; + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; + } +##### END SETTINGS LOOKUP ##### +########################################### + +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_servers='1';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); @@ -88,7 +118,7 @@ while ($i < $servers_to_print) \n"; -echo "Server Performance Report\n"; +echo "$report_name\n"; $short_header=1; @@ -343,5 +373,6 @@ echo ""; ?> - +
+ \ No newline at end of file diff --git a/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php b/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php index 54867980..5d5b1ca7 100644 --- a/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php +++ b/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php @@ -62,10 +62,11 @@ # 100301-1229 - Added 3-WAY status for consultative transfer agents # 100303-0930 - Added carrier stats display option # 100424-0943 - Added realtime_block_user_info option +# 100709-1054 - Added system setting slave server option # -$version = '2.2.0-53'; -$build = '100424-0943'; +$version = '2.4-54'; +$build = '100709-1054'; header ("Content-type: text/html; charset=utf-8"); @@ -128,10 +129,12 @@ if (isset($_GET["monitor_phone"])) {$monitor_phone=$_GET["monitor_phone"];} if (isset($_GET["CARRIERstats"])) {$CARRIERstats=$_GET["CARRIERstats"];} elseif (isset($_POST["CARRIERstats"])) {$CARRIERstats=$_POST["CARRIERstats"];} +$report_name = 'Real-Time Main Report'; +$db_source = 'M'; ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,outbound_autodial_active FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -140,10 +143,21 @@ if ($qm_conf_ct > 0) $row=mysql_fetch_row($rslt); $non_latin = $row[0]; $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + if (!isset($DB)) {$DB=0;} if (!isset($RR)) {$RR=40;} if (!isset($group)) {$group='';} @@ -748,7 +762,7 @@ $rslt=mysql_query($stmt, $link); echo "\n"; echo"\n"; -echo "Real-Time Report: $group\n"; +echo "$report_name: $group\n"; $short_header=1; @@ -2321,7 +2335,7 @@ $calls_to_list = mysql_num_rows($rslt); $Aecho .= "$Aline"; $Aecho .= " $agentcount agents logged in on all servers\n"; - $Aecho .= " System Load Average: $load_ave\n\n"; + $Aecho .= " System Load Average: $load_ave   $db_source\n\n"; # $Aecho .= " - Balanced call\n"; $Aecho .= " - Agent waiting for call\n"; diff --git a/agc_2-X/trunk/www/vicidial/AST_timeonVDADallSUMMARY.php b/agc_2-X/trunk/www/vicidial/AST_timeonVDADallSUMMARY.php index 81d1ea1e..7e578aa7 100644 --- a/agc_2-X/trunk/www/vicidial/AST_timeonVDADallSUMMARY.php +++ b/agc_2-X/trunk/www/vicidial/AST_timeonVDADallSUMMARY.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # # Summary for all campaigns live real-time stats for the VICIDIAL Auto-Dialer all servers # @@ -16,8 +16,10 @@ # 80525-1040 - Added IVR status summary display for inbound calls # 90310-2119 - Added admin header # 90508-0644 - Changed to PHP long tags +# 100709-1806 - Added system setting slave server option # + header ("Content-type: text/html; charset=utf-8"); require("dbconnect.php"); @@ -38,6 +40,35 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} if (!isset($RR)) {$gRRroup=4;} +$report_name = 'Real-Time Campaign Summary'; +$db_source = 'M'; + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; + } +##### END SETTINGS LOOKUP ##### +########################################### + +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -107,7 +138,7 @@ if (!isset($RR)) {$RR=4;} \n"; -echo "Real-Time All Campaigns Summary\n"; +echo "$report_name\n"; $short_header=1; @@ -446,7 +477,7 @@ echo ""; echo ""; echo ""; -echo "\n\n"; +echo "\n\n
$db_source"; $k++; } diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 0ecd256a..5f6ca626 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -1329,6 +1329,10 @@ if (isset($_GET["label_comments"])) {$label_comments=$_GET["label_comments"] elseif (isset($_POST["label_comments"])) {$label_comments=$_POST["label_comments"];} if (isset($_GET["custom_fields_enabled"])) {$custom_fields_enabled=$_GET["custom_fields_enabled"];} elseif (isset($_POST["custom_fields_enabled"])) {$custom_fields_enabled=$_POST["custom_fields_enabled"];} +if (isset($_GET["slave_db_server"])) {$slave_db_server=$_GET["slave_db_server"];} + elseif (isset($_POST["slave_db_server"])) {$slave_db_server=$_POST["slave_db_server"];} +if (isset($_GET["reports_use_slave_db"])) {$reports_use_slave_db=$_GET["reports_use_slave_db"];} + elseif (isset($_POST["reports_use_slave_db"])) {$reports_use_slave_db=$_POST["reports_use_slave_db"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} @@ -1953,7 +1957,7 @@ if ($non_latin < 1) $label_security_phrase = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_security_phrase); $label_email = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_email); $label_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_comments); - + $slave_db_server = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$slave_db_server); ### ALPHA-NUMERIC and underscore and dash and slash and at and dot $call_out_number_group = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$call_out_number_group); @@ -2322,11 +2326,12 @@ else # 100622-1700 - Added custom agent field names for default fields # 100702-1142 - Added FORM get_call_launch option for custom list fields tab in agent interface # 100703-1322 - Added LEADS ability to admin log display +# 100709-1025 - Added option for slave DB server to be used for selected reports # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.4-261'; -$build = '100703-1322'; +$admin_version = '2.4-262'; +$build = '100709-1025'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -6464,6 +6469,16 @@ if ($ADD==99999)
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. +
+ +
+ 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. +

@@ -14227,7 +14242,17 @@ if ($ADD==411111111111111) echo "
VICIDIAL SYSTEM SETTINGS MODIFIED\n"; - $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',enable_tts_integration='$enable_tts_integration',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory',active_voicemail_server='$active_voicemail_server',auto_dial_limit='$auto_dial_limit',user_territories_active='$user_territories_active',allow_custom_dialplan='$allow_custom_dialplan',enable_second_webform='$enable_second_webform',default_webphone='$default_webphone',default_external_server_ip='$default_external_server_ip',webphone_url='$webphone_url',enable_agc_dispo_log='$enable_agc_dispo_log',custom_dialplan_entry='$custom_dialplan_entry',queuemetrics_loginout='$queuemetrics_loginout',callcard_enabled='$callcard_enabled',queuemetrics_callstatus='$queuemetrics_callstatus',default_codecs='$default_codecs',admin_web_directory='$admin_web_directory',label_title='$label_title',label_first_name='$label_first_name',label_middle_initial='$label_middle_initial',label_last_name='$label_last_name',label_address1='$label_address1',label_address2='$label_address2',label_address3='$label_address3',label_city='$label_city',label_state='$label_state',label_province='$label_province',label_postal_code='$label_postal_code',label_vendor_lead_code='$label_vendor_lead_code',label_gender='$label_gender',label_phone_number='$label_phone_number',label_phone_code='$label_phone_code',label_alt_phone='$label_alt_phone',label_security_phrase='$label_security_phrase',label_email='$label_email',label_comments='$label_comments',custom_fields_enabled='$custom_fields_enabled';"; + $k=0; + $multi_count = count($reports_use_slave_db); + $multi_array = $reports_use_slave_db; + while ($k < $multi_count) + { + $new_field_value .= "$multi_array[$k],"; + $k++; + } + $reports_use_slave_db = preg_replace("/,$/","",$new_field_value); + + $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',enable_tts_integration='$enable_tts_integration',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory',active_voicemail_server='$active_voicemail_server',auto_dial_limit='$auto_dial_limit',user_territories_active='$user_territories_active',allow_custom_dialplan='$allow_custom_dialplan',enable_second_webform='$enable_second_webform',default_webphone='$default_webphone',default_external_server_ip='$default_external_server_ip',webphone_url='$webphone_url',enable_agc_dispo_log='$enable_agc_dispo_log',custom_dialplan_entry='$custom_dialplan_entry',queuemetrics_loginout='$queuemetrics_loginout',callcard_enabled='$callcard_enabled',queuemetrics_callstatus='$queuemetrics_callstatus',default_codecs='$default_codecs',admin_web_directory='$admin_web_directory',label_title='$label_title',label_first_name='$label_first_name',label_middle_initial='$label_middle_initial',label_last_name='$label_last_name',label_address1='$label_address1',label_address2='$label_address2',label_address3='$label_address3',label_city='$label_city',label_state='$label_state',label_province='$label_province',label_postal_code='$label_postal_code',label_vendor_lead_code='$label_vendor_lead_code',label_gender='$label_gender',label_phone_number='$label_phone_number',label_phone_code='$label_phone_code',label_alt_phone='$label_alt_phone',label_security_phrase='$label_security_phrase',label_email='$label_email',label_comments='$label_comments',custom_fields_enabled='$custom_fields_enabled',slave_db_server='$slave_db_server',reports_use_slave_db='$reports_use_slave_db';"; $rslt=mysql_query($stmt, $link); ### LOG INSERTION Admin Log Table ### @@ -23485,7 +23510,7 @@ if ($ADD==311111111111111) echo "\n"; + echo "\n"; + + echo "\n"; + if ($SSallow_custom_dialplan > 0) { echo "\n"; diff --git a/agc_2-X/trunk/www/vicidial/admin_listloader_third_gen.php b/agc_2-X/trunk/www/vicidial/admin_listloader_third_gen.php index 1d505cf2..bd100291 100644 --- a/agc_2-X/trunk/www/vicidial/admin_listloader_third_gen.php +++ b/agc_2-X/trunk/www/vicidial/admin_listloader_third_gen.php @@ -38,9 +38,11 @@ # delimited files) and use a perl script to convert others to TXT # 100707-1040 - Converted List Id Override and Phone Code Override to drop downs # 100707-1156 - Made it so you cannot submit with no lead file selected. Also fixed Start Over Link +# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any +# -$version = '2.4-37'; -$build = '100706-1250'; +$version = '2.4-38'; +$build = '100712-1416'; require("dbconnect.php"); @@ -141,7 +143,7 @@ if ( $phone_code_override == "in_file" ) { $phone_code_override = ""; } ### REGEX to prevent weird characters from ending up in the fields $field_regx = "['\"`\\;]"; -$vicidial_list_fields = '|lead_id|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|'; +$vicidial_list_fields = '|lead_id|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|'; ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### @@ -825,7 +827,7 @@ if ($OK_to_process) if (strlen($custom_SQL)>3) { - $stmtZ = "INSERT INTO vicidial_list (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) values('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner');"; + $stmtZ = "INSERT INTO vicidial_list (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) values('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','$list_id');"; $rslt=mysql_query($stmtZ, $link); $affected_rows = mysql_affected_rows($link); $lead_id = mysql_insert_id($link); @@ -844,7 +846,7 @@ if ($OK_to_process) if ($multi_insert_counter > 8) { ### insert good record into vicidial_list table ### - $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner');"; + $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','0');"; $rslt=mysql_query($stmtZ, $link); if ($WeBRooTWritablE > 0) {fwrite($stmt_file, $stmtZ."\r\n");} @@ -853,7 +855,7 @@ if ($OK_to_process) } else { - $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner'),"; + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','0'),"; $multi_insert_counter++; } } @@ -885,7 +887,7 @@ if ($OK_to_process) } if ($multi_insert_counter!=0) { - $stmtZ = "INSERT INTO vicidial_list (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) values".substr($multistmt, 0, -1).";"; + $stmtZ = "INSERT INTO vicidial_list (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) values".substr($multistmt, 0, -1).";"; mysql_query($stmtZ, $link); if ($WeBRooTWritablE > 0) {fwrite($stmt_file, $stmtZ."\r\n");} @@ -1205,7 +1207,7 @@ if (($leadfile) && ($LF_path)) if ($multi_insert_counter > 8) { ### insert good deal into pending_transactions table ### - $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner');"; + $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','0');"; $rslt=mysql_query($stmtZ, $link); if ($WeBRooTWritablE > 0) {fwrite($stmt_file, $stmtZ."\r\n");} @@ -1214,7 +1216,7 @@ if (($leadfile) && ($LF_path)) } else { - $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner'),"; + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','0'),"; $multi_insert_counter++; } $good++; @@ -1245,7 +1247,7 @@ if (($leadfile) && ($LF_path)) } if ($multi_insert_counter!=0) { - $stmtZ = "INSERT INTO vicidial_list (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) values".substr($multistmt, 0, -1).";"; + $stmtZ = "INSERT INTO vicidial_list (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) values".substr($multistmt, 0, -1).";"; mysql_query($stmtZ, $link); if ($WeBRooTWritablE > 0) {fwrite($stmt_file, $stmtZ."\r\n");} diff --git a/agc_2-X/trunk/www/vicidial/admin_lists_custom.php b/agc_2-X/trunk/www/vicidial/admin_lists_custom.php index 9e057311..f81a1ed6 100644 --- a/agc_2-X/trunk/www/vicidial/admin_lists_custom.php +++ b/agc_2-X/trunk/www/vicidial/admin_lists_custom.php @@ -457,11 +457,11 @@ if ( ($action == "COPY_FIELDS_SUBMIT") and ($list_id > 99) and ($source_list_id } $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; - if ($DB>0) {echo "$stmt";} $rslt=mysql_query($stmt, $link); $tablecount_to_print = mysql_num_rows($rslt); if ($tablecount_to_print > 0) {$table_exists = 1;} + if ($DB>0) {echo "$stmt|$tablecount_to_print|$table_exists";} if ($source_field_exists < 1) {echo "ERROR: Source list has no custom fields\n
";} @@ -564,7 +564,7 @@ if ( ($action == "COPY_FIELDS_SUBMIT") and ($list_id > 99) and ($source_list_id { if ($DB > 0) {echo "Starting UPDATE copy\n
";} if ($table_exists < 1) - {echo "ERROR: Table does not exist\n
";} + {echo "ERROR: Table does not exist custom_$list_id\n
";} else { $stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$source_list_id' order by field_rank,field_order,field_label;"; @@ -641,18 +641,18 @@ if ( ($action == "DELETE_CUSTOM_FIELD_CONFIRMATION") and ($list_id > 99) and ($f } $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; - if ($DB>0) {echo "$stmt";} $rslt=mysql_query($stmt, $link); $tablecount_to_print = mysql_num_rows($rslt); if ($tablecount_to_print > 0) {$table_exists = 1;} + if ($DB>0) {echo "$stmt|$tablecount_to_print|$table_exists";} if ($field_exists < 1) {echo "ERROR: Field does not exist\n
";} else { if ($table_exists < 1) - {echo "ERROR: Table does not exist\n
";} + {echo "ERROR: Table does not exist custom_$list_id\n
";} else { echo "

CLICK HERE TO CONFIRM DELETION OF THIS CUSTOM FIELD: $field_label - $field_id - $list_id

"; @@ -686,18 +686,18 @@ if ( ($action == "DELETE_CUSTOM_FIELD") and ($list_id > 99) and ($field_id > 0) } $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; - if ($DB>0) {echo "$stmt";} $rslt=mysql_query($stmt, $link); $tablecount_to_print = mysql_num_rows($rslt); if ($tablecount_to_print > 0) {$table_exists = 1;} + if ($DB>0) {echo "$stmt|$tablecount_to_print|$table_exists";} if ($field_exists < 1) {echo "ERROR: Field does not exist\n
";} else { if ($table_exists < 1) - {echo "ERROR: Table does not exist\n
";} + {echo "ERROR: Table does not exist custom_$list_id\n
";} else { ### delete field function @@ -734,11 +734,11 @@ if ( ($action == "ADD_CUSTOM_FIELD") and ($list_id > 99) ) } $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; - if ($DB>0) {echo "$stmt";} $rslt=mysql_query($stmt, $link); $tablecount_to_print = mysql_num_rows($rslt); if ($tablecount_to_print > 0) {$table_exists = 1;} + if ($DB>0) {echo "$stmt|$tablecount_to_print|$table_exists";} if ($field_exists > 0) {echo "ERROR: Field already exists for this list - $list_id|$field_label\n
";} @@ -777,12 +777,12 @@ if ( ($action == "MODIFY_CUSTOM_FIELD_SUBMIT") and ($list_id > 99) and ($field_i } $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; - if ($DB>0) {echo "$stmt";} $rslt=mysql_query($stmt, $link); $tablecount_to_print = mysql_num_rows($rslt); if ($tablecount_to_print > 0) {$table_exists = 1;} - + if ($DB>0) {echo "$stmt|$tablecount_to_print|$table_exists";} + if ($field_exists < 1) {echo "ERROR: Field does not exist\n
";} else @@ -815,11 +815,11 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) ) $custom_records_count=0; $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; - if ($DB>0) {echo "$stmt";} $rslt=mysql_query($stmt, $link); $tablecount_to_print = mysql_num_rows($rslt); if ($tablecount_to_print > 0) {$table_exists = 1;} + if ($DB>0) {echo "$stmt|$tablecount_to_print|$table_exists";} if ($table_exists > 0) { @@ -1409,6 +1409,14 @@ echo "\n\n\n


\n runtime: $RUNtime seconds     ##### BEGIN add field function function add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$vicidial_list_fields) { + $table_exists=0; + $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; + $rslt=mysql_query($stmt, $link); + $tablecount_to_print = mysql_num_rows($rslt); + if ($tablecount_to_print > 0) + {$table_exists = 1;} + if ($DB>0) {echo "$stmt|$tablecount_to_print|$table_exists";} + if ($table_exists < 1) {$field_sql = "CREATE TABLE custom_$list_id (lead_id INT(9) UNSIGNED PRIMARY KEY NOT NULL, $field_label ";} else @@ -1492,14 +1500,14 @@ function add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field $rsltCUSTOM=mysql_query($stmtCUSTOM, $linkCUSTOM); $table_update = mysql_affected_rows($linkCUSTOM); if ($DB) {echo "$table_update|$stmtCUSTOM\n";} - if (!$rsltCUSTOM) {die('Could not execute: ' . mysql_error());} + if (!$rsltCUSTOM) {echo('Could not execute: ' . mysql_error());} } $stmt="INSERT INTO vicidial_lists_fields set field_label='$field_label',field_name='$field_name',field_description='$field_description',field_rank='$field_rank',field_help='$field_help',field_type='$field_type',field_options='$field_options',field_size='$field_size',field_max='$field_max',field_default='$field_default',field_required='$field_required',field_cost='$field_cost',list_id='$list_id',multi_position='$multi_position',name_position='$name_position',field_order='$field_order';"; $rslt=mysql_query($stmt, $link); $field_update = mysql_affected_rows($link); if ($DB) {echo "$field_update|$stmt\n";} - if (!$rslt) {die('Could not execute: ' . mysql_error());} + if (!$rslt) {echo('Could not execute: ' . mysql_error());} ### LOG INSERTION Admin Log Table ### $SQL_log = "$stmt|$stmtCUSTOM"; @@ -1595,14 +1603,14 @@ function modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$fi $rsltCUSTOM=mysql_query($stmtCUSTOM, $linkCUSTOM); $field_update = mysql_affected_rows($linkCUSTOM); if ($DB) {echo "$field_update|$stmtCUSTOM\n";} - if (!$rsltCUSTOM) {die('Could not execute: ' . mysql_error());} + if (!$rsltCUSTOM) {echo('Could not execute: ' . mysql_error());} } $stmt="UPDATE vicidial_lists_fields set field_label='$field_label',field_name='$field_name',field_description='$field_description',field_rank='$field_rank',field_help='$field_help',field_type='$field_type',field_options='$field_options',field_size='$field_size',field_max='$field_max',field_default='$field_default',field_required='$field_required',field_cost='$field_cost',multi_position='$multi_position',name_position='$name_position',field_order='$field_order' where list_id='$list_id' and field_id='$field_id';"; $rslt=mysql_query($stmt, $link); $field_update = mysql_affected_rows($link); if ($DB) {echo "$field_update|$stmt\n";} - if (!$rslt) {die('Could not execute: ' . mysql_error());} + if (!$rslt) {echo('Could not execute: ' . mysql_error());} ### LOG INSERTION Admin Log Table ### $SQL_log = "$stmt|$stmtCUSTOM"; @@ -1632,14 +1640,14 @@ function delete_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$fi $rsltCUSTOM=mysql_query($stmtCUSTOM, $linkCUSTOM); $table_update = mysql_affected_rows($linkCUSTOM); if ($DB) {echo "$table_update|$stmtCUSTOM\n";} - if (!$rsltCUSTOM) {die('Could not execute: ' . mysql_error());} + if (!$rsltCUSTOM) {echo('Could not execute: ' . mysql_error());} } $stmt="DELETE FROM vicidial_lists_fields WHERE field_label='$field_label' and field_id='$field_id' and list_id='$list_id' LIMIT 1;"; $rslt=mysql_query($stmt, $link); $field_update = mysql_affected_rows($link); if ($DB) {echo "$field_update|$stmt\n";} - if (!$rslt) {die('Could not execute: ' . mysql_error());} + if (!$rslt) {echo('Could not execute: ' . mysql_error());} ### LOG INSERTION Admin Log Table ### $SQL_log = "$stmt|$stmtCUSTOM"; diff --git a/agc_2-X/trunk/www/vicidial/admin_modify_lead.php b/agc_2-X/trunk/www/vicidial/admin_modify_lead.php index 33308e54..b495c00a 100644 --- a/agc_2-X/trunk/www/vicidial/admin_modify_lead.php +++ b/agc_2-X/trunk/www/vicidial/admin_modify_lead.php @@ -37,6 +37,7 @@ # 100618-0148 - Added Middle name modify and fixes statuses list # 100622-0945 - Added field labels # 100703-1122 - Added custom fields display/edit +# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any # require("dbconnect.php"); @@ -534,7 +535,7 @@ else } ##### grab vicidial_list data for lead ##### - $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='" . mysql_real_escape_string($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,entry_list_id from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); @@ -569,6 +570,7 @@ else $last_local_call_time = $row[31]; $rank = $row[32]; $owner = $row[33]; + $entry_list_id = $row[34]; echo "
Call information: $first_name $last_name - $phone_number

\n"; echo "\n"; @@ -737,13 +739,16 @@ else ### iframe for custom fields display/editing if ($custom_fields_enabled > 0) { - $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; + $CLlist_id = $list_id; + if (strlen($entry_list_id) > 2) + {$CLlist_id = $entry_list_id;} + $stmt="SHOW TABLES LIKE \"custom_$CLlist_id\";"; if ($DB>0) {echo "$stmt";} $rslt=mysql_query($stmt, $link); $tablecount_to_print = mysql_num_rows($rslt); if ($tablecount_to_print > 0) { - $stmt="SELECT count(*) from custom_$list_id where lead_id='$lead_id';"; + $stmt="SELECT count(*) from custom_$CLlist_id where lead_id='$lead_id';"; if ($DB>0) {echo "$stmt";} $rslt=mysql_query($stmt, $link); $fieldscount_to_print = mysql_num_rows($rslt); @@ -753,7 +758,7 @@ else $custom_records_count = $rowx[0]; echo "CUSTOM FIELDS FOR THIS LEAD:
\n"; - echo "\n"; + echo "\n"; echo "

"; } } diff --git a/agc_2-X/trunk/www/vicidial/call_report_export.php b/agc_2-X/trunk/www/vicidial/call_report_export.php index 21a20f53..afc6f62e 100644 --- a/agc_2-X/trunk/www/vicidial/call_report_export.php +++ b/agc_2-X/trunk/www/vicidial/call_report_export.php @@ -19,6 +19,7 @@ # 100216-0042 - Added popup date selector # 100507-1413 - Added headers for export # 100702-1332 - Added custom fields option +# 100712-1324 - Added system setting slave server option # require("dbconnect.php"); @@ -55,21 +56,36 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} if (strlen($shift)<2) {$shift='ALL';} +$report_name = 'Export Calls Report'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,custom_fields_enabled FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,custom_fields_enabled FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); - $non_latin = $row[0]; - $custom_fields_enabled = $row[1]; + $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; + $custom_fields_enabled = $row[4]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $PHP_AUTH_USER = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -515,7 +531,7 @@ else echo "\n"; echo "\n"; - echo "ADMINISTRATION: Export Calls Report"; + echo "<TITLE>ADMINISTRATION: $report_name"; ##### BEGIN Set variables to make header show properly ##### $ADD = '100'; diff --git a/agc_2-X/trunk/www/vicidial/dbconnect.php b/agc_2-X/trunk/www/vicidial/dbconnect.php index 594e7c84..c6011134 100644 --- a/agc_2-X/trunk/www/vicidial/dbconnect.php +++ b/agc_2-X/trunk/www/vicidial/dbconnect.php @@ -6,6 +6,10 @@ # # Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # +# CHANGES +# 100712-1430 - Added slave server option for connection +# + if ( file_exists("/etc/astguiclient.conf") ) { $DBCagc = file("/etc/astguiclient.conf"); @@ -47,6 +51,8 @@ else $WeBServeRRooT = '/usr/local/apache2/htdocs'; } +if ( ($use_slave_server > 0) and (strlen($slave_db_server)>5) ) + {$VARDB_server = $slave_db_server;} $link=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass"); if (!$link) { diff --git a/agc_2-X/trunk/www/vicidial/fcstats.php b/agc_2-X/trunk/www/vicidial/fcstats.php index 7bcc2ca8..a1ecd7a6 100644 --- a/agc_2-X/trunk/www/vicidial/fcstats.php +++ b/agc_2-X/trunk/www/vicidial/fcstats.php @@ -14,6 +14,7 @@ # 90508-0644 - Changed to PHP long tags # 100214-1421 - Sort menu alphabetically # 100216-0042 - Added popup date selector +# 100712-1324 - Added system setting slave server option # require("dbconnect.php"); @@ -39,6 +40,36 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); if (strlen($shift)<2) {$shift='ALL';} + +$report_name = 'Fronter - Closer Report'; +$db_source = 'M'; + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; + } +##### END SETTINGS LOOKUP ##### +########################################### + +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "<!-- Using slave server $slave_db_server $db_source -->\n"; + } + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); @@ -88,7 +119,7 @@ while ($i < $groups_to_print) <?php echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n"; -echo "<TITLE>In-Group Fronter-Closer Stats Report\n"; +echo "$report_name\n"; $short_header=1; @@ -605,7 +636,7 @@ echo "+--------------------------+--------+------+------+------+------+-------+\ $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); -if ($DB) {echo "\nRun Time: $RUNtime seconds\n";} +if ($DB) {echo "\nRun Time: $RUNtime seconds|$db_source\n";} } diff --git a/agc_2-X/trunk/www/vicidial/list_download.php b/agc_2-X/trunk/www/vicidial/list_download.php index 0719ec5e..f492ba87 100644 --- a/agc_2-X/trunk/www/vicidial/list_download.php +++ b/agc_2-X/trunk/www/vicidial/list_download.php @@ -14,6 +14,7 @@ # 100119-1039 - Filtered comments for \n newlines # 100508-1439 - Added header row to output # 100702-1335 - Added custom fields +# 100712-1324 - Added system setting slave server option # require("dbconnect.php"); @@ -32,21 +33,36 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} if (strlen($shift)<2) {$shift='ALL';} +$report_name = 'Download List'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,custom_fields_enabled FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,custom_fields_enabled FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); - $non_latin = $row[0]; - $custom_fields_enabled = $row[1]; + $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; + $custom_fields_enabled = $row[4]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); +# echo "\n"; + } + $PHP_AUTH_USER = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_PW); diff --git a/agc_2-X/trunk/www/vicidial/listloader.pl b/agc_2-X/trunk/www/vicidial/listloader.pl index 96d30bd4..f660d140 100644 --- a/agc_2-X/trunk/www/vicidial/listloader.pl +++ b/agc_2-X/trunk/www/vicidial/listloader.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# listloader.pl version 2.2.0 +# listloader.pl version 2.4 # # Copyright (C) 2010 Matt Florell,Joe Johnson LICENSE: AGPLv2 # @@ -23,6 +23,8 @@ # 91112-0616 - Added title/alt-phone duplicate checking # 100118-0537 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA) # 100630-1609 - Added a check for invalid ListIds and filtered out ' " ; ` \ from the field +# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any +# ### begin parsing run-time options ### if (length($ARGV[0])>1) @@ -672,14 +674,14 @@ foreach $oWkS (@{$oBook->{Worksheet}}) { if ($multi_insert_counter > 8) { ### insert good deal into pending_transactions table ### - $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner');"; + $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');"; $affected_rows = $dbhA->do($stmtZ); print STMT_FILE $stmtZ."\r\n"; $multistmt=''; $multi_insert_counter=0; } else { - $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner'),"; + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),"; $multi_insert_counter++; } @@ -708,7 +710,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) { } if ($multi_insert_counter > 0) { - $stmtZ = "INSERT INTO vicidial_list (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) values ".substr($multistmt, 0, -1).";"; + $stmtZ = "INSERT INTO vicidial_list (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) values ".substr($multistmt, 0, -1).";"; $affected_rows = $dbhA->do($stmtZ); print STMT_FILE $stmtZ."\r\n"; } diff --git a/agc_2-X/trunk/www/vicidial/listloader_super.pl b/agc_2-X/trunk/www/vicidial/listloader_super.pl index 439ba3d4..dc30c6bd 100644 --- a/agc_2-X/trunk/www/vicidial/listloader_super.pl +++ b/agc_2-X/trunk/www/vicidial/listloader_super.pl @@ -22,6 +22,8 @@ # 91112-0616 - Added title/alt-phone duplicate checking # 100118-0539 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA) # 100630-1609 - Added a check for invalid ListIds and filtered out ' " ; ` \ from the field +# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any +# ### begin parsing run-time options ### if (length($ARGV[0])>1) @@ -672,14 +674,14 @@ foreach $oWkS (@{$oBook->{Worksheet}}) { if ($multi_insert_counter > 8) { ### insert good deal into pending_transactions table ### - $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner');"; + $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','0');"; $affected_rows = $dbhA->do($stmtZ); print STMT_FILE $stmtZ."\r\n"; $multistmt=''; $multi_insert_counter=0; } else { - $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner'),"; + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','0'),"; $multi_insert_counter++; } @@ -708,7 +710,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) { } if ($multi_insert_counter > 0) { - $stmtZ = "INSERT INTO vicidial_list (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) values ".substr($multistmt, 0, -1).";"; + $stmtZ = "INSERT INTO vicidial_list (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) values ".substr($multistmt, 0, -1).";"; $affected_rows = $dbhA->do($stmtZ); print STMT_FILE $stmtZ."\r\n"; } diff --git a/agc_2-X/trunk/www/vicidial/new_listloader_superL.php b/agc_2-X/trunk/www/vicidial/new_listloader_superL.php index 4c927fd3..cf30ba07 100644 --- a/agc_2-X/trunk/www/vicidial/new_listloader_superL.php +++ b/agc_2-X/trunk/www/vicidial/new_listloader_superL.php @@ -33,11 +33,12 @@ # 100621-1026 - Added admin_web_directory variable # 100630-1609 - Added a check for invalid ListIds and filtered out ' " ; ` \ from the field # 100705-1507 - Added custom fields to field chooser, only when liast_id_override is used and only with TXT and CSV file formats +# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any # # make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. -$version = '2.4-36'; -$build = '100705-1507'; +$version = '2.4-37'; +$build = '100712-1416'; require("dbconnect.php"); @@ -138,7 +139,7 @@ if (isset($_GET["DB"])) {$DB=$_GET["DB"];} ### REGEX to prevent weird characters from ending up in the fields $field_regx = "['\"`\\;]"; -$vicidial_list_fields = '|lead_id|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|'; +$vicidial_list_fields = '|lead_id|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|'; ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### @@ -718,7 +719,7 @@ echo "
\n"; echo ""; - $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout,callcard_enabled,queuemetrics_callstatus,default_codecs,admin_web_directory,label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,custom_fields_enabled from system_settings;"; + $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout,callcard_enabled,queuemetrics_callstatus,default_codecs,admin_web_directory,label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,custom_fields_enabled,slave_db_server,reports_use_slave_db from system_settings;"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $version = $row[0]; @@ -23563,6 +23588,8 @@ if ($ADD==311111111111111) $label_email = $row[72]; $label_comments = $row[73]; $custom_fields_enabled = $row[74]; + $slave_db_server = $row[75]; + $reports_use_slave_db = $row[76]; echo "
MODIFY VICIDIAL SYSTEM SETTINGS
\n"; echo "\n"; @@ -23715,6 +23742,25 @@ if ($ADD==311111111111111) echo "
Enable Custom List Fields: $NWB#settings-custom_fields_enabled$NWE
Slave Database Server: $NWB#settings-slave_db_server$NWE
Reports to use Slave DB: $NWB#settings-reports_use_slave_db$NWE
Custom Dialplan Entry: $NWB#settings-custom_dialplan_entry$NWE
"; if (strlen($custom_SQL)>3) { - $stmtZ = "INSERT INTO vicidial_list (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) values('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner');"; + $stmtZ = "INSERT INTO vicidial_list (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) values('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','$list_id');"; $rslt=mysql_query($stmtZ, $link); $affected_rows = mysql_affected_rows($link); $lead_id = mysql_insert_id($link); @@ -737,7 +738,7 @@ echo "
"; if ($multi_insert_counter > 8) { ### insert good record into vicidial_list table ### - $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner');"; + $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','0');"; $rslt=mysql_query($stmtZ, $link); if ($WeBRooTWritablE > 0) {fwrite($stmt_file, $stmtZ."\r\n");} @@ -746,7 +747,7 @@ echo "
"; } else { - $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner'),"; + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','0'),"; $multi_insert_counter++; } } @@ -775,7 +776,7 @@ echo "
"; } } if ($multi_insert_counter!=0) { - $stmtZ = "INSERT INTO vicidial_list (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) values".substr($multistmt, 0, -1).";"; + $stmtZ = "INSERT INTO vicidial_list (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) values".substr($multistmt, 0, -1).";"; mysql_query($stmtZ, $link); if ($WeBRooTWritablE > 0) {fwrite($stmt_file, $stmtZ."\r\n");} @@ -1106,7 +1107,7 @@ echo "
"; if (strlen($custom_SQL)>3) { - $stmtZ = "INSERT INTO vicidial_list (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) values('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner');"; + $stmtZ = "INSERT INTO vicidial_list (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) values('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','$list_id');"; $rslt=mysql_query($stmtZ, $link); $affected_rows = mysql_affected_rows($link); $lead_id = mysql_insert_id($link); @@ -1125,7 +1126,7 @@ echo "
"; if ($multi_insert_counter > 8) { ### insert good deal into pending_transactions table ### - $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner');"; + $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','0');"; $rslt=mysql_query($stmtZ, $link); if ($WeBRooTWritablE > 0) {fwrite($stmt_file, $stmtZ."\r\n");} @@ -1134,7 +1135,7 @@ echo "
"; } else { - $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner'),"; + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','0'),"; $multi_insert_counter++; } } @@ -1161,7 +1162,7 @@ echo "
"; } } if ($multi_insert_counter!=0) { - $stmtZ = "INSERT INTO vicidial_list (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) values".substr($multistmt, 0, -1).";"; + $stmtZ = "INSERT INTO vicidial_list (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) values".substr($multistmt, 0, -1).";"; mysql_query($stmtZ, $link); if ($WeBRooTWritablE > 0) {fwrite($stmt_file, $stmtZ."\r\n");} @@ -1440,7 +1441,7 @@ if ($leadfile) { if ($multi_insert_counter > 8) { ### insert good deal into pending_transactions table ### - $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner');"; + $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','0');"; $rslt=mysql_query($stmtZ, $link); if ($WeBRooTWritablE > 0) {fwrite($stmt_file, $stmtZ."\r\n");} @@ -1448,7 +1449,7 @@ if ($leadfile) { $multi_insert_counter=0; } else { - $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner'),"; + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','0'),"; $multi_insert_counter++; } @@ -1476,7 +1477,7 @@ if ($leadfile) { } } if ($multi_insert_counter!=0) { - $stmtZ = "INSERT INTO vicidial_list (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) values".substr($multistmt, 0, -1).";"; + $stmtZ = "INSERT INTO vicidial_list (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) values".substr($multistmt, 0, -1).";"; mysql_query($stmtZ, $link); if ($WeBRooTWritablE > 0) {fwrite($stmt_file, $stmtZ."\r\n");} @@ -1751,7 +1752,7 @@ if ($leadfile) { if ($multi_insert_counter > 8) { ### insert good deal into pending_transactions table ### - $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner');"; + $stmtZ = "INSERT INTO vicidial_list (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) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','0');"; $rslt=mysql_query($stmtZ, $link); if ($WeBRooTWritablE > 0) {fwrite($stmt_file, $stmtZ."\r\n");} @@ -1759,7 +1760,7 @@ if ($leadfile) { $multi_insert_counter=0; } else { - $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner'),"; + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$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',0,'2008-01-01 00:00:00','$rank','$owner','0'),"; $multi_insert_counter++; } @@ -1786,7 +1787,7 @@ if ($leadfile) { } } if ($multi_insert_counter!=0) { - $stmtZ = "INSERT INTO vicidial_list (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) values".substr($multistmt, 0, -1).";"; + $stmtZ = "INSERT INTO vicidial_list (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) values".substr($multistmt, 0, -1).";"; mysql_query($stmtZ, $link); if ($WeBRooTWritablE > 0) {fwrite($stmt_file, $stmtZ."\r\n");} diff --git a/agc_2-X/trunk/www/vicidial/non_agent_api.php b/agc_2-X/trunk/www/vicidial/non_agent_api.php index 61e2198a..eb825189 100644 --- a/agc_2-X/trunk/www/vicidial/non_agent_api.php +++ b/agc_2-X/trunk/www/vicidial/non_agent_api.php @@ -32,10 +32,11 @@ # 91216-0331 - Added duplication check features to add_lead function # 100118-0543 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA) # 100704-1148 - Added custom fields inserts to the add_lead function +# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any # -$version = '2.4-18'; -$build = '100704-1148'; +$version = '2.4-19'; +$build = '100712-1416'; require("dbconnect.php"); @@ -1425,7 +1426,7 @@ if ($function == 'add_lead') ### insert a new lead in the system with this phone number - $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='NEW',user='$user',vendor_lead_code='$vendor_lead_code',source_id='$source_id',gmt_offset_now='$gmt_offset',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',called_since_last_reset='N',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME',rank='$rank',owner='$owner';"; + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='NEW',user='$user',vendor_lead_code='$vendor_lead_code',source_id='$source_id',gmt_offset_now='$gmt_offset',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',called_since_last_reset='N',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME',rank='$rank',owner='$owner',entry_list_id='0';"; if ($DB>0) {echo "DEBUG: add_lead query - $stmt\n";} $rslt=mysql_query($stmt, $link); $affected_rows = mysql_affected_rows($link); @@ -1535,9 +1536,14 @@ if ($function == 'add_lead') $custom_insert_count = mysql_affected_rows($link); if ($custom_insert_count > 0) { + # Update vicidial_list entry to put list_id as entry_list_id + $vl_table_entry_update_SQL = "UPDATE vicidial_list SET entry_list_id='$list_id' where lead_id='$lead_id';"; + $rslt=mysql_query($vl_table_entry_update_SQL, $link); + $vl_table_entry_update_count = mysql_affected_rows($link); + $result = 'NOTICE'; $result_reason = "add_lead CUSTOM FIELDS VALUES ADDED"; - echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n"; + echo "$result: $result_reason - $phone_number|$lead_id|$list_id|$vl_table_entry_update_count\n"; $data = "$phone_number|$lead_id|$list_id"; api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); } diff --git a/agc_2-X/trunk/www/vicidial/timeclock_report.php b/agc_2-X/trunk/www/vicidial/timeclock_report.php index f5c8bfdf..0491d328 100644 --- a/agc_2-X/trunk/www/vicidial/timeclock_report.php +++ b/agc_2-X/trunk/www/vicidial/timeclock_report.php @@ -12,6 +12,7 @@ # 90508-0644 - Changed to PHP long tags # 100214-1421 - Sort menu alphabetically # 100216-0042 - Added popup date selector +# 100712-1324 - Added system setting slave server option # require("dbconnect.php"); @@ -42,9 +43,12 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} if (strlen($shift)<2) {$shift='ALL';} if (strlen($order)<2) {$order='hours_down';} +$report_name = 'User Timeclock Report'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,webroot_writable FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -52,12 +56,23 @@ if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; - $webroot_writable = $row[1]; - $SSoutbound_autodial_active = $row[2]; + $SSoutbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; + $webroot_writable = $row[4]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "\n"; + } + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -139,9 +154,10 @@ while ($i < $user_groups_to_print) -User Timeclock Report +<TITLE> <?php +echo "$report_name"; ##### BEGIN Set variables to make header show properly ##### $ADD = '311111'; @@ -373,20 +389,6 @@ echo "</TR>\n"; echo "</TABLE>\n"; -echo "\n"; - -/* - $TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60); - $TOTavgWAIT_M = round($TOTavgWAIT_M, 2); - $TOTavgWAIT_M_int = intval("$TOTavgWAIT_M"); - $TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int); - $TOTavgWAIT_S = ($TOTavgWAIT_S * 60); - $TOTavgWAIT_S = round($TOTavgWAIT_S, 0); - if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";} - $TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S"; - $TOTavgWAIT_MS = sprintf("%6s", $TOTavgWAIT_MS); - while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);} -*/ ?> </CENTER> </BODY></HTML> diff --git a/agc_2-X/trunk/www/vicidial/timeclock_status.php b/agc_2-X/trunk/www/vicidial/timeclock_status.php index 2dd5883c..1e3e2bc4 100644 --- a/agc_2-X/trunk/www/vicidial/timeclock_status.php +++ b/agc_2-X/trunk/www/vicidial/timeclock_status.php @@ -10,6 +10,7 @@ # 90310-2103 - Added admin header # 90508-0644 - Changed to PHP long tags # 100214-1421 - Sort menu alphabetically +# 100712-1324 - Added system setting slave server option # header ("Content-type: text/html; charset=utf-8"); @@ -35,9 +36,12 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +$report_name = 'User Group Timeclock Status Report'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,webroot_writable,timeclock_end_of_day,outbound_autodial_active FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,webroot_writable,timeclock_end_of_day FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -45,13 +49,24 @@ if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; - $webroot_writable = $row[1]; - $timeclock_end_of_day = $row[2]; - $SSoutbound_autodial_active = $row[3]; + $SSoutbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; + $webroot_writable = $row[4]; + $timeclock_end_of_day = $row[5]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "<!-- Using slave server $slave_db_server $db_source -->\n"; + } + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -141,8 +156,9 @@ if (strlen($user_group) > 0) <html> <head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> -<title>ADMINISTRATION: Timeclock Status +<title>ADMINISTRATION: <?php +echo "$report_name"; ##### BEGIN Set variables to make header show properly ##### $ADD = '311111'; @@ -399,7 +415,7 @@ $RUNtime = ($ENDtime - $STARTtime); echo "\n\n\n<br><br><br>\n\n"; -echo "<font size=0>\n\n\n<br><br><br>\nscript runtime: $RUNtime seconds</font>"; +echo "<font size=0>\n\n\n<br><br><br>\nscript runtime: $RUNtime seconds|$db_source</font>"; ?> @@ -523,7 +539,7 @@ $RUNtime = ($ENDtime - $STARTtime); echo "\n\n\n<br><br><br>\n\n"; -echo "<font size=0>\n\n\n<br><br><br>\nscript runtime: $RUNtime seconds</font>"; +echo "<font size=0>\n\n\n<br><br><br>\nscript runtime: $RUNtime seconds|$db_source</font>"; ?> diff --git a/agc_2-X/trunk/www/vicidial/user_stats.php b/agc_2-X/trunk/www/vicidial/user_stats.php index af395307..b9593d4f 100644 --- a/agc_2-X/trunk/www/vicidial/user_stats.php +++ b/agc_2-X/trunk/www/vicidial/user_stats.php @@ -24,6 +24,7 @@ # 100203-1008 - Added agent activity log section # 100216-0042 - Added popup date selector # 100425-0115 - Added more login data +# 100712-1324 - Added system setting slave server option # header ("Content-type: text/html; charset=utf-8"); @@ -31,22 +32,37 @@ header ("Content-type: text/html; charset=utf-8"); require("dbconnect.php"); require("functions.php"); + +$report_name = 'User Stats'; +$db_source = 'M'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,outbound_autodial_active,user_territories_active FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,user_territories_active FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} -$ss_conf_ct = mysql_num_rows($rslt); -if ($ss_conf_ct > 0) +$qm_conf_ct = mysql_num_rows($rslt); +if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); - $non_latin = $row[0]; - $SSoutbound_autodial_active = $row[1]; - $user_territories_active = $row[2]; + $non_latin = $row[0]; + $SSoutbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; + $user_territories_active = $row[4]; } ##### END SETTINGS LOOKUP ##### ########################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + echo "<!-- Using slave server $slave_db_server $db_source -->\n"; + } + $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['PHP_SELF']; @@ -149,7 +165,7 @@ else if ($did > 0) {echo "<title>ADMINISTRATION: DID Call Stats";} else - {echo "<title>ADMINISTRATION: User Stats";} + {echo "<title>ADMINISTRATION: $report_name";} @@ -887,7 +903,7 @@ $RUNtime = ($ENDtime - $STARTtime); echo "\n\n\n<br><br><br>\n\n"; -echo "<font size=0>\n\n\n<br><br><br>\nscript runtime: $RUNtime seconds</font>"; +echo "<font size=0>\n\n\n<br><br><br>\nscript runtime: $RUNtime seconds|$db_source</font>"; ?>