diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index a4025141..ea0e11d4 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -136,6 +136,8 @@ OTHER CHANGES: option in campaigns and in-groups. See DISPO_SEND_EMAIL.txt doc for more information on this feature. +29. Added code to support proprietary encryption framework for custom fields. + diff --git a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi index 075fc307..6ab67490 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi @@ -198,6 +198,7 @@ # 150704-0749 - Fixed issue with ALT and ADDR3 lookups with list/campaign restruction, Issue #872 # 150707-0850 - Fixed issues with na_call_url function for all calls that are not sent to agent # 150804-1718 - Added _lead_reset options +# 150812-2004 - Changed maximum time since last agent update to route a call to and agent from 5 to 7 seconds # $script = 'agi-VDAD_ALL_inbound.agi'; @@ -241,7 +242,7 @@ $SQLdateBEGIN = $SQLdate; $ORIGINAL_call_time = $SQLdate; while (length($CIDdate) > 9) {$CIDdate =~ s/^.//gi;} # 0902235959 changed to 902235959 -$BDtarget = ($now_date_epoch - 5); +$BDtarget = ($now_date_epoch - 7); ($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); $Byear = ($Byear + 1900); $Bmon++; diff --git a/agc_2-X/trunk/agi/park_call_IVR_cf_collect.agi b/agc_2-X/trunk/agi/park_call_IVR_cf_collect.agi new file mode 100644 index 00000000..d0925319 --- /dev/null +++ b/agc_2-X/trunk/agi/park_call_IVR_cf_collect.agi @@ -0,0 +1,728 @@ +#!/usr/bin/perl +# +# park_call_IVR_cf_collect.agi version 2.12 +# +# NOTE: this script is to be used with the Park Call IVR feature in campaigns. +# The purpose of this script is to allow the agent to park a call on this IVR +# and have the customer enter in sensitive numbers. This script should not +# require any modification to work. +# +# Defined in the Park Call AGI IVR field of a campaign, this script will ask +# customer for their ID and then populate it in the custom fiels defined in the +# variable below and then send the call back to the agent. If the customer +# enters nothing X number of times then the call can be kicked out to a separate +# in-group +# +# Here is a list of the variables that you can set: +# 1. Language - default: en (English), other options are es-Spanish, fr-French +# 2. First prompt - default: please_enter_id_number +# 3. You-Entered prompt - default: you-entered +# 4. Confirmation prompt - default: confirm_id_number +# 5. Thank you prompt - default: auth-thankyou +# 6. Invalid prompt - default: buzz +# 7. Attempts before kick-out - default: 2 +# 8. Kick-out prompt - default: outside-transfer +# 9. Kick-out In-Group +# 10. Custom Field to populate +# +# Example Park Call AGI IVR field: +# park_call_IVR_cf_collect.agi,en---please_enter_id_number---you-entered---confirm_id_number---auth-thankyou---buzz---2---outside-transfer---TEST_IN---test2 +# +# Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 +# +# changes: +# 150814-1119 - First build based on park_call_IVR_example.agi script +# + +$script = 'park_call_IVR_cf_collect.agi'; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$S='*'; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use DBI; +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT agi_output,ext_context FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +if ($sthArows > 0) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = $aryA[0]; + $ext_context = $aryA[1]; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + } +$sthA->finish(); + +### Grab System Settings from the database +$stmtA = "SELECT sounds_web_server FROM system_settings;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $sounds_web_server = $aryA[0]; + } +$sthA->finish(); + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) + { + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + ### list of command-line array arguments: + @ARGV_vars = split(/---/, $ARGV[0]); + + $language = $ARGV_vars[0]; + $first_prompt = $ARGV_vars[1]; + $you_entered_prompt = $ARGV_vars[2]; + $confirmation_prompt = $ARGV_vars[3]; + $thank_you_prompt = $ARGV_vars[4]; + $invalid_prompt = $ARGV_vars[5]; + $kickout_attempts = $ARGV_vars[6]; + $kickout_prompt = $ARGV_vars[7]; + $kickout_ingroup = $ARGV_vars[8]; + $custom_field = $ARGV_vars[9]; + } + +if (length($language)<1) {$language='en';} +if (length($first_prompt)<1) {$first_prompt='please_enter_id_number';} +if (length($you_entered_prompt)<1) {$you_entered_prompt='you-entered';} +if (length($confirmation_prompt)<1) {$confirmation_prompt='confirm_id_number';} +if (length($thank_you_prompt)<1) {$thank_you_prompt='auth-thankyou';} +if (length($invalid_prompt)<1) {$invalid_prompt='buzz';} +if (length($kickout_attempts)<1) {$kickout_attempts='2';} +if (length($kickout_prompt)<1) {$kickout_prompt='outside-transfer';} +if (length($custom_field)<1) {$custom_field='test';} + +$|=1; +while() + { + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (!$fullCID) # if no fullCID sent + { + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + if ( $calleridname =~ /\"/) {$calleridname =~ s/\"//gi;} + if ( (!$callerid) or ($callerid =~ /unknown/) or ( ($calleridname =~ /\d\d\d\d\d\d\d\d\d/) && (length($calleridname) > 16) ) ) + {$callerid = $calleridname;} + if ( ($callerid =~ / /) && (length($callerid) > 20) ) + {$callerid =~ s/ .*//gi;} + + ### allow for ANI being sent with the DNIS "*3125551212*9999*" + if ($extension =~ /^\*\d\d\d\d\d\d\d\d\d\d\*/) + { + $callerid = $extension; + $callerid =~ s/\*\d\d\d\d\*$//gi; + $callerid =~ s/^\*//gi; + $extension =~ s/^\*\d\d\d\d\d\d\d\d\d\d\*//gi; + $extension =~ s/\*$//gi; + } + $calleridname = $callerid; + } + } + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) + { + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} + } + + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|"; &agi_output;} + +if ($AGILOG) {$agi_string = "PARKED CALL IVR STARTED: |$custom_field|"; &agi_output;} + + +$stmtA = "UPDATE parked_channels set channel_group='$callerid' where server_ip='$VARserver_ip' and channel='$channel';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- Park record updated: |$affected_rows| |$callerid|$channel|$VARserver_ip"; &agi_output;} + +$VACcount=0; +$VAC_campaign_id=''; +$VAC_call_type=''; +$VAC_extension=''; +$VLAcount=0; +$VLA_user=''; +$VLA_campaign_id=''; +$VCcount=0; +$MOHfiles=0; + +$stmtA = "SELECT campaign_id,call_type,extension,phone_number,lead_id FROM vicidial_auto_calls where callerid='$callerid';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$VACcount=$sthA->rows; +if ($VACcount > 0) + { + @aryA = $sthA->fetchrow_array; + $VAC_campaign_id = $aryA[0]; + $VAC_call_type = $aryA[1]; + $VAC_extension = $aryA[2]; + $VAC_phone_number = $aryA[3]; + $VAC_lead_id = $aryA[4]; + if ($AGILOG) {$agi_string = "-- VAC Call Found: |$callerid|$VAC_campaign_id|$VAC_call_type|$VAC_extension|$VAC_phone_number|$VAC_lead_id|"; &agi_output;} + } +$sthA->finish(); + + +if ($VACcount > 0) + { + $stmtA = "SELECT user,campaign_id,server_ip,conf_exten FROM vicidial_live_agents where callerid='$callerid';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $VLAcount=$sthA->rows; + if ($VLAcount > 0) + { + @aryA = $sthA->fetchrow_array; + $VLA_user = $aryA[0]; + $VLA_campaign_id = $aryA[1]; + $VLA_server_ip = $aryA[2]; + $VLA_conf_exten = $aryA[3]; + } + $sthA->finish(); + if ($VLAcount > 0) + { + if ($AGILOG) {$agi_string = "-- Starting Gather Data: |$VLA_user|$VLA_campaign_id|$kickout_attempts| |$callerid|"; &agi_output;} + + + ### BEGIN prompt for customer ID number ($customer_id_number) ### + $customer_id_number=''; + $variable=''; + $confirmation=0; + $confirmation_chances=0; + $collect_digits='20'; + $ms_delay='8000'; + $variable_entry_prompt = $first_prompt; + $confirm_entry_prompt = $you_entered_prompt; + while ( ($confirmation_chances < $kickout_attempts) && ($confirmation < 1) ) + { + $entry_chances=0; + while ( ($entry_chances < $kickout_attempts) && (length($variable) < 1) ) + { + $entry_chances++; + + &customer_variable_gather; + + $customer_id_number = $variable; + + if ( (length($customer_id_number) < 1) || (length($customer_id_number) > 20) ) + { + if ($AGILOG) {$agi_string = "-- CUSTOMER ID GATHER FAIL : |$customer_id_number|"; &agi_output;} + $audio_file = $invalid_prompt; &play_audio; + $variable=''; + } + } + $confirmation_chances++; + + if ( (length($customer_id_number) > 0) || (length($customer_id_number) <= 20) ) + { + $audio_file = $confirm_entry_prompt; &play_audio; + $AGI->say_digits("$variable"); + + &confirm_entry; + + if ($ANSWER_confirm > 1) + {$variable='';} + if ( ($ANSWER_confirm > 0) && ($ANSWER_confirm < 2) ) + {$confirmation=1;} + } + else + { + if ($entry_chances >= $kickout_attempts) + {$confirmation_chances=$kickout_attempts;} + } + } + + ### customer ID confirmed, update in vicidial_list and tag agent for update + if ($confirmation > 0) + { + $stmtA = "SELECT list_id FROM vicidial_list where lead_id='$VAC_lead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $VACcount=$sthA->rows; + if ($VACcount > 0) + { + @aryA = $sthA->fetchrow_array; + $VL_list_id = $aryA[0]; + if ($AGILOG) {$agi_string = "-- VL List Found: |$VL_list_id|$callerid|$VAC_lead_id|"; &agi_output;} + } + $sthA->finish(); + + ### find wget binary + $wgetbin = ''; + if ( -e ('/bin/wget')) {$wgetbin = '/bin/wget';} + else + { + if ( -e ('/usr/bin/wget')) {$wgetbin = '/usr/bin/wget';} + else + { + if ( -e ('/usr/local/bin/wget')) {$wgetbin = '/usr/local/bin/wget';} + else + { + print "Can't find wget binary! Exiting...\n"; + exit; + } + } + } + + ### URL to be sent to populate the custom field value that was collected from the customer + $parse_url = "http://$sounds_web_server/agc/update_cf_ivr.php\?lead_id=$VAC_lead_id&caller_id=$callerid&list_id=$VL_list_id&field=$custom_field&value=$customer_id_number&user=$VLA_user"; + + ### insert a new url log entry + $SQL_log = "$parse_url"; + $SQL_log =~ s/;|\||\\//gi; + $stmtA = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date='$now_date',url_type='park_ivr_cf',url='$SQL_log',url_response='';"; + $affected_rows = $dbhA->do($stmtA); + $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; + $sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $url_id = $aryA[0]; + } + $sthA->finish(); + + $url = $parse_url; + $url =~ s/'/\\'/gi; + $url =~ s/"/\\"/gi; + $url =~ s/ /+/gi; + $url =~ s/&/\\&/gi; + $url =~ s/\?/\\?/gi; + + my $secW = time(); + + `$wgetbin --no-check-certificate --output-document=/tmp/ASUBtmpD$US$url_id$US$secX --output-file=/tmp/ASUBtmpF$US$url_id$US$secX $url `; + + # $event_string="$function|$wgetbin --no-check-certificate --output-document=/tmp/ASUBtmpD$US$url_id$US$secX --output-file=/tmp/ASUBtmpF$US$url_id$US$secX $url|"; + + + my $secY = time(); + my $response_sec = ($secY - $secW); + + open(Wdoc, "/tmp/ASUBtmpD$US$url_id$US$secX") || die "can't open /tmp/ASUBtmpD$US$url_id$US$secX: $!\n"; + @Wdoc = ; + close(Wdoc); + $i=0; + $Wdocline_cat=''; + foreach(@Wdoc) + { + $Wdocline = $Wdoc[$i]; + $Wdocline =~ s/\n|\r/!/gi; + $Wdocline =~ s/ |\t|\'|\`//gi; + $Wdocline_cat .= "$Wdocline"; + $i++; + } + if (length($Wdocline_cat)<1) + {$Wdocline_cat='';} + + open(Wfile, "/tmp/ASUBtmpF$US$url_id$US$secX") || die "can't open /tmp/ASUBtmpF$US$url_id$US$secX: $!\n"; + @Wfile = ; + close(Wfile); + $i=0; + $Wfileline_cat=''; + foreach(@Wfile) + { + $Wfileline = $Wfile[$i]; + $Wfileline =~ s/\n|\r/!/gi; + $Wfileline =~ s/ |\t|\'|\`//gi; + $Wfileline_cat .= "$Wfileline"; + $i++; + } + if (length($Wfileline_cat)<1) + {$Wfileline_cat='
';} + + + ### update url log entry + $stmtA = "UPDATE vicidial_url_log SET url_response='$Wdocline_cat|$Wfileline_cat',response_sec='$response_sec' where url_log_id='$url_id';"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print "$affected_rows|$stmtA\n";} + + sleep(1); + + $stmtA = "UPDATE vicidial_live_agents set external_update_fields='1',external_update_fields_data='formreload' where user='$VLA_user';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- Agent data update triggered: |$affected_rows| |$callerid|$stmtA|"; &agi_output;} + } + + ### no valid customer ID received, send customer to kickout in-group if defined + if ( ($confirmation < 1) && (length($kickout_ingroup)>0) ) + { + $audio_file = $kickout_prompt; &play_audio; + sleep(1); + + $stmtA = "UPDATE vicidial_live_agents set external_transferconf='LOCAL_CLOSER---$kickout_ingroup' where user='$VLA_user';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- AGI Done, kick-out, sending call to kickout ingroup: |$affected_rows| |$callerid|$kickout_ingroup|$stmtA"; &agi_output;} + } + ### END prompt for customer ID number ($customer_id_number) ### + else + { + ### send API command to have agent grab call back + + $AGI->stream_file('sip-silence'); + $AGI->stream_file('sip-silence'); + $AGI->stream_file('sip-silence'); + $AGI->stream_file('sip-silence'); + + $stmtA = "UPDATE vicidial_live_agents set external_park='GRAB_IVR_CUSTOMER' where user='$VLA_user';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- AGI Done, sending call back to agent: |$affected_rows| |$callerid|$stmtA|$VLA_user|"; &agi_output;} + } + } + } +else + { + if ($AGILOG) {$agi_string = "-- Call Not Found in vicidial_auto_calls: |$callerid|"; &agi_output;} + } + + +$dbhA->disconnect(); + + +$AGI->stream_file('sip-silence'); + +if ($AGILOG) {$agi_string = "-- Exiting Park Call IVR: |$callerid|"; &agi_output;} + +exit; + + + + + +sub agi_output + { + if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### + if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} + $agi_string=''; + } + + +sub checkresult + { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) + { + $res =~ /result=(-?\d+)/; + if (!length($1)) + { + # print STDERR "FAIL ($res)\n"; + $fail++; + } + else + { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } + else + { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } + } + + +sub leading_zero($) + { + $_ = $_[0]; + s/^(\d)$/0$1/; + s/^(\d\d)$/0$1/; + return $_; + } # End of the leading_zero() routine. + + +### play audio, check for existing other language if defined ### +sub play_audio + { + if ($language =~ /es/) + { + $file_extension_gsm='.gsm'; + $file_extension_wav='.wav'; + $audio_suffix='_es'; + if ( (-e ("$PATHsounds/$audio_file$audio_suffix$file_extension_gsm")) || (-e ("$PATHsounds/$audio_file$audio_suffix$file_extension_wav")) ) + {$donothing=1;} + else + {$audio_suffix='';} + } + elsif ($language =~ /fr/) + { + $file_extension_gsm='.gsm'; + $file_extension_wav='.wav'; + $audio_suffix='_fr'; + if ( (-e ("$PATHsounds/$audio_file$audio_suffix$file_extension_gsm")) || (-e ("$PATHsounds/$audio_file$audio_suffix$file_extension_wav")) ) + {$donothing=1;} + else + {$audio_suffix='';} + } + else + {$audio_suffix='';} + + $AGI->stream_file("$audio_file$audio_suffix"); + } + + + +##### BEGIN collect the customer variable ############################################### +sub customer_variable_gather + { + $interrupt_digit=''; + $audio_file = "$variable_entry_prompt"; + + if ($language =~ /es/) + { + $file_extension_gsm='.gsm'; + $file_extension_wav='.wav'; + $audio_suffix='_es'; + if ( (-e ("$PATHsounds/$audio_file$audio_suffix$file_extension_gsm")) || (-e ("$PATHsounds/$audio_file$audio_suffix$file_extension_wav")) ) + {$donothing=1;} + else + {$audio_suffix='';} + } + elsif ($language =~ /fr/) + { + $file_extension_gsm='.gsm'; + $file_extension_wav='.wav'; + $audio_suffix='_fr'; + if ( (-e ("$PATHsounds/$audio_file$audio_suffix$file_extension_gsm")) || (-e ("$PATHsounds/$audio_file$audio_suffix$file_extension_wav")) ) + {$donothing=1;} + else + {$audio_suffix='';} + } + else + {$audio_suffix='';} + + $interrupt_digit = $AGI->stream_file("$audio_file$audio_suffix",'0123456789'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + + $digits_being_entered=1; + $PASS_word=''; + if ($interrupt_digit > 0) + { + # if ($interrupt_digit == 35) {$interrupt_digit='#';} + # if ($interrupt_digit == 42) {$interrupt_digit='*';} + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $PASS_word=$interrupt_digit; + } + + $digit_loop_counter=0; + while ($digits_being_entered > 0) + { + $digit = chr($AGI->wait_for_digit('8000')); # wait 8 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + $PASS_word = "$PASS_word$digit"; + print STDERR "digit |$digit| PASS_word |$PASS_word|\n"; + # $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digits_being_entered=0; + } + if ( (length($PASS_word)) >= $collect_digits) + { + $digits_being_entered=0; + } + + $digit_loop_counter++; + } + + $PASS_word =~ s/\D//gi; + $variable = $PASS_word; + if ($PASS_word) {print STDERR "digit |$digit| PASS_word |$PASS_word| variable |$variable|\n";} + $collect_digits='99'; + } +##### END collect the customer variable ############################################### + + + + +##### BEGIN confirm entry ###################################### +sub confirm_entry + { + $interrupt_digit=''; + $audio_file = "$confirmation_prompt"; + + if ($language =~ /es/) + { + $file_extension_gsm='.gsm'; + $file_extension_wav='.wav'; + $audio_suffix='_es'; + if ( (-e ("$PATHsounds/$audio_file$audio_suffix$file_extension_gsm")) || (-e ("$PATHsounds/$audio_file$audio_suffix$file_extension_wav")) ) + {$donothing=1;} + else + {$audio_suffix='';} + } + elsif ($language =~ /fr/) + { + $file_extension_gsm='.gsm'; + $file_extension_wav='.wav'; + $audio_suffix='_fr'; + if ( (-e ("$PATHsounds/$audio_file$audio_suffix$file_extension_gsm")) || (-e ("$PATHsounds/$audio_file$audio_suffix$file_extension_wav")) ) + {$donothing=1;} + else + {$audio_suffix='';} + } + else + {$audio_suffix='';} + + $interrupt_digit = $AGI->stream_file("$audio_file$audio_suffix",'12'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + + $digits_being_entered=1; + $ANSWER_confirm=''; + if ($interrupt_digit > 0) + { + # if ($interrupt_digit == 35) {$interrupt_digit='#';} + # if ($interrupt_digit == 42) {$interrupt_digit='*';} + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $ANSWER_confirm=$interrupt_digit; + } + + if (length($ANSWER_confirm) < 1) + { + $digit_loop_counter=0; + while ( ($digits_being_entered > 0) && ($digit_loop_counter < 1) ) + { + $digit = chr($AGI->wait_for_digit("$ms_delay")); # wait 10 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + $ANSWER_confirm = "$ANSWER_confirm$digit"; + print STDERR "digit |$digit| ANSWER_confirm |$ANSWER_confirm|\n"; + # $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digits_being_entered=0; + } + + $digit_loop_counter++; + } + } + + $ANSWER_confirm =~ s/\D//gi; + if ($ANSWER_confirm) {print STDERR "digit |$digit| ANSWER_confirm |$ANSWER_confirm|\n";} + } +##### END confirm entry ###################################### diff --git a/agc_2-X/trunk/bin/AST_VDhopper.pl b/agc_2-X/trunk/bin/AST_VDhopper.pl index 8af94ab7..86590a8d 100644 --- a/agc_2-X/trunk/bin/AST_VDhopper.pl +++ b/agc_2-X/trunk/bin/AST_VDhopper.pl @@ -86,10 +86,11 @@ # 150312-1459 - Allow for single quotes in data fields without crashing # 150717-1050 - Added force index to some vicidial_list queries, set with $VLforce_index variable # 150728-1050 - Added option for secondary sorting by vendor_lead_code, Issue #833 +# 150908-1544 - Added debug output for vendor_lead_code duplicate rejections count # # constants -$build = '150728-1050'; +$build = '150908-1544'; $DB=0; # Debug flag, set to 0 for no debug messages. Can be overriden with CLI --debug flag $US='__'; $MT[0]=''; @@ -2700,6 +2701,7 @@ foreach(@campaign_id) $NEW_in=0; $rec_count=0; $REC_insert_count=0; + $vlc_dup_check_SKIP_COUNT=0; @leads_to_hopper=@MT; @lists_to_hopper=@MT; @gmt_to_hopper=@MT; @@ -3036,6 +3038,7 @@ foreach(@campaign_id) { $detail_string = "VLC CALL SKIPPING |$VLC_exist|$hopper_vlc_dup_check[$i]| |$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$vlc_to_hopper[$h]|"; &detail_logger; + $vlc_dup_check_SKIP_COUNT++; } else { @@ -3071,6 +3074,7 @@ foreach(@campaign_id) $h++; } if ($DB) {print " DONE with this campaign\n";} + if ($DB) {print " VLC Dup Check Rejected: $vlc_dup_check_SKIP_COUNT\n";} } } } 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 cb8587d4..f121002b 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -630,7 +630,8 @@ user_choose_language ENUM('1','0') default '0', ignore_group_on_search ENUM('1','0') default '0', api_list_restrict ENUM('1','0') default '0', api_allowed_functions VARCHAR(1000) default ' ALL_FUNCTIONS ', -lead_filter_id VARCHAR(20) default 'NONE' +lead_filter_id VARCHAR(20) default 'NONE', +admin_cf_show_hidden ENUM('1','0') default '0' ) ENGINE=MyISAM; CREATE UNIQUE INDEX user ON vicidial_users (user); @@ -2525,7 +2526,9 @@ field_cost SMALLINT(5), field_required ENUM('Y','N') default 'N', name_position ENUM('LEFT','TOP') default 'LEFT', multi_position ENUM('HORIZONTAL','VERTICAL') default 'HORIZONTAL', -field_order SMALLINT(5) default '1' +field_order SMALLINT(5) default '1', +field_encrypt ENUM('Y','N') default 'N', +field_show_hide ENUM('DISABLED','X_OUT_ALL','LAST_1','LAST_2','LAST_3','LAST_4','FIRST_1_LAST_4') default 'DISABLED' ) ENGINE=MyISAM; CREATE UNIQUE INDEX listfield on vicidial_lists_fields (list_id, field_label); @@ -3560,4 +3563,4 @@ UPDATE vicidial_configuration set value='1766' where name='qc_database_version'; UPDATE system_settings set vdc_agent_api_active='1'; -UPDATE system_settings SET db_schema_version='1427',db_schema_update_date=NOW(),reload_timestamp=NOW(); +UPDATE system_settings SET db_schema_version='1428',db_schema_update_date=NOW(),reload_timestamp=NOW(); diff --git a/agc_2-X/trunk/extras/upgrade_2.12.sql b/agc_2-X/trunk/extras/upgrade_2.12.sql index 02cf8450..c084adec 100644 --- a/agc_2-X/trunk/extras/upgrade_2.12.sql +++ b/agc_2-X/trunk/extras/upgrade_2.12.sql @@ -271,3 +271,10 @@ container_entry MEDIUMTEXT ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci; UPDATE system_settings SET db_schema_version='1427',db_schema_update_date=NOW() where db_schema_version < 1427; + +ALTER TABLE vicidial_lists_fields ADD field_encrypt ENUM('Y','N') default 'N'; +ALTER TABLE vicidial_lists_fields ADD field_show_hide ENUM('DISABLED','X_OUT_ALL','LAST_1','LAST_2','LAST_3','LAST_4','FIRST_1_LAST_4') default 'DISABLED'; + +ALTER TABLE vicidial_users ADD admin_cf_show_hidden ENUM('1','0') default '0'; + +UPDATE system_settings SET db_schema_version='1428',db_schema_update_date=NOW() where db_schema_version < 1428; diff --git a/agc_2-X/trunk/www/agc/functions.php b/agc_2-X/trunk/www/agc/functions.php index 07b1b8f2..3dd2c800 100644 --- a/agc_2-X/trunk/www/agc/functions.php +++ b/agc_2-X/trunk/www/agc/functions.php @@ -224,7 +224,7 @@ function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$retur ##### END validate user login credentials, check for failed lock out ##### -##### BEGIN gather values for display of custom list fields for a lead ##### +##### BEGIN custom_list_fields_values - gather values for display of custom list fields for a lead ##### function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) { $STARTtime = date("U"); @@ -894,7 +894,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) return $CFoutput; } -##### END gather values for display of custom list fields for a lead ##### +##### END custom_list_fields_values - gather values for display of custom list fields for a lead ##### diff --git a/agc_2-X/trunk/www/agc/images/encrypt.gif b/agc_2-X/trunk/www/agc/images/encrypt.gif new file mode 100644 index 00000000..29cf8397 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/encrypt.gif differ diff --git a/agc_2-X/trunk/www/agc/update_cf_ivr.php b/agc_2-X/trunk/www/agc/update_cf_ivr.php new file mode 100644 index 00000000..ad8d42ba --- /dev/null +++ b/agc_2-X/trunk/www/agc/update_cf_ivr.php @@ -0,0 +1,191 @@ + LICENSE: AGPLv2 +# +# This script is part of the API group and any modifications of data are +# logged to the vicidial_api_log table. +# +# This script is used by park call IVR AGI scripts to alter custom field data +# +# CHANGES +# 150814-1441 - First Build +# + +$api_script = 'update_cf_ivr'; + +header ("Content-type: text/html; charset=utf-8"); + +require_once("dbconnect_mysqli.php"); +require_once("functions.php"); + +$filedate = date("Ymd"); +$filetime = date("H:i:s"); +$IP = getenv ("REMOTE_ADDR"); +$BR = getenv ("HTTP_USER_AGENT"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["caller_id"])) {$caller_id=$_GET["caller_id"];} + elseif (isset($_POST["caller_id"])) {$caller_id=$_POST["caller_id"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["field"])) {$field=$_GET["field"];} + elseif (isset($_POST["field"])) {$field=$_POST["field"];} +if (isset($_GET["value"])) {$value=$_GET["value"];} + elseif (isset($_POST["value"])) {$value=$_POST["value"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["log_to_file"])) {$log_to_file=$_GET["log_to_file"];} + elseif (isset($_POST["log_to_file"])) {$log_to_file=$_POST["log_to_file"];} + + +#$DB = '1'; # DEBUG override +$US = '_'; +$TD = '---'; +$STARTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$sale_status = "$TD$sale_status$TD"; +$search_value=''; +$match_found=0; +$k=0; + +$user=preg_replace("/\'|\"|\\\\|;| /","",$user); +$pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); + +############################################# +##### START SYSTEM_SETTINGS AND USER LANGUAGE LOOKUP ##### +$VUselected_language = ''; +$stmt="SELECT selected_language from vicidial_users where user='$user';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} +$sl_ct = mysqli_num_rows($rslt); +if ($sl_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $VUselected_language = $row[0]; + } + +$stmt = "SELECT use_non_latin,enable_languages,language_method,active_modules FROM system_settings;"; +$rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02001',$user,$server_ip,$session_name,$one_mysql_log);} +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysqli_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $non_latin = $row[0]; + $SSenable_languages = $row[1]; + $SSlanguage_method = $row[2]; + $active_modules = $row[3]; + } +##### END SETTINGS LOOKUP ##### +########################################### + +if ($non_latin < 1) + { + $user=preg_replace("/[^-_0-9a-zA-Z]/","",$user); + } + +if ($DB>0) {echo "$lead_id|$caller_id|$list_id|$field|$value|$user|$DB|$log_to_file|\n";} + + +$PADlead_id = sprintf("%010s", $lead_id); +if ( (strlen($caller_id) > 15) and (preg_match("/$PADlead_id$/",$caller_id)) ) + { + $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); + + $stmt="SELECT count(*) from vicidial_auto_calls where callerid='$caller_id' and last_update_time > \"$four_hours_ago\";"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $authlive=$row[0]; + if ($authlive < 1) + { + echo _QXZ("Call Not Found:")." 2|$user|$caller_id|$authlive|\n"; + exit; + } + } +else + { + echo _QXZ("Invalid Call ID:")." 1|$user|$caller_id|$PADlead_id|\n"; + exit; + } + +if ( (strlen($field) > 0) and (strlen($value) > 0) and ($list_id > 0) ) + { + $enc_field=''; + $stmt = "SELECT field_encrypt from vicidial_lists_fields where field_label='$field' and list_id='$list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + if ($enc_field_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $enc_field = $row[0]; + if ( (preg_match("/cf_encrypt/",$active_modules)) and ($enc_field == 'Y') ) + { + $valueENC = base64_encode($value); + exec("./aes.pl --encrypt --text=$valueENC", $field_enc); + $field_enc_ct = count($field_enc); + $k=0; + while ($field_enc_ct > $k) + { + $field_enc_all .= $field_enc[$k]; + $k++; + } + $value = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); + } + + $lead_cf_count=0; + $stmt = "SELECT count(*) from custom_$list_id where lead_id=$lead_id;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cfield_ct = mysqli_num_rows($rslt); + if ($cfield_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $lead_cf_count = $row[0]; + } + + if ($lead_cf_count > 0) + {$stmt="UPDATE custom_$list_id set $field='$value' where lead_id=$lead_id;"; $updatetype='updated';} + else + {$stmt="INSERT INTO custom_$list_id set $field='$value', lead_id=$lead_id;"; $updatetype='inserted';} + if ($DB) {echo "$stmt\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $affected_rows = mysqli_affected_rows($link); + + $SQL_log = "$stmt|$stmtB|$CBaffected_rows|"; + $SQL_log = preg_replace('/;/','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_api_log set user='$user',agent_user='$user',function='update_cf',value='$field',result='$affected_rows',result_reason='$lead_id',source='vdc',data='$SQL_log',api_date='$NOW_TIME',api_script='$api_script';"; + $rslt=mysql_to_mysqli($stmt, $link); + + $MESSAGE = _QXZ("DONE: %1s found, %2s CF record %3s",0,'',$field,$affected_rows,$updatetype); + echo "$MESSAGE\n"; + } + else + { + $MESSAGE = _QXZ("DONE: no custom field found %1s",0,'',$field); + echo "$MESSAGE\n"; + } + } +else + { + $MESSAGE = _QXZ("DONE: %1s, %2s or %3s are invalid",0,'',$field,$value,$list_id); + echo "$MESSAGE\n"; + } + +if ($log_to_file > 0) + { + $fp = fopen ("./update_cf.txt", "a"); + fwrite ($fp, "$NOW_TIME|$k|$lead_id|$caller_id|$list_id|$field|$value|$user|XXXX|$DB|$log_to_file|$MESSAGE|\n"); + fclose($fp); + } 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 f1258c96..54d80bad 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -387,10 +387,11 @@ # 150725-1613 - Added entry_date as a variable # 150727-0910 - Added default_language # 150728-1049 - Added option for secondary sorting by vendor_lead_code, Issue #833 +# 150814-1057 - Added compatibility for custom fields data option # -$version = '2.12-282'; -$build = '150728-1049'; +$version = '2.12-283'; +$build = '150814-1057'; $php_script = 'vdc_db_query.php'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=616; @@ -821,7 +822,7 @@ $sip_hangup_cause_dictionary = array( ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,agent_debug_logging,default_language FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,agent_debug_logging,default_language,active_modules FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -844,6 +845,7 @@ if ($qm_conf_ct > 0) $SSlanguage_method = $row[12]; $SSagent_debug_logging = $row[13]; $SSdefault_language = $row[14]; + $active_modules = $row[15]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -7563,6 +7565,35 @@ if ($ACTION == 'VDADcheckINCOMING') $custom_field_names_ct = count($custom_field_names_ARY); $custom_field_names_SQL = $custom_field_names; + if (preg_match("/cf_encrypt/",$active_modules)) + { + $enc_fields=0; + $stmt = "SELECT count(*) from vicidial_lists_fields where field_encrypt='Y' and list_id='$entry_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + if ($enc_field_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $enc_fields = $row[0]; + } + if ($enc_fields > 0) + { + $stmt = "SELECT field_label from vicidial_lists_fields where field_encrypt='Y' and list_id='$entry_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + $r=0; + while ($enc_field_ct > $r) + { + $row=mysqli_fetch_row($rslt); + $encrypt_list .= "$row[0],"; + $r++; + } + $encrypt_list = ",$encrypt_list"; + } + } + ##### BEGIN grab the data from custom table for the lead_id $stmt="SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); @@ -7575,9 +7606,27 @@ if ($ACTION == 'VDADcheckINCOMING') $o=0; while ($custom_field_names_ct > $o) { - $form_field_value = urlencode(trim("$row[$o]")); $field_name_id = $custom_field_names_ARY[$o]; $field_name_tag = "--A--" . $field_name_id . "--B--"; + if ($enc_fields > 0) + { + $field_enc=''; $field_enc_all=''; + if ($DB) {echo "|$column_list|$encrypt_list|\n";} + if ( (preg_match("/,$field_name_id,/",$encrypt_list)) and (strlen($row[$o]) > 0) ) + { + exec("../agc/aes.pl --decrypt --text=$row[$o]", $field_enc); + $field_enc_ct = count($field_enc); + $k=0; + while ($field_enc_ct > $k) + { + $field_enc_all .= $field_enc[$k]; + $k++; + } + $field_enc_all = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); + $row[$o] = base64_decode($field_enc_all); + } + } + $form_field_value = urlencode(trim("$row[$o]")); $VDCL_start_call_url = preg_replace("/$field_name_tag/i","$form_field_value",$VDCL_start_call_url); $o++; } @@ -8549,6 +8598,35 @@ if ($ACTION == 'VDADcheckINCOMINGemail') $custom_field_names_ct = count($custom_field_names_ARY); $custom_field_names_SQL = $custom_field_names; + if (preg_match("/cf_encrypt/",$active_modules)) + { + $enc_fields=0; + $stmt = "SELECT count(*) from vicidial_lists_fields where field_encrypt='Y' and list_id='$entry_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + if ($enc_field_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $enc_fields = $row[0]; + } + if ($enc_fields > 0) + { + $stmt = "SELECT field_label from vicidial_lists_fields where field_encrypt='Y' and list_id='$entry_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + $r=0; + while ($enc_field_ct > $r) + { + $row=mysqli_fetch_row($rslt); + $encrypt_list .= "$row[0],"; + $r++; + } + $encrypt_list = ",$encrypt_list"; + } + } + ##### BEGIN grab the data from custom table for the lead_id $stmt="SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); @@ -8561,9 +8639,27 @@ if ($ACTION == 'VDADcheckINCOMINGemail') $o=0; while ($custom_field_names_ct > $o) { - $form_field_value = urlencode(trim("$row[$o]")); $field_name_id = $custom_field_names_ARY[$o]; $field_name_tag = "--A--" . $field_name_id . "--B--"; + if ($enc_fields > 0) + { + $field_enc=''; $field_enc_all=''; + if ($DB) {echo "|$column_list|$encrypt_list|\n";} + if ( (preg_match("/,$field_name_id,/",$encrypt_list)) and (strlen($row[$o]) > 0) ) + { + exec("../agc/aes.pl --decrypt --text=$row[$o]", $field_enc); + $field_enc_ct = count($field_enc); + $k=0; + while ($field_enc_ct > $k) + { + $field_enc_all .= $field_enc[$k]; + $k++; + } + $field_enc_all = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); + $row[$o] = base64_decode($field_enc_all); + } + } + $form_field_value = urlencode(trim("$row[$o]")); $VDCL_start_call_url = preg_replace("/$field_name_tag/i","$form_field_value",$VDCL_start_call_url); $o++; } @@ -10973,6 +11069,36 @@ if ($ACTION == 'updateDISPO') $custom_field_names_ct = count($custom_field_names_ARY); $custom_field_names_SQL = $custom_field_names; + if (preg_match("/cf_encrypt/",$active_modules)) + { + $enc_fields=0; + $stmt = "SELECT count(*) from vicidial_lists_fields where field_encrypt='Y' and list_id='$entry_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + if ($enc_field_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $enc_fields = $row[0]; + } + if ($enc_fields > 0) + { + $stmt = "SELECT field_label from vicidial_lists_fields where field_encrypt='Y' and list_id='$entry_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + $r=0; + while ($enc_field_ct > $r) + { + $row=mysqli_fetch_row($rslt); + $encrypt_list .= "$row[0],"; + $r++; + } + $encrypt_list = ",$encrypt_list"; + } + } + + ##### BEGIN grab the data from custom table for the lead_id $stmt="SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); @@ -10985,9 +11111,27 @@ if ($ACTION == 'updateDISPO') $o=0; while ($custom_field_names_ct > $o) { - $form_field_value = urlencode(trim("$row[$o]")); $field_name_id = $custom_field_names_ARY[$o]; $field_name_tag = "--A--" . $field_name_id . "--B--"; + if ($enc_fields > 0) + { + $field_enc=''; $field_enc_all=''; + if ($DB) {echo "|$column_list|$encrypt_list|\n";} + if ( (preg_match("/,$field_name_id,/",$encrypt_list)) and (strlen($row[$o]) > 0) ) + { + exec("../agc/aes.pl --decrypt --text=$row[$o]", $field_enc); + $field_enc_ct = count($field_enc); + $k=0; + while ($field_enc_ct > $k) + { + $field_enc_all .= $field_enc[$k]; + $k++; + } + $field_enc_all = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); + $row[$o] = base64_decode($field_enc_all); + } + } + $form_field_value = urlencode(trim("$row[$o]")); $dispo_call_urlARY[$j] = preg_replace("/$field_name_tag/i","$form_field_value",$dispo_call_urlARY[$j]); $o++; } @@ -13622,6 +13766,22 @@ if ($ACTION == 'LEADINFOview') $A_field_name[$o] = $rowx[0]; $o++; } + ### gather encrypt and hide settings for custom fields + $o=0; + while ($fields_to_print > $o) + { + $stmt="SELECT field_encrypt,field_show_hide FROM vicidial_lists_fields where list_id='$entry_list_id' and field_label='$A_field_name[$o]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + $fieldset_to_print = mysqli_num_rows($rslt); + if ($fieldset_to_print > 0) + { + $rowx=mysqli_fetch_row($rslt); + $A_field_encrypt[$o] = $rowx[0]; + $A_field_show_hide[$o] = $rowx[1]; + } + $o++; + } $select_SQL = preg_replace("/.$/",'',$select_SQL); if (strlen($select_SQL) > 0) { @@ -13637,6 +13797,16 @@ if ($ACTION == 'LEADINFOview') while ($fields_to_print > $o) { $A_field_value = trim("$row[$o]"); + if ($A_field_encrypt[$o] == 'Y') + {$A_field_value = _QXZ("ENCRYPTED");} + else + { + if ($A_field_show_hide[$o] != 'DISABLED') + { + $field_temp_val = $A_field_value; + $A_field_value = preg_replace("/./",'X',$field_temp_val); + } + } $INFOout .= "$A_field_name[$o]:   $A_field_value"; diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index 07eeced9..8ef25d6d 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -496,10 +496,11 @@ # 150723-1741 - Created method for logging agent button/link clicks # 150725-1744 - Added Agent Display Fields campaign option # 150727-0908 - Added default_language +# 150808-1439 - Added compatibility for custom fields data option # -$version = '2.12-468c'; -$build = '150727-0908'; +$version = '2.12-469c'; +$build = '150808-1439'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=85; $one_mysql_log=0; @@ -596,7 +597,7 @@ if ($sl_ct > 0) ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled,pllb_grouping_limit,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,enable_third_webform,default_language FROM system_settings;"; +$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled,pllb_grouping_limit,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,enable_third_webform,default_language,active_modules FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -627,6 +628,7 @@ if ($qm_conf_ct > 0) $meetme_enter_leave3way_filename = $row[20]; $enable_third_webform = $row[21]; $default_language = $row[22]; + $active_modules = $row[23]; } else { @@ -731,7 +733,9 @@ if (strlen($static_agent_url) > 5) {$agcPAGE = $static_agent_url;} if (strlen($VUselected_language) < 1) {$VUselected_language = $default_language;} - +$vdc_form_display = 'vdc_form_display.php'; +if (preg_match("/cf_encrypt/",$active_modules)) + {$vdc_form_display = 'vdc_form_display_encrypt.php';} header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 @@ -14353,7 +14357,7 @@ function phone_number_format(formatphone) { 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' + "&campaign=" + campaign + "&phone_login=" + phone_login + "&original_phone_login=" + original_phone_login +"&phone_pass=" + phone_pass + "&fronter=" + fronter + "&closer=" + user + "&group=" + group + "&channel_group=" + group + "&SQLdate=" + SQLdate + "&epoch=" + UnixTime + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&customer_zap_channel=" + lastcustchannel + "&customer_server_ip=" + lastcustserverip +"&server_ip=" + server_ip + "&SIPexten=" + extension + "&session_id=" + session_id + "&phone=" + document.vicidial_form.phone_number.value + "&parked_by=" + document.vicidial_form.lead_id.value +"&dispo=" + LeaDDispO + '' +"&dialed_number=" + dialed_number + '' +"&dialed_label=" + dialed_label + '' +"&camp_script=" + campaign_script + '' +"&in_script=" + CalL_ScripT_id + '' +"&script_width=" + script_width + '' +"&script_height=" + script_height + '' +"&fullname=" + LOGfullname + '' +"&agent_email=" + LOGemail + '' +"&recording_filename=" + recording_filename + '' +"&recording_id=" + recording_id + '' +"&user_custom_one=" + VU_custom_one + '' +"&user_custom_two=" + VU_custom_two + '' +"&user_custom_three=" + VU_custom_three + '' +"&user_custom_four=" + VU_custom_four + '' +"&user_custom_five=" + VU_custom_five + '' +"&preset_number_a=" + CalL_XC_a_NuMber + '' +"&preset_number_b=" + CalL_XC_b_NuMber + '' +"&preset_number_c=" + CalL_XC_c_NuMber + '' +"&preset_number_d=" + CalL_XC_d_NuMber + '' +"&preset_number_e=" + CalL_XC_e_NuMber + '' +"&preset_dtmf_a=" + CalL_XC_a_Dtmf + '' +"&preset_dtmf_b=" + CalL_XC_b_Dtmf + '' +"&did_id=" + did_id + '' +"&did_extension=" + did_extension + '' +"&did_pattern=" + did_pattern + '' +"&did_description=" + did_description + '' +"&closecallid=" + closecallid + '' +"&xfercallid=" + xfercallid + '' + "&agent_log_id=" + agent_log_id + "&call_id=" + LasTCID + "&user_group=" + VU_user_group + "&called_count=" + document.vicidial_form.called_count.value + '' +"&web_vars=" + LIVE_web_vars + ''; + document.getElementById('vcFormIFrame').src='./?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' + "&campaign=" + campaign + "&phone_login=" + phone_login + "&original_phone_login=" + original_phone_login +"&phone_pass=" + phone_pass + "&fronter=" + fronter + "&closer=" + user + "&group=" + group + "&channel_group=" + group + "&SQLdate=" + SQLdate + "&epoch=" + UnixTime + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&customer_zap_channel=" + lastcustchannel + "&customer_server_ip=" + lastcustserverip +"&server_ip=" + server_ip + "&SIPexten=" + extension + "&session_id=" + session_id + "&phone=" + document.vicidial_form.phone_number.value + "&parked_by=" + document.vicidial_form.lead_id.value +"&dispo=" + LeaDDispO + '' +"&dialed_number=" + dialed_number + '' +"&dialed_label=" + dialed_label + '' +"&camp_script=" + campaign_script + '' +"&in_script=" + CalL_ScripT_id + '' +"&script_width=" + script_width + '' +"&script_height=" + script_height + '' +"&fullname=" + LOGfullname + '' +"&agent_email=" + LOGemail + '' +"&recording_filename=" + recording_filename + '' +"&recording_id=" + recording_id + '' +"&user_custom_one=" + VU_custom_one + '' +"&user_custom_two=" + VU_custom_two + '' +"&user_custom_three=" + VU_custom_three + '' +"&user_custom_four=" + VU_custom_four + '' +"&user_custom_five=" + VU_custom_five + '' +"&preset_number_a=" + CalL_XC_a_NuMber + '' +"&preset_number_b=" + CalL_XC_b_NuMber + '' +"&preset_number_c=" + CalL_XC_c_NuMber + '' +"&preset_number_d=" + CalL_XC_d_NuMber + '' +"&preset_number_e=" + CalL_XC_e_NuMber + '' +"&preset_dtmf_a=" + CalL_XC_a_Dtmf + '' +"&preset_dtmf_b=" + CalL_XC_b_Dtmf + '' +"&did_id=" + did_id + '' +"&did_extension=" + did_extension + '' +"&did_pattern=" + did_pattern + '' +"&did_description=" + did_description + '' +"&closecallid=" + closecallid + '' +"&xfercallid=" + xfercallid + '' + "&agent_log_id=" + agent_log_id + "&call_id=" + LasTCID + "&user_group=" + VU_user_group + "&called_count=" + document.vicidial_form.called_count.value + '' +"&web_vars=" + LIVE_web_vars + ''; form_list_id = ''; form_entry_list_id = ''; } diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 54198739..afe6d432 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -1759,6 +1759,8 @@ if (isset($_GET["group_handling"])) {$group_handling=$_GET["group_handling"];} elseif (isset($_POST["group_handling"])) {$group_handling=$_POST["group_handling"];} if (isset($_GET["agentcall_email"])) {$agentcall_email=$_GET["agentcall_email"];} elseif (isset($_POST["agentcall_email"])) {$agentcall_email=$_POST["agentcall_email"];} +if (isset($_GET["agentcall_chat"])) {$agentcall_chat=$_GET["agentcall_chat"];} + elseif (isset($_POST["agentcall_chat"])) {$agentcall_chat=$_POST["agentcall_chat"];} if (isset($_GET["modify_email_accounts"])) {$modify_email_accounts=$_GET["modify_email_accounts"];} elseif (isset($_POST["modify_email_accounts"])) {$modify_email_accounts=$_POST["modify_email_accounts"];} if (isset($_GET["safe_harbor_audio_field"])) {$safe_harbor_audio_field=$_GET["safe_harbor_audio_field"];} @@ -1971,6 +1973,8 @@ if (isset($_GET["container_type"])) {$container_type=$_GET["container_type"]; elseif (isset($_POST["container_type"])) {$container_type=$_POST["container_type"];} if (isset($_GET["container_entry"])) {$container_entry=$_GET["container_entry"];} elseif (isset($_POST["container_entry"])) {$container_entry=$_POST["container_entry"];} +if (isset($_GET["admin_cf_show_hidden"])) {$admin_cf_show_hidden=$_GET["admin_cf_show_hidden"];} + elseif (isset($_POST["admin_cf_show_hidden"])) {$admin_cf_show_hidden=$_POST["admin_cf_show_hidden"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} @@ -2326,6 +2330,8 @@ if ($non_latin < 1) $api_list_restrict = preg_replace('/[^0-9]/','',$api_list_restrict); $customer_gone_seconds = preg_replace('/[^0-9]/','',$customer_gone_seconds); $agent_whisper_enabled = preg_replace('/[^0-9]/','',$agent_whisper_enabled); + $admin_cf_show_hidden = preg_replace('/[^0-9]/','',$admin_cf_show_hidden); + $agentcall_chat = preg_replace('/[^0-9]/','',$agentcall_chat); $drop_call_seconds = preg_replace('/[^-0-9]/','',$drop_call_seconds); $timer_alt_seconds = preg_replace('/[^-0-9]/','',$timer_alt_seconds); @@ -3577,12 +3583,13 @@ else # 150804-1107 - Added agent_whisper_enabled system settings option # 150804-1608 - Added inbound group _lead_reset options # 150806-1348 - Added Admin -> Settings Containers +# 150903-1457 - Added options for encrypt hosted features # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time -$admin_version = '2.12-505a'; -$build = '150806-1348'; +$admin_version = '2.12-506a'; +$build = '150903-1457'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -3741,6 +3748,9 @@ else exit; } +$admin_lists_custom = 'admin_lists_custom.php'; +if (preg_match("/cf_encrypt/",$SSactive_modules)) + {$admin_lists_custom = 'admin_lists_custom_encrypt.php';} ############################################## # Include QC Agents with no other permission # @@ -8136,7 +8146,7 @@ if ($ADD=="2A") $pass=''; } - $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,voicemail_id,agent_call_log_view_override,callcard_admin,agent_choose_blended,realtime_block_user_info,custom_fields_modify,force_change_password,agent_lead_search_override,modify_shifts,modify_phones,modify_carriers,modify_labels,modify_statuses,modify_voicemail,modify_audiostore,modify_moh,modify_tts,preset_contact_search,modify_contacts,modify_same_user_level,admin_hide_lead_data,admin_hide_phone_data,agentcall_email,modify_email_accounts,pass_hash,alter_admin_interface_options,max_inbound_calls,modify_custom_dialplans,wrapup_seconds_override,modify_languages,selected_language,user_choose_language,ignore_group_on_search,lead_filter_id) SELECT \"$user\",\"$pass\",\"$full_name\",user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,voicemail_id,agent_call_log_view_override,callcard_admin,agent_choose_blended,realtime_block_user_info,custom_fields_modify,force_change_password,agent_lead_search_override,modify_shifts,modify_phones,modify_carriers,modify_labels,modify_statuses,modify_voicemail,modify_audiostore,modify_moh,modify_tts,preset_contact_search,modify_contacts,modify_same_user_level,admin_hide_lead_data,admin_hide_phone_data,agentcall_email,modify_email_accounts,\"$pass_hash\",alter_admin_interface_options,max_inbound_calls,modify_custom_dialplans,wrapup_seconds_override,modify_languages,selected_language,user_choose_language,ignore_group_on_search,lead_filter_id from vicidial_users where user=\"$source_user_id\";"; + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,voicemail_id,agent_call_log_view_override,callcard_admin,agent_choose_blended,realtime_block_user_info,custom_fields_modify,force_change_password,agent_lead_search_override,modify_shifts,modify_phones,modify_carriers,modify_labels,modify_statuses,modify_voicemail,modify_audiostore,modify_moh,modify_tts,preset_contact_search,modify_contacts,modify_same_user_level,admin_hide_lead_data,admin_hide_phone_data,agentcall_email,agentcall_chat,modify_email_accounts,pass_hash,alter_admin_interface_options,max_inbound_calls,modify_custom_dialplans,wrapup_seconds_override,modify_languages,selected_language,user_choose_language,ignore_group_on_search,api_list_restrict,api_allowed_functions,lead_filter_id,admin_cf_show_hidden) SELECT \"$user\",\"$pass\",\"$full_name\",user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,voicemail_id,agent_call_log_view_override,callcard_admin,agent_choose_blended,realtime_block_user_info,custom_fields_modify,force_change_password,agent_lead_search_override,modify_shifts,modify_phones,modify_carriers,modify_labels,modify_statuses,modify_voicemail,modify_audiostore,modify_moh,modify_tts,preset_contact_search,modify_contacts,modify_same_user_level,admin_hide_lead_data,admin_hide_phone_data,agentcall_email,agentcall_chat,modify_email_accounts,\"$pass_hash\",alter_admin_interface_options,max_inbound_calls,modify_custom_dialplans,wrapup_seconds_override,modify_languages,selected_language,user_choose_language,ignore_group_on_search,api_list_restrict,api_allowed_functions,lead_filter_id,admin_cf_show_hidden from vicidial_users where user=\"$source_user_id\";"; $rslt=mysql_to_mysqli($stmt, $link); $stmtA="INSERT INTO vicidial_inbound_group_agents (user,group_id,group_rank,group_weight,calls_today,group_type) SELECT \"$user\",group_id,group_rank,group_weight,\"0\",group_type from vicidial_inbound_group_agents where user=\"$source_user_id\";"; @@ -11463,7 +11473,7 @@ if ($ADD=="4A") echo "
"._QXZ("USER MODIFIED - ADMIN").": $user\n"; - $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',delete_users='$delete_users',delete_user_groups='$delete_user_groups',delete_lists='$delete_lists',delete_campaigns='$delete_campaigns',delete_ingroups='$delete_ingroups',delete_remote_agents='$delete_remote_agents',load_leads='$load_leads',campaign_detail='$campaign_detail',ast_admin_access='$ast_admin_access',ast_delete_phones='$ast_delete_phones',delete_scripts='$delete_scripts',modify_leads='$modify_leads',hotkeys_active='$hotkeys_active',change_agent_campaign='$change_agent_campaign',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',delete_filters='$delete_filters',alter_agent_interface_options='$alter_agent_interface_options',closer_default_blended='$closer_default_blended',delete_call_times='$delete_call_times',modify_call_times='$modify_call_times',modify_users='$modify_users',modify_campaigns='$modify_campaigns',modify_lists='$modify_lists',modify_scripts='$modify_scripts',modify_filters='$modify_filters',modify_ingroups='$modify_ingroups',modify_usergroups='$modify_usergroups',modify_remoteagents='$modify_remoteagents',modify_servers='$modify_servers',view_reports='$view_reports',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override',qc_enabled='$qc_enabled',qc_user_level='$qc_user_level',qc_pass='$qc_pass',qc_finish='$qc_finish',qc_commit='$qc_commit',add_timeclock_log='$add_timeclock_log',modify_timeclock_log='$modify_timeclock_log',delete_timeclock_log='$delete_timeclock_log',alter_custphone_override='$alter_custphone_override',vdc_agent_api_access='$vdc_agent_api_access',modify_inbound_dids='$modify_inbound_dids',delete_inbound_dids='$delete_inbound_dids',active='$active',download_lists='$download_lists',agent_shift_enforcement_override='$agent_shift_enforcement_override',manager_shift_enforcement_override='$manager_shift_enforcement_override',export_reports='$export_reports',delete_from_dnc='$delete_from_dnc',email='$email',user_code='$user_code',territory='$territory',allow_alerts='$allow_alerts',agent_choose_territories='$agent_choose_territories',custom_one='$custom_one',custom_two='$custom_two',custom_three='$custom_three',custom_four='$custom_four',custom_five='$custom_five',voicemail_id='$voicemail_id',agent_call_log_view_override='$agent_call_log_view_override',callcard_admin='$callcard_admin',agent_choose_blended='$agent_choose_blended',realtime_block_user_info='$realtime_block_user_info',custom_fields_modify='$custom_fields_modify',force_change_password='$force_change_password',agent_lead_search_override='$agent_lead_search',modify_shifts='$modify_shifts',modify_phones='$modify_phones',modify_carriers='$modify_carriers',modify_labels='$modify_labels',modify_statuses='$modify_statuses',modify_voicemail='$modify_voicemail',modify_audiostore='$modify_audiostore',modify_moh='$modify_moh',modify_tts='$modify_tts',preset_contact_search='$preset_contact_search',modify_contacts='$modify_contacts',modify_same_user_level='$modify_same_user_level',admin_hide_lead_data='$admin_hide_lead_data',admin_hide_phone_data='$admin_hide_phone_data',agentcall_email='$agentcall_email',modify_email_accounts='$modify_email_accounts',failed_login_count=0,alter_admin_interface_options='$alter_admin_interface_options',max_inbound_calls='$max_inbound_calls',modify_custom_dialplans='$modify_custom_dialplans',wrapup_seconds_override='$wrapup_seconds_override',modify_languages='$modify_languages',selected_language='$selected_language',user_choose_language='$user_choose_language',ignore_group_on_search='$ignore_group_on_search',api_list_restrict='$api_list_restrict',api_allowed_functions='$api_allowed_functions',lead_filter_id='$lead_filter_id' $pass_hashSQL where user='$user' $LOGadmin_viewable_groupsSQL;"; + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',delete_users='$delete_users',delete_user_groups='$delete_user_groups',delete_lists='$delete_lists',delete_campaigns='$delete_campaigns',delete_ingroups='$delete_ingroups',delete_remote_agents='$delete_remote_agents',load_leads='$load_leads',campaign_detail='$campaign_detail',ast_admin_access='$ast_admin_access',ast_delete_phones='$ast_delete_phones',delete_scripts='$delete_scripts',modify_leads='$modify_leads',hotkeys_active='$hotkeys_active',change_agent_campaign='$change_agent_campaign',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',delete_filters='$delete_filters',alter_agent_interface_options='$alter_agent_interface_options',closer_default_blended='$closer_default_blended',delete_call_times='$delete_call_times',modify_call_times='$modify_call_times',modify_users='$modify_users',modify_campaigns='$modify_campaigns',modify_lists='$modify_lists',modify_scripts='$modify_scripts',modify_filters='$modify_filters',modify_ingroups='$modify_ingroups',modify_usergroups='$modify_usergroups',modify_remoteagents='$modify_remoteagents',modify_servers='$modify_servers',view_reports='$view_reports',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override',qc_enabled='$qc_enabled',qc_user_level='$qc_user_level',qc_pass='$qc_pass',qc_finish='$qc_finish',qc_commit='$qc_commit',add_timeclock_log='$add_timeclock_log',modify_timeclock_log='$modify_timeclock_log',delete_timeclock_log='$delete_timeclock_log',alter_custphone_override='$alter_custphone_override',vdc_agent_api_access='$vdc_agent_api_access',modify_inbound_dids='$modify_inbound_dids',delete_inbound_dids='$delete_inbound_dids',active='$active',download_lists='$download_lists',agent_shift_enforcement_override='$agent_shift_enforcement_override',manager_shift_enforcement_override='$manager_shift_enforcement_override',export_reports='$export_reports',delete_from_dnc='$delete_from_dnc',email='$email',user_code='$user_code',territory='$territory',allow_alerts='$allow_alerts',agent_choose_territories='$agent_choose_territories',custom_one='$custom_one',custom_two='$custom_two',custom_three='$custom_three',custom_four='$custom_four',custom_five='$custom_five',voicemail_id='$voicemail_id',agent_call_log_view_override='$agent_call_log_view_override',callcard_admin='$callcard_admin',agent_choose_blended='$agent_choose_blended',realtime_block_user_info='$realtime_block_user_info',custom_fields_modify='$custom_fields_modify',force_change_password='$force_change_password',agent_lead_search_override='$agent_lead_search',modify_shifts='$modify_shifts',modify_phones='$modify_phones',modify_carriers='$modify_carriers',modify_labels='$modify_labels',modify_statuses='$modify_statuses',modify_voicemail='$modify_voicemail',modify_audiostore='$modify_audiostore',modify_moh='$modify_moh',modify_tts='$modify_tts',preset_contact_search='$preset_contact_search',modify_contacts='$modify_contacts',modify_same_user_level='$modify_same_user_level',admin_hide_lead_data='$admin_hide_lead_data',admin_hide_phone_data='$admin_hide_phone_data',agentcall_email='$agentcall_email',agentcall_chat='$agentcall_chat',modify_email_accounts='$modify_email_accounts',failed_login_count=0,alter_admin_interface_options='$alter_admin_interface_options',max_inbound_calls='$max_inbound_calls',modify_custom_dialplans='$modify_custom_dialplans',wrapup_seconds_override='$wrapup_seconds_override',modify_languages='$modify_languages',selected_language='$selected_language',user_choose_language='$user_choose_language',ignore_group_on_search='$ignore_group_on_search',api_list_restrict='$api_list_restrict',api_allowed_functions='$api_allowed_functions',lead_filter_id='$lead_filter_id',admin_cf_show_hidden='$admin_cf_show_hidden' $pass_hashSQL where user='$user' $LOGadmin_viewable_groupsSQL;"; $rslt=mysql_to_mysqli($stmt, $link); ### LOG INSERTION Admin Log Table ### @@ -18094,7 +18104,7 @@ if ($ADD==3) echo "\n"; + if (preg_match("/cf_encrypt/",$SSactive_modules)) + {echo "\n";} + else + {echo "\n";} + if ( ( ($LOGmodify_same_user_level > 0) or ($LOGalter_admin_interface > 0) ) and ($LOGuser_level > 8) ) { echo "\n"; @@ -21723,7 +21740,7 @@ if ($ADD==34) {$fSQL = '';} $camp_lists = preg_replace('/.$/i','',$camp_lists);; - echo "This campaign has $active_lists active lists and $inactive_lists inactive lists

\n"; + echo _QXZ("This campaign has")." $active_lists "._QXZ("active lists and")." $inactive_lists "._QXZ("inactive lists")."

\n"; if ( ($display_leads_count == 'Y') and (strlen($camp_lists) > 3) ) @@ -23526,7 +23543,7 @@ if ($ADD==311) $rslt=mysql_to_mysqli($stmt, $link); $rowx=mysqli_fetch_row($rslt); - echo "

"._QXZ("Custom fields defined for this list").": $rowx[0]
\n"; + echo "

"._QXZ("Custom fields defined for this list").": $rowx[0]
\n"; } echo "

"._QXZ("Click here to see all CallBack Holds in this list")."
\n"; @@ -33574,7 +33591,7 @@ if ($ADD==700000000000000) if (preg_match('/USER|AGENT/i', $row[4])) {$record_link = "$PHP_SELF?ADD=3&user=$row[6]";} if (preg_match('/CAMPAIGN/i', $row[4])) {$record_link = "$PHP_SELF?ADD=31&campaign_id=$row[6]";} if (preg_match('/LIST/i', $row[4])) {$record_link = "$PHP_SELF?ADD=311&list_id=$row[6]";} - if (preg_match('/CUSTOM_FIELDS/i', $row[4])) {$record_link = "./admin_lists_custom.php?action=MODIFY_CUSTOM_FIELDS&list_id=$row[6]";} + if (preg_match('/CUSTOM_FIELDS/i', $row[4])) {$record_link = "./$admin_lists_custom?action=MODIFY_CUSTOM_FIELDS&list_id=$row[6]";} if (preg_match('/SCRIPT/i', $row[4])) {$record_link = "$PHP_SELF?ADD=3111111&script_id=$row[6]";} if (preg_match('/FILTER/i', $row[4])) {$record_link = "$PHP_SELF?ADD=31111111&lead_filter_id=$row[6]";} if (preg_match('/INGROUP/i', $row[4])) {$record_link = "$PHP_SELF?ADD=3111&group_id=$row[6]";} @@ -33662,7 +33679,7 @@ if ($ADD==710000000000000) if (preg_match('/USER|AGENT/i', $row[4])) {$record_link = "$PHP_SELF?ADD=3&user=$row[6]";} if (preg_match('/CAMPAIGN/i', $row[4])) {$record_link = "$PHP_SELF?ADD=31&campaign_id=$row[6]";} if (preg_match('/LIST/i', $row[4])) {$record_link = "$PHP_SELF?ADD=311&list_id=$row[6]";} - if (preg_match('/CUSTOM_FIELDS/i', $row[4])) {$record_link = "./admin_lists_custom.php?action=MODIFY_CUSTOM_FIELDS&list_id=$row[6]";} + if (preg_match('/CUSTOM_FIELDS/i', $row[4])) {$record_link = "./$admin_lists_custom?action=MODIFY_CUSTOM_FIELDS&list_id=$row[6]";} if (preg_match('/SCRIPT/i', $row[4])) {$record_link = "$PHP_SELF?ADD=3111111&script_id=$row[6]";} if (preg_match('/FILTER/i', $row[4])) {$record_link = "$PHP_SELF?ADD=31111111&lead_filter_id=$row[6]";} if (preg_match('/INGROUP/i', $row[4])) {$record_link = "$PHP_SELF?ADD=3111&group_id=$row[6]";} @@ -33749,7 +33766,7 @@ if ($ADD==720000000000000) if (preg_match('/USER|AGENT/i', $row[4])) {$record_link = "$PHP_SELF?ADD=3&user=$row[6]";} if (preg_match('/CAMPAIGN/i', $row[4])) {$record_link = "$PHP_SELF?ADD=31&campaign_id=$row[6]";} if (preg_match('/LIST/i', $row[4])) {$record_link = "$PHP_SELF?ADD=311&list_id=$row[6]";} - if (preg_match('/CUSTOM_FIELDS/i', $row[4])) {$record_link = "./admin_lists_custom.php?action=MODIFY_CUSTOM_FIELDS&list_id=$row[6]";} + if (preg_match('/CUSTOM_FIELDS/i', $row[4])) {$record_link = "./$admin_lists_custom?action=MODIFY_CUSTOM_FIELDS&list_id=$row[6]";} if (preg_match('/SCRIPT/i', $row[4])) {$record_link = "$PHP_SELF?ADD=3111111&script_id=$row[6]";} if (preg_match('/FILTER/i', $row[4])) {$record_link = "$PHP_SELF?ADD=31111111&lead_filter_id=$row[6]";} if (preg_match('/INGROUP/i', $row[4])) {$record_link = "$PHP_SELF?ADD=3111&group_id=$row[6]";} @@ -36549,7 +36566,7 @@ if (isset($camp_lists)) if ($single_status > 0) {return $active_leads;} else - {echo "This campaign has $active_leads leads to be dialed in those lists\n";} + {echo _QXZ("This campaign has")." $active_leads "._QXZ("leads to be dialed in those lists")."\n";} } else { diff --git a/agc_2-X/trunk/www/vicidial/admin_header.php b/agc_2-X/trunk/www/vicidial/admin_header.php index 2c36ed8f..ec1934ea 100644 --- a/agc_2-X/trunk/www/vicidial/admin_header.php +++ b/agc_2-X/trunk/www/vicidial/admin_header.php @@ -52,6 +52,7 @@ # 150227-1614 - Formatting issue #831 # 150307-0915 - Fixes for QXZ # 150806-1023 - Added code for Admin -> Settings Containers +# 150808-2043 - Added compatibility for custom fields data option # @@ -1250,11 +1251,14 @@ $SSenable_languages = $row[7]; 0) { + $admin_lists_custom = 'admin_lists_custom.php'; + if (preg_match("/cf_encrypt/",$SSactive_modules)) + {$admin_lists_custom = 'admin_lists_custom_encrypt.php';} ?> >>\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -1525,7 +1532,7 @@ else $custom_records_count = $rowx[0]; echo ""._QXZ("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 09abc752..50875d37 100644 --- a/agc_2-X/trunk/www/vicidial/call_report_export.php +++ b/agc_2-X/trunk/www/vicidial/call_report_export.php @@ -43,6 +43,7 @@ # 150108-1110 - Fixed issue with inbound and no outbound calls export # 150126-1205 - Fixed issue with Extended and Alt formats # 150727-2143 - Enabled user features for hiding phone numbers and lead data +# 150903-1536 - Added compatibility for custom fields data options # $startMS = microtime(); @@ -96,7 +97,7 @@ $file_exported=0; ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,custom_fields_enabled,enable_languages,language_method FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,custom_fields_enabled,enable_languages,language_method,active_modules FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysqli_num_rows($rslt); @@ -110,6 +111,7 @@ if ($qm_conf_ct > 0) $custom_fields_enabled = $row[4]; $SSenable_languages = $row[5]; $SSlanguage_method = $row[6]; + $active_modules = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -184,13 +186,14 @@ else exit; } -$stmt="SELECT export_reports,user_group,admin_hide_lead_data,admin_hide_phone_data from vicidial_users where user='$PHP_AUTH_USER';"; +$stmt="SELECT export_reports,user_group,admin_hide_lead_data,admin_hide_phone_data,admin_cf_show_hidden from vicidial_users where user='$PHP_AUTH_USER';"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $LOGexport_reports = $row[0]; $LOGuser_group = $row[1]; $LOGadmin_hide_lead_data = $row[2]; $LOGadmin_hide_phone_data = $row[3]; +$LOGadmin_cf_show_hidden = $row[4]; if ($LOGexport_reports < 1) { @@ -956,9 +959,12 @@ if ($run_export > 0) if ($DB>0) {echo "$stmt";} $rslt=mysql_to_mysqli($stmt, $link); $tablecount_to_print = mysqli_num_rows($rslt); - if ($tablecount_to_print > 0) + if ($tablecount_to_print > 0) { - $stmt = "describe custom_$CF_list_id;"; + $column_list=''; + $encrypt_list=''; + $hide_list=''; + $stmt = "DESCRIBE custom_$CF_list_id;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $columns_ct = mysqli_num_rows($rslt); @@ -967,20 +973,103 @@ if ($run_export > 0) { $row=mysqli_fetch_row($rslt); $column = $row[0]; + $column_list .= "$row[0],"; $u++; } if ($columns_ct > 1) { - $stmt = "SELECT * from custom_$CF_list_id where lead_id='$export_lead_id[$i]' limit 1;"; + $column_list = preg_replace("/lead_id,/",'',$column_list); + $column_list = preg_replace("/,$/",'',$column_list); + $column_list_array = explode(',',$column_list); + if (preg_match("/cf_encrypt/",$active_modules)) + { + $enc_fields=0; + $stmt = "SELECT count(*) from vicidial_lists_fields where field_encrypt='Y' and list_id='$CF_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + if ($enc_field_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $enc_fields = $row[0]; + } + if ($enc_fields > 0) + { + $stmt = "SELECT field_label from vicidial_lists_fields where field_encrypt='Y' and list_id='$CF_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + $r=0; + while ($enc_field_ct > $r) + { + $row=mysqli_fetch_row($rslt); + $encrypt_list .= "$row[0],"; + $r++; + } + $encrypt_list = ",$encrypt_list"; + } + if ($LOGadmin_cf_show_hidden < 1) + { + $hide_fields=0; + $stmt = "SELECT count(*) from vicidial_lists_fields where field_show_hide!='DISABLED' and list_id='$CF_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hide_field_ct = mysqli_num_rows($rslt); + if ($hide_field_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $hide_fields = $row[0]; + } + if ($hide_fields > 0) + { + $stmt = "SELECT field_label from vicidial_lists_fields where field_show_hide!='DISABLED' and list_id='$CF_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hide_field_ct = mysqli_num_rows($rslt); + $r=0; + while ($hide_field_ct > $r) + { + $row=mysqli_fetch_row($rslt); + $hide_list .= "$row[0],"; + $r++; + } + $hide_list = ",$hide_list"; + } + } + } + $stmt = "SELECT $column_list from custom_$CF_list_id where lead_id='$export_lead_id[$i]' limit 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $customfield_ct = mysqli_num_rows($rslt); if ($customfield_ct > 0) { $row=mysqli_fetch_row($rslt); - $t=1; - while ($columns_ct > $t) + $t=0; + while ($columns_ct >= $t) { + if ($enc_fields > 0) + { + $field_enc=''; $field_enc_all=''; + if ($DB) {echo "|$column_list|$encrypt_list|\n";} + if ( (preg_match("/,$column_list_array[$t],/",$encrypt_list)) and (strlen($row[$t]) > 0) ) + { + exec("../agc/aes.pl --decrypt --text=$row[$t]", $field_enc); + $field_enc_ct = count($field_enc); + $k=0; + while ($field_enc_ct > $k) + { + $field_enc_all .= $field_enc[$k]; + $k++; + } + $field_enc_all = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); + $row[$t] = base64_decode($field_enc_all); + } + } + if ( (preg_match("/,$column_list_array[$t],/",$hide_list)) and (strlen($row[$t]) > 0) ) + { + $field_temp_val = $row[$t]; + $row[$t] = preg_replace("/./",'X',$field_temp_val); + } $custom_data .= "\t$row[$t]"; $t++; } diff --git a/agc_2-X/trunk/www/vicidial/call_report_export_carrier.php b/agc_2-X/trunk/www/vicidial/call_report_export_carrier.php index 210984fb..94fc91a9 100644 --- a/agc_2-X/trunk/www/vicidial/call_report_export_carrier.php +++ b/agc_2-X/trunk/www/vicidial/call_report_export_carrier.php @@ -14,6 +14,7 @@ # 150126-1208 - Fixed issue with Extended and Alt formats # 150218-1701 - Added cust_sec and cust_queue_sec to EXTENDED output # 150727-2144 - Enabled user features for hiding phone numbers and lead data +# 150903-1537 - Added compatibility for custom fields data options # $startMS = microtime(); @@ -69,7 +70,7 @@ $file_exported=0; ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,custom_fields_enabled,enable_languages,language_method FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,custom_fields_enabled,enable_languages,language_method,active_modules FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysqli_num_rows($rslt); @@ -83,6 +84,7 @@ if ($qm_conf_ct > 0) $custom_fields_enabled = $row[4]; $SSenable_languages = $row[5]; $SSlanguage_method = $row[6]; + $active_modules = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -157,13 +159,14 @@ else exit; } -$stmt="SELECT export_reports,user_group,admin_hide_lead_data,admin_hide_phone_data from vicidial_users where user='$PHP_AUTH_USER';"; +$stmt="SELECT export_reports,user_group,admin_hide_lead_data,admin_hide_phone_data,admin_cf_show_hidden from vicidial_users where user='$PHP_AUTH_USER';"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $LOGexport_reports = $row[0]; $LOGuser_group = $row[1]; $LOGadmin_hide_lead_data = $row[2]; $LOGadmin_hide_phone_data = $row[3]; +$LOGadmin_cf_show_hidden = $row[4]; if ($LOGexport_reports < 1) { @@ -978,7 +981,10 @@ if ($run_export > 0) $tablecount_to_print = mysqli_num_rows($rslt); if ($tablecount_to_print > 0) { - $stmt = "describe custom_$CF_list_id;"; + $column_list=''; + $encrypt_list=''; + $hide_list=''; + $stmt = "DESCRIBE custom_$CF_list_id;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $columns_ct = mysqli_num_rows($rslt); @@ -987,20 +993,103 @@ if ($run_export > 0) { $row=mysqli_fetch_row($rslt); $column = $row[0]; + $column_list .= "$row[0],"; $u++; } if ($columns_ct > 1) { - $stmt = "SELECT * from custom_$CF_list_id where lead_id='$export_lead_id[$i]' limit 1;"; + $column_list = preg_replace("/lead_id,/",'',$column_list); + $column_list = preg_replace("/,$/",'',$column_list); + $column_list_array = explode(',',$column_list); + if (preg_match("/cf_encrypt/",$active_modules)) + { + $enc_fields=0; + $stmt = "SELECT count(*) from vicidial_lists_fields where field_encrypt='Y' and list_id='$CF_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + if ($enc_field_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $enc_fields = $row[0]; + } + if ($enc_fields > 0) + { + $stmt = "SELECT field_label from vicidial_lists_fields where field_encrypt='Y' and list_id='$CF_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + $r=0; + while ($enc_field_ct > $r) + { + $row=mysqli_fetch_row($rslt); + $encrypt_list .= "$row[0],"; + $r++; + } + $encrypt_list = ",$encrypt_list"; + } + if ($LOGadmin_cf_show_hidden < 1) + { + $hide_fields=0; + $stmt = "SELECT count(*) from vicidial_lists_fields where field_show_hide!='DISABLED' and list_id='$CF_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hide_field_ct = mysqli_num_rows($rslt); + if ($hide_field_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $hide_fields = $row[0]; + } + if ($hide_fields > 0) + { + $stmt = "SELECT field_label from vicidial_lists_fields where field_show_hide!='DISABLED' and list_id='$CF_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hide_field_ct = mysqli_num_rows($rslt); + $r=0; + while ($hide_field_ct > $r) + { + $row=mysqli_fetch_row($rslt); + $hide_list .= "$row[0],"; + $r++; + } + $hide_list = ",$hide_list"; + } + } + } + $stmt = "SELECT $column_list from custom_$CF_list_id where lead_id='$export_lead_id[$i]' limit 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $customfield_ct = mysqli_num_rows($rslt); if ($customfield_ct > 0) { $row=mysqli_fetch_row($rslt); - $t=1; - while ($columns_ct > $t) + $t=0; + while ($columns_ct >= $t) { + if ($enc_fields > 0) + { + $field_enc=''; $field_enc_all=''; + if ($DB) {echo "|$column_list|$encrypt_list|\n";} + if ( (preg_match("/,$column_list_array[$t],/",$encrypt_list)) and (strlen($row[$t]) > 0) ) + { + exec("../agc/aes.pl --decrypt --text=$row[$t]", $field_enc); + $field_enc_ct = count($field_enc); + $k=0; + while ($field_enc_ct > $k) + { + $field_enc_all .= $field_enc[$k]; + $k++; + } + $field_enc_all = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); + $row[$t] = base64_decode($field_enc_all); + } + } + if ( (preg_match("/,$column_list_array[$t],/",$hide_list)) and (strlen($row[$t]) > 0) ) + { + $field_temp_val = $row[$t]; + $row[$t] = preg_replace("/./",'X',$field_temp_val); + } $custom_data .= "\t$row[$t]"; $t++; } diff --git a/agc_2-X/trunk/www/vicidial/help.php b/agc_2-X/trunk/www/vicidial/help.php index 421f5ace..e9d752bd 100644 --- a/agc_2-X/trunk/www/vicidial/help.php +++ b/agc_2-X/trunk/www/vicidial/help.php @@ -59,6 +59,7 @@ # 150804-1108 - Added agent_whisper_enabled system settings option # 150804-1631 - Added multiple in-group _lead_reset options # 150806-1346 - Added Settings Containers +# 150903-1458 - Added compatibility for custom fields data options # require("dbconnect_mysqli.php"); @@ -319,6 +320,11 @@ echo "
\n"; echo ""; - $stmt="SELECT user_id,user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,shift_override_flag,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,voicemail_id,agent_call_log_view_override,callcard_admin,agent_choose_blended,realtime_block_user_info,custom_fields_modify,force_change_password,agent_lead_search_override,modify_shifts,modify_phones,modify_carriers,modify_labels,modify_statuses,modify_voicemail,modify_audiostore,modify_moh,modify_tts,preset_contact_search,modify_contacts,modify_same_user_level,admin_hide_lead_data,admin_hide_phone_data,agentcall_email,modify_email_accounts,failed_login_count,last_login_date,last_ip,alter_admin_interface_options,max_inbound_calls,modify_custom_dialplans,wrapup_seconds_override,modify_languages,selected_language,user_choose_language,ignore_group_on_search,api_list_restrict,api_allowed_functions,lead_filter_id from vicidial_users where user='$user' $LOGadmin_viewable_groupsSQL;"; + $stmt="SELECT user_id,user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,shift_override_flag,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,voicemail_id,agent_call_log_view_override,callcard_admin,agent_choose_blended,realtime_block_user_info,custom_fields_modify,force_change_password,agent_lead_search_override,modify_shifts,modify_phones,modify_carriers,modify_labels,modify_statuses,modify_voicemail,modify_audiostore,modify_moh,modify_tts,preset_contact_search,modify_contacts,modify_same_user_level,admin_hide_lead_data,admin_hide_phone_data,agentcall_email,modify_email_accounts,failed_login_count,last_login_date,last_ip,alter_admin_interface_options,max_inbound_calls,modify_custom_dialplans,wrapup_seconds_override,modify_languages,selected_language,user_choose_language,ignore_group_on_search,api_list_restrict,api_allowed_functions,lead_filter_id,agentcall_chat,admin_cf_show_hidden from vicidial_users where user='$user' $LOGadmin_viewable_groupsSQL;"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $user_id = $row[0]; @@ -18209,6 +18219,8 @@ if ($ADD==3) $api_list_restrict = $row[111]; $api_allowed_functions = $row[112]; $lead_filter_id = $row[113]; + $agentcall_chat = $row[114]; + $admin_cf_show_hidden = $row[115]; if ( ( ($user_level >= $LOGuser_level) and ($LOGuser_level < 9) ) or ( ($LOGmodify_same_user_level < 1) and ($LOGuser_level > 8) and ($user_level > 8) ) ) { @@ -18529,6 +18541,11 @@ if ($ADD==3) } echo "$NWB#users-api_allowed_functions$NWE
"._QXZ("Admin Custom Fields Show Hidden").": $NWB#users-admin_cf_show_hidden$NWE
"._QXZ("LEVEL 9 ADMIN OPTIONS").":
  - > + >
  - > + > diff --git a/agc_2-X/trunk/www/vicidial/admin_listloader_fourth_gen.php b/agc_2-X/trunk/www/vicidial/admin_listloader_fourth_gen.php index 769cba1a..6e4794a4 100644 --- a/agc_2-X/trunk/www/vicidial/admin_listloader_fourth_gen.php +++ b/agc_2-X/trunk/www/vicidial/admin_listloader_fourth_gen.php @@ -62,10 +62,11 @@ # 150312-1505 - Allow for single quotes in vicidial_list data fields # 150516-1136 - Fixed conflict with functions.php # 150728-0732 - Added state fullname to abbreviation conversion feature (state_conversion) +# 150810-0750 - Added compatibility for custom fields data option # -$version = '2.12-60'; -$build = '150728-0732'; +$version = '2.12-61'; +$build = '150810-0750'; require("dbconnect_mysqli.php"); require("functions.php"); @@ -184,7 +185,7 @@ $vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_ ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,admin_web_directory,custom_fields_enabled,webroot_writable,enable_languages,language_method FROM system_settings;"; +$stmt = "SELECT use_non_latin,admin_web_directory,custom_fields_enabled,webroot_writable,enable_languages,language_method,active_modules FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysqli_num_rows($rslt); @@ -197,6 +198,7 @@ if ($qm_conf_ct > 0) $webroot_writable = $row[3]; $SSenable_languages = $row[4]; $SSlanguage_method = $row[5]; + $SSactive_modules = $row[6]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -558,7 +560,7 @@ if ( (!$OK_to_process) or ( ($leadfile) and ($file_layout!="standard" && $file_l
$label_middle_initial:   \n"; echo " $label_last_name:
$label_address1 :
$label_address2 :
$label_address3 :
$label_city :
$label_address1 :
$label_address2 :
$label_address3 :
$label_city :
$label_state:   \n"; echo " $label_postal_code:
$label_province :
$label_province :
"._QXZ("Country")." :   \n"; echo " "._QXZ("Date of Birth").":
$label_phone_number :
$label_phone_number :
$label_phone_code :
$label_alt_phone :
$label_email :
$label_alt_phone :
$label_email :
$label_security_phrase :
$label_vendor_lead_code :
"._QXZ("Rank")." :
\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -1171,7 +1178,7 @@ else $custom_records_count = $rowx[0]; echo ""._QXZ("CUSTOM FIELDS FOR THIS LEAD").":
\n"; - echo "\n"; + echo "\n"; echo "

"; } }
- +
+ +
+ - +

@@ -626,6 +632,11 @@ if ($SSqc_features_active > 0)
- +
+
+
+ - +

@@ -2069,10 +2080,20 @@ if ($SSqc_features_active > 0)
- +
+
+
+ - + +
+
+
+ - +

- - + -
diff --git a/agc_2-X/trunk/www/vicidial/lead_report_export.php b/agc_2-X/trunk/www/vicidial/lead_report_export.php index d15f5f37..45c5fa57 100644 --- a/agc_2-X/trunk/www/vicidial/lead_report_export.php +++ b/agc_2-X/trunk/www/vicidial/lead_report_export.php @@ -21,6 +21,7 @@ # 141230-0951 - Added code for on-the-fly language translations display # 150108-1705 - Fixed issue with inbound and no outbound calls export # 150727-2145 - Enabled user features for hiding phone numbers and lead data +# 150903-1539 - Added compatibility for custom fields data options # $startMS = microtime(); @@ -72,7 +73,7 @@ $file_exported=0; ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,custom_fields_enabled,enable_languages,language_method FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,custom_fields_enabled,enable_languages,language_method,active_modules FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysqli_num_rows($rslt); @@ -86,6 +87,7 @@ if ($qm_conf_ct > 0) $custom_fields_enabled = $row[4]; $SSenable_languages = $row[5]; $SSlanguage_method = $row[6]; + $active_modules = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -161,13 +163,14 @@ else exit; } -$stmt="SELECT export_reports,user_group,admin_hide_lead_data,admin_hide_phone_data from vicidial_users where user='$PHP_AUTH_USER';"; +$stmt="SELECT export_reports,user_group,admin_hide_lead_data,admin_hide_phone_data,admin_cf_show_hidden from vicidial_users where user='$PHP_AUTH_USER';"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $LOGexport_reports = $row[0]; $LOGuser_group = $row[1]; $LOGadmin_hide_lead_data = $row[2]; $LOGadmin_hide_phone_data = $row[3]; +$LOGadmin_cf_show_hidden = $row[4]; if ($LOGexport_reports < 1) { @@ -777,7 +780,10 @@ if ($run_export > 0) $tablecount_to_print = mysqli_num_rows($rslt); if ($tablecount_to_print > 0) { - $stmt = "describe custom_$CF_list_id;"; + $column_list=''; + $encrypt_list=''; + $hide_list=''; + $stmt = "DESCRIBE custom_$CF_list_id;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $columns_ct = mysqli_num_rows($rslt); @@ -786,20 +792,103 @@ if ($run_export > 0) { $row=mysqli_fetch_row($rslt); $column = $row[0]; + $column_list .= "$row[0],"; $u++; } if ($columns_ct > 1) { - $stmt = "SELECT * from custom_$CF_list_id where lead_id='$export_lead_id[$i]' limit 1;"; + $column_list = preg_replace("/lead_id,/",'',$column_list); + $column_list = preg_replace("/,$/",'',$column_list); + $column_list_array = explode(',',$column_list); + if (preg_match("/cf_encrypt/",$active_modules)) + { + $enc_fields=0; + $stmt = "SELECT count(*) from vicidial_lists_fields where field_encrypt='Y' and list_id='$CF_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + if ($enc_field_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $enc_fields = $row[0]; + } + if ($enc_fields > 0) + { + $stmt = "SELECT field_label from vicidial_lists_fields where field_encrypt='Y' and list_id='$CF_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + $r=0; + while ($enc_field_ct > $r) + { + $row=mysqli_fetch_row($rslt); + $encrypt_list .= "$row[0],"; + $r++; + } + $encrypt_list = ",$encrypt_list"; + } + if ($LOGadmin_cf_show_hidden < 1) + { + $hide_fields=0; + $stmt = "SELECT count(*) from vicidial_lists_fields where field_show_hide!='DISABLED' and list_id='$CF_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hide_field_ct = mysqli_num_rows($rslt); + if ($hide_field_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $hide_fields = $row[0]; + } + if ($hide_fields > 0) + { + $stmt = "SELECT field_label from vicidial_lists_fields where field_show_hide!='DISABLED' and list_id='$CF_list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hide_field_ct = mysqli_num_rows($rslt); + $r=0; + while ($hide_field_ct > $r) + { + $row=mysqli_fetch_row($rslt); + $hide_list .= "$row[0],"; + $r++; + } + $hide_list = ",$hide_list"; + } + } + } + $stmt = "SELECT $column_list from custom_$CF_list_id where lead_id='$export_lead_id[$i]' limit 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $customfield_ct = mysqli_num_rows($rslt); if ($customfield_ct > 0) { $row=mysqli_fetch_row($rslt); - $t=1; - while ($columns_ct > $t) + $t=0; + while ($columns_ct >= $t) { + if ($enc_fields > 0) + { + $field_enc=''; $field_enc_all=''; + if ($DB) {echo "|$column_list|$encrypt_list|$hide_list|\n";} + if ( (preg_match("/,$column_list_array[$t],/",$encrypt_list)) and (strlen($row[$t]) > 0) ) + { + exec("../agc/aes.pl --decrypt --text=$row[$t]", $field_enc); + $field_enc_ct = count($field_enc); + $k=0; + while ($field_enc_ct > $k) + { + $field_enc_all .= $field_enc[$k]; + $k++; + } + $field_enc_all = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); + $row[$t] = base64_decode($field_enc_all); + } + } + if ( (preg_match("/,$column_list_array[$t],/",$hide_list)) and (strlen($row[$t]) > 0) ) + { + $field_temp_val = $row[$t]; + $row[$t] = preg_replace("/./",'X',$field_temp_val); + } $custom_data .= "\t$row[$t]"; $t++; } diff --git a/agc_2-X/trunk/www/vicidial/list_download.php b/agc_2-X/trunk/www/vicidial/list_download.php index 650a7a30..61747faf 100644 --- a/agc_2-X/trunk/www/vicidial/list_download.php +++ b/agc_2-X/trunk/www/vicidial/list_download.php @@ -31,6 +31,7 @@ # 141114-0036 - Finalized adding QXZ translation to all admin files # 141229-1840 - Added code for on-the-fly language translations display # 150727-2158 - Enabled user features for hiding phone numbers and lead data +# 150903-1538 - Added compatibility for custom fields data options # $startMS = microtime(); @@ -62,7 +63,7 @@ $db_source = 'M'; ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,custom_fields_enabled,enable_languages,language_method FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,custom_fields_enabled,enable_languages,language_method,active_modules FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysqli_num_rows($rslt); @@ -76,6 +77,7 @@ if ($qm_conf_ct > 0) $custom_fields_enabled = $row[4]; $SSenable_languages = $row[5]; $SSlanguage_method = $row[6]; + $active_modules = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -190,13 +192,14 @@ if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_ # echo "\n"; } -$stmt="SELECT user_group,admin_hide_lead_data,admin_hide_phone_data from vicidial_users where user='$PHP_AUTH_USER';"; +$stmt="SELECT user_group,admin_hide_lead_data,admin_hide_phone_data,admin_cf_show_hidden from vicidial_users where user='$PHP_AUTH_USER';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $LOGuser_group = $row[0]; $LOGadmin_hide_lead_data = $row[1]; $LOGadmin_hide_phone_data = $row[2]; +$LOGadmin_cf_show_hidden = $row[3]; $stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';"; if ($DB) {echo "|$stmt|\n";} @@ -623,26 +626,125 @@ if ( ($custom_fields_enabled > 0) and ($event_code_type=='LIST') ) } if ($valid_custom_table > 0) { - $stmtA = "SELECT * from custom_$export_list_id[$i] where lead_id='$export_lead_id[$i]' limit 1;"; - $rslt=mysql_to_mysqli($stmtA, $link); - if ($DB) {echo "$columns_ct|$stmtA\n";} - $customfield_ct = mysqli_num_rows($rslt); - if ($customfield_ct > 0) + $column_list=''; + $encrypt_list=''; + $hide_list=''; + $stmt = "DESCRIBE custom_$export_list_id[$i];"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $columns_ct = mysqli_num_rows($rslt); + $u=0; + while ($columns_ct > $u) { $row=mysqli_fetch_row($rslt); - $t=1; - while ($columns_ct > $t) + $column = $row[0]; + $column_list .= "$row[0],"; + $u++; + } + if ($columns_ct > 1) + { + $column_list = preg_replace("/lead_id,/",'',$column_list); + $column_list = preg_replace("/,$/",'',$column_list); + $column_list_array = explode(',',$column_list); + if (preg_match("/cf_encrypt/",$active_modules)) { - $custom_data[$i] .= "\t$row[$t]"; - if ($ch <= $t) + $enc_fields=0; + $stmt = "SELECT count(*) from vicidial_lists_fields where field_encrypt='Y' and list_id='$export_list_id[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + if ($enc_field_ct > 0) { - $ch++; - $header_columns .= "\tcustom$ch"; + $row=mysqli_fetch_row($rslt); + $enc_fields = $row[0]; + } + if ($enc_fields > 0) + { + $stmt = "SELECT field_label from vicidial_lists_fields where field_encrypt='Y' and list_id='$export_list_id[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enc_field_ct = mysqli_num_rows($rslt); + $r=0; + while ($enc_field_ct > $r) + { + $row=mysqli_fetch_row($rslt); + $encrypt_list .= "$row[0],"; + $r++; + } + $encrypt_list = ",$encrypt_list"; + } + if ($LOGadmin_cf_show_hidden < 1) + { + $hide_fields=0; + $stmt = "SELECT count(*) from vicidial_lists_fields where field_show_hide!='DISABLED' and list_id='$export_list_id[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hide_field_ct = mysqli_num_rows($rslt); + if ($hide_field_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $hide_fields = $row[0]; + } + if ($hide_fields > 0) + { + $stmt = "SELECT field_label from vicidial_lists_fields where field_show_hide!='DISABLED' and list_id='$export_list_id[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hide_field_ct = mysqli_num_rows($rslt); + $r=0; + while ($hide_field_ct > $r) + { + $row=mysqli_fetch_row($rslt); + $hide_list .= "$row[0],"; + $r++; + } + $hide_list = ",$hide_list"; + } + } + } + $stmt = "SELECT $column_list from custom_$export_list_id[$i] where lead_id='$export_lead_id[$i]' limit 1;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $customfield_ct = mysqli_num_rows($rslt); + if ($customfield_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $t=0; + while ($columns_ct >= $t) + { + if ($enc_fields > 0) + { + $field_enc=''; $field_enc_all=''; + if ($DB) {echo "|$column_list|$encrypt_list|\n";} + if ( (preg_match("/,$column_list_array[$t],/",$encrypt_list)) and (strlen($row[$t]) > 0) ) + { + exec("../agc/aes.pl --decrypt --text=$row[$t]", $field_enc); + $field_enc_ct = count($field_enc); + $k=0; + while ($field_enc_ct > $k) + { + $field_enc_all .= $field_enc[$k]; + $k++; + } + $field_enc_all = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); + $row[$t] = base64_decode($field_enc_all); + } + } + if ( (preg_match("/,$column_list_array[$t],/",$hide_list)) and (strlen($row[$t]) > 0) ) + { + $field_temp_val = $row[$t]; + $row[$t] = preg_replace("/./",'X',$field_temp_val); + } + $custom_data[$i] .= "\t$row[$t]"; + if ($ch <= $t) + { + $ch++; + $header_columns .= "\tcustom$ch"; + } + $t++; } - $t++; } } - $custom_data[$i] = preg_replace("/\r\n/",'!N',$custom_data[$i]); $custom_data[$i] = preg_replace("/\n/",'!N',$custom_data[$i]); } diff --git a/agc_2-X/trunk/www/vicidial/list_split.php b/agc_2-X/trunk/www/vicidial/list_split.php index 46ae8b2c..7e8eb21f 100644 --- a/agc_2-X/trunk/www/vicidial/list_split.php +++ b/agc_2-X/trunk/www/vicidial/list_split.php @@ -1,16 +1,17 @@ LICENSE: AGPLv2 +# Copyright (C) 2015 Matt Florell,Michael Cargile LICENSE: AGPLv2 # # CHANGES # 140916-1215 - Initial Build # 141114-1330 - formatting changes, code cleanup # 141229-1822 - Added code for on-the-fly language translations display +# 150808-2042 - Added compatibility for custom fields data option # -$version = '2.10-3'; -$build = '141229-1822'; +$version = '2.12-4'; +$build = '150808-2042'; require("dbconnect_mysqli.php"); require("functions.php"); @@ -51,7 +52,7 @@ $num_leads = preg_replace('/[^0-9]/','',$num_leads); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$sys_settings_stmt = "SELECT use_non_latin,outbound_autodial_active,sounds_central_control_active,enable_languages,language_method FROM system_settings;"; +$sys_settings_stmt = "SELECT use_non_latin,outbound_autodial_active,sounds_central_control_active,enable_languages,language_method,active_modules FROM system_settings;"; $sys_settings_rslt=mysql_to_mysqli($sys_settings_stmt, $link); if ($DB) {echo "$sys_settings_stmt\n";} $num_rows = mysqli_num_rows($sys_settings_rslt); @@ -63,6 +64,7 @@ if ($num_rows > 0) $sounds_central_control_active = $sys_settings_row[2]; $SSenable_languages = $sys_settings_row[3]; $SSlanguage_method = $sys_settings_row[4]; + $SSactive_modules = $sys_settings_row[5]; } else { @@ -384,7 +386,11 @@ if ($confirm == "confirm") # copy the custom fields if there are any if ( $cf_chk_count > 0 ) { - $url = "http" . (isset($_SERVER['HTTPS']) ? 's' : '') . "://$_SERVER[HTTP_HOST]/vicidial/admin_lists_custom.php?action=COPY_FIELDS_SUBMIT&list_id=$new_list_id&source_list_id=$orig_list©_option=APPEND"; + $admin_lists_custom = 'admin_lists_custom.php'; + if (preg_match("/cf_encrypt/",$SSactive_modules)) + {$admin_lists_custom = 'admin_lists_custom_encrypt.php';} + + $url = "http" . (isset($_SERVER['HTTPS']) ? 's' : '') . "://$_SERVER[HTTP_HOST]/vicidial/" . $admin_lists_custom . "?action=COPY_FIELDS_SUBMIT&list_id=$new_list_id&source_list_id=$orig_list©_option=APPEND"; # use cURL to call the copy custom fields code $curl = curl_init(); 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 48342587..8529e7b6 100644 --- a/agc_2-X/trunk/www/vicidial/non_agent_api.php +++ b/agc_2-X/trunk/www/vicidial/non_agent_api.php @@ -102,10 +102,11 @@ # 150603-1528 - Fixed format issue in recording_lookup # 150730-2022 - Added option to set entry_list_id # 150804-0948 - Added WHISPER option for blind_monitor function +# 150808-1438 - Added compatibility for custom fields data option # -$version = '2.12-78'; -$build = '150804-0948'; +$version = '2.12-79'; +$build = '150808-1438'; $api_url_log = 0; $startMS = microtime(); @@ -384,7 +385,7 @@ header ("Pragma: no-cache"); // HTTP/1.0 ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,custom_fields_enabled,pass_hash_enabled,agent_whisper_enabled FROM system_settings;"; +$stmt = "SELECT use_non_latin,custom_fields_enabled,pass_hash_enabled,agent_whisper_enabled,active_modules FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); $qm_conf_ct = mysqli_num_rows($rslt); if ($qm_conf_ct > 0) @@ -394,6 +395,7 @@ if ($qm_conf_ct > 0) $custom_fields_enabled = $row[1]; $SSpass_hash_enabled = $row[2]; $agent_whisper_enabled = $row[3]; + $active_modules = $row[4]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -6360,7 +6362,7 @@ if ($function == 'add_lead') if ($tablecount_to_print > 0) { $CFinsert_SQL=''; - $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='$list_id' order by field_rank,field_order,field_label;"; + $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,field_encrypt from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;"; $rslt=mysql_to_mysqli($stmt, $link); $fields_to_print = mysqli_num_rows($rslt); $fields_list=''; @@ -6377,6 +6379,7 @@ if ($function == 'add_lead') $A_field_size[$o] = $rowx[8]; $A_field_max[$o] = $rowx[9]; $A_field_required[$o] = $rowx[12]; + $A_field_encrypt[$o] = $rowx[16]; $A_field_value[$o] = ''; $field_name_id = $A_field_label[$o]; @@ -6396,7 +6399,23 @@ if ($function == 'add_lead') { if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) { - $CFinsert_SQL .= "$A_field_label[$o]=\"$A_field_value[$o]\","; + if ( (preg_match("/cf_encrypt/",$active_modules)) and ($A_field_encrypt[$o] == 'Y') and (strlen($A_field_value[$o]) > 0) ) + { + $A_field_valueSQL[$o] = base64_encode($A_field_value[$o]); + exec("../agc/aes.pl --encrypt --text=$A_field_valueSQL[$o]", $field_enc); + $field_enc_ct = count($field_enc); + $k=0; + while ($field_enc_ct > $k) + { + $field_enc_all .= $field_enc[$k]; + $k++; + } + $A_field_valueSQL[$o] = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); + } + else + {$A_field_valueSQL[$o] = $A_field_value[$o];} + + $CFinsert_SQL .= "$A_field_label[$o]=\"$A_field_valueSQL[$o]\","; } } $o++; @@ -7078,7 +7097,7 @@ if ($function == 'update_lead') { $update_SQL=''; $VL_update_SQL=''; - $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='$lead_custom_list' order by field_rank,field_order,field_label;"; + $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,field_encrypt from vicidial_lists_fields where list_id='$lead_custom_list' order by field_rank,field_order,field_label;"; $rslt=mysql_to_mysqli($stmt, $link); $fields_to_print = mysqli_num_rows($rslt); $fields_list=''; @@ -7095,6 +7114,7 @@ if ($function == 'update_lead') $A_field_size[$o] = $rowx[8]; $A_field_max[$o] = $rowx[9]; $A_field_required[$o] = $rowx[12]; + $A_field_encrypt[$o] = $rowx[16]; $A_field_value[$o] = ''; $field_name_id = $A_field_label[$o]; @@ -7114,7 +7134,23 @@ if ($function == 'update_lead') { if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) { - $update_SQL .= "$A_field_label[$o]=\"$A_field_value[$o]\","; + if ( (preg_match("/cf_encrypt/",$active_modules)) and ($A_field_encrypt[$o] == 'Y') and (strlen($A_field_value[$o]) > 0) ) + { + $A_field_valueSQL[$o] = base64_encode($A_field_value[$o]); + exec("../agc/aes.pl --encrypt --text=$A_field_valueSQL[$o]", $field_enc); + $field_enc_ct = count($field_enc); + $k=0; + while ($field_enc_ct > $k) + { + $field_enc_all .= $field_enc[$k]; + $k++; + } + $A_field_valueSQL[$o] = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); + } + else + {$A_field_valueSQL[$o] = $A_field_value[$o];} + + $update_SQL .= "$A_field_label[$o]=\"$A_field_valueSQL[$o]\","; } } $o++; @@ -7290,7 +7326,7 @@ if ($function == 'update_lead') if ($tablecount_to_print > 0) { $CFinsert_SQL=''; - $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='$list_id' order by field_rank,field_order,field_label;"; + $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,field_encrypt from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;"; $rslt=mysql_to_mysqli($stmt, $link); $fields_to_print = mysqli_num_rows($rslt); $fields_list=''; @@ -7307,6 +7343,7 @@ if ($function == 'update_lead') $A_field_size[$o] = $rowx[8]; $A_field_max[$o] = $rowx[9]; $A_field_required[$o] = $rowx[12]; + $A_field_encrypt[$o] = $rowx[16]; $A_field_value[$o] = ''; $field_name_id = $A_field_label[$o]; @@ -7326,7 +7363,23 @@ if ($function == 'update_lead') { if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) { - $CFinsert_SQL .= "$A_field_label[$o]='$A_field_value[$o]',"; + if ( (preg_match("/cf_encrypt/",$active_modules)) and ($A_field_encrypt[$o] == 'Y') and (strlen($A_field_value[$o]) > 0) ) + { + $A_field_valueSQL[$o] = base64_encode($A_field_value[$o]); + exec("../agc/aes.pl --encrypt --text=$A_field_valueSQL[$o]", $field_enc); + $field_enc_ct = count($field_enc); + $k=0; + while ($field_enc_ct > $k) + { + $field_enc_all .= $field_enc[$k]; + $k++; + } + $A_field_valueSQL[$o] = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all); + } + else + {$A_field_valueSQL[$o] = $A_field_value[$o];} + + $CFinsert_SQL .= "$A_field_label[$o]='$A_field_valueSQL[$o]',"; } } $o++; diff --git a/agc_2-X/trunk/www/vicidial/qc_modify_lead.php b/agc_2-X/trunk/www/vicidial/qc_modify_lead.php index 3c68276f..8a5c7aee 100644 --- a/agc_2-X/trunk/www/vicidial/qc_modify_lead.php +++ b/agc_2-X/trunk/www/vicidial/qc_modify_lead.php @@ -1,12 +1,12 @@ LICENSE: AGPLv2 +# Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 # # This script is designed to allow QC review and modification of leads, contributed by poundteam.com # @@ -20,6 +20,8 @@ # 141007-2152 - Finalized adding QXZ translation to all admin files # 141128-0902 - Code cleanup for QXZ functions # 141229-1742 - Added code for on-the-fly language translations display +# 150808-1437 - Added compatibility for custom fields data options +# 150908-1531 - Fixed input lengths for several standard fields to match DB # require("dbconnect_mysqli.php"); @@ -137,7 +139,7 @@ $NOW_TIME = date("Y-m-d H:i:s"); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,custom_fields_enabled,enable_languages,language_method FROM system_settings;"; +$stmt = "SELECT use_non_latin,custom_fields_enabled,enable_languages,language_method,active_modules FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysqli_num_rows($rslt); @@ -148,6 +150,7 @@ if ($qm_conf_ct > 0) $custom_fields_enabled = $row[1]; $SSenable_languages = $row[2]; $SSlanguage_method = $row[3]; + $active_modules = $row[4]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -277,6 +280,10 @@ $phone_code = $row['phone_code']; $lead_name = trim(trim($row['first_name'].' '.$row['middle_initial']).' '.$row['last_name']); $scheduled_callback = $row['scheduled_callback']; +$vdc_form_display = 'vdc_form_display.php'; +if (preg_match("/cf_encrypt/",$active_modules)) + {$vdc_form_display = 'vdc_form_display_encrypt.php';} + ?> @@ -831,20 +838,20 @@ else echo "$label_first_name:
$label_middle_initial:   \n"; echo " $label_last_name:
$label_address1 :
$label_address2 :
$label_address3 :
$label_city :
$label_address1 :
$label_address2 :
$label_address3 :
$label_city :
$label_state:   \n"; echo " $label_postal_code:
$label_province :
Country :
$label_phone_number :
$label_phone_number :
$label_phone_code :
$label_alt_phone :
$label_email :
$label_security_phrase :
$label_alt_phone :
$label_email :
$label_security_phrase :
Rank :
Owner :
$label_comments :