From edeec964f8c6c8e881e16a978c386929a0484d87 Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 18 Jul 2011 21:25:14 +0000 Subject: [PATCH] Added manual dial agent skip lead logging to the user stats page Small changes to bulk phone insert script, added Help section git-svn-id: svn://192.168.202.10@1695 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 2 + .../bin/VICIDIAL_IN_preprocess_leads_file.pl | 460 ++++++++++++++---- .../trunk/extras/MySQL_AST_CREATE_tables.sql | 16 +- agc_2-X/trunk/extras/upgrade_2.4.sql | 14 + .../TO_BE_TRANSLATED_2.4.txt | 16 + agc_2-X/trunk/www/agc/vdc_db_query.php | 14 +- agc_2-X/trunk/www/agc/vicidial.php | 7 +- .../www/vicidial/admin_phones_bulk_insert.php | 94 +++- agc_2-X/trunk/www/vicidial/user_stats.php | 90 +++- 9 files changed, 574 insertions(+), 139 deletions(-) diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 066f7b55..117257b6 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -644,6 +644,8 @@ OTHER CHANGES: 145. Added CSV download option to almost all reports. +146. Added manual dial agent skip lead logging to the user stats page + diff --git a/agc_2-X/trunk/bin/VICIDIAL_IN_preprocess_leads_file.pl b/agc_2-X/trunk/bin/VICIDIAL_IN_preprocess_leads_file.pl index 1044597b..3af876db 100644 --- a/agc_2-X/trunk/bin/VICIDIAL_IN_preprocess_leads_file.pl +++ b/agc_2-X/trunk/bin/VICIDIAL_IN_preprocess_leads_file.pl @@ -422,68 +422,304 @@ foreach(@FILES) open(Pout, ">$dir2/$FILEname$pipe") || die "Can't open $dir2/$FILEname$pipe: $!\n"; - $a=0; ### each line of input file counter ### - $b=0; ### new records counter ### - $c=0; ### no-phone counter ### - $d=0; ### - $e=0; ### - $f=0; ### - $g=0; ### + $a=0; ### each line of input file counter ### + $b=0; ### new records counter ### + $c=0; ### no-phone counter ### + $d=0; ### + $e=0; ### + $f=0; ### + $g=0; ### - $rank=''; - $owner=''; + $rank=''; + $owner=''; - #if ($DB) - while () - { - @m=@MT; - # print "$a| $number\n"; - $number = $_; - $raw_number = $number; - chomp($number); - # $number =~ s/,/\|/gi; - $number =~ s/\t/\|/gi; - $number =~ s/\'|\t|\r|\n|\l//gi; - $number =~ s/\'|\t|\r|\n|\l//gi; - $number =~ s/\",,,,,,,\"/\|\|\|\|\|\|\|/gi; - $number =~ s/\",,,,,,\"/\|\|\|\|\|\|/gi; - $number =~ s/\",,,,,\"/\|\|\|\|\|/gi; - $number =~ s/\",,,,\"/\|\|\|\|/gi; - $number =~ s/\",,,\"/\|\|\|/gi; - $number =~ s/\",,\"/\|\|/gi; - $number =~ s/\",\"/\|/gi; - $number =~ s/\"//gi; - @m = split(/\|/, $number); + #if ($DB) + while () + { + @m=@MT; + # print "$a| $number\n"; + $number = $_; + $raw_number = $number; + chomp($number); + # $number =~ s/,/\|/gi; + $number =~ s/\t/\|/gi; + $number =~ s/\'|\t|\r|\n|\l//gi; + $number =~ s/\'|\t|\r|\n|\l//gi; + $number =~ s/\",,,,,,,\"/\|\|\|\|\|\|\|/gi; + $number =~ s/\",,,,,,\"/\|\|\|\|\|\|/gi; + $number =~ s/\",,,,,\"/\|\|\|\|\|/gi; + $number =~ s/\",,,,\"/\|\|\|\|/gi; + $number =~ s/\",,,\"/\|\|\|/gi; + $number =~ s/\",,\"/\|\|/gi; + $number =~ s/\",\"/\|/gi; + $number =~ s/\"//gi; + @m = split(/\|/, $number); - $format_set=0; + $format_set=0; - # This is the format for the ncacsv39 lead files - #5200556,"00052555570016383767","SERVERS JR,JIM M","2915551802",1121.31,"627555120","77380","HSBC","SCRIPT4","6205554433","No Message","2915551802","16383767","","","","","","","","","","","","","","","6001","DLR3","549","","","","","","","","","" + ##### BEGIN ncacsv31 format ##### + # This is the format for the ncacsv39x lead files + #5200556,"00052555570016383767","SERVERS JR,JIM M","2915551802",1121.31,"627555120","77380","HSBC","SCRIPT4","6205554433","No Message","2915551802","16383767","","","","","","","","","","","","","","","6001","DLR3","549","","","","","","","","","" - # field mappings: - # $vendor_lead_code = 1 - acctid - # $source_id = 2 - uniqueid - # $first_name = 3 - first_name - # $middle_initial = - # $last_name = 3 - last_name - # $province = 4 - acct main phone - # $address2 = 5 - balance - # $alt_phone = 6 - ssn - # $postal_code = 7 - zip - # $address1 = 8 - descrip - # $address3 = 9 - script - # $security_phrase = 10 - cid - # $email = 37 - collectorid - # $title = 29 - folderid - # $state = - # $country = - # $gender = - # $date_of_birth = - # $comments = - # $rank = - # $owner = - # $city = + # field mappings: + # $vendor_lead_code = 1 - acctid + # $source_id = 2 - uniqueid + # $first_name = 3 - first_name + # $middle_initial = + # $last_name = 3 - last_name + # $province = + # $address2 = 29 - collectorid + # $address3 = 8 - account description + # $alt_phone = 5 - balance + # $postal_code = 7 - zip + # $address1 = + # $city = 9 - script + # $security_phrase = + # $email = 6 - ssn + # $title = 27 - folderid + # $state = + # $country = + # $gender = + # $date_of_birth = + # $comments = + # $rank = + # $owner = + + if ( ($format =~ /ncacsv31/) && ($format_set < 1) ) + { + $number = $raw_number; + chomp($number); + $number =~ s/\t/\|/gi; + $number =~ s/\'|\t|\r|\n|\l//gi; + $number =~ s/\'|\t|\r|\n|\l//gi; + $number =~ s/\",,,,,,,\"/\|\|\|\|\|\|\|/gi; + $number =~ s/\",,,,,,\"/\|\|\|\|\|\|/gi; + $number =~ s/\",,,,,\"/\|\|\|\|\|/gi; + $number =~ s/\",,,,\"/\|\|\|\|/gi; + $number =~ s/\",,,\"/\|\|\|/gi; + $number =~ s/\",,\"/\|\|/gi; + $number =~ s/\",\"/\|/gi; + $number =~ s/,\"/\|/gi; + $number =~ s/\",/\|/gi; + $number =~ s/,/\|/gi; + $number =~ s/\"//gi; + @m = split(/\|/, $number); + + if ($DBX) {print "ncacsv31($a) - $number\n";} + + $vendor_lead_code = $m[0]; chomp($vendor_lead_code); # acctid + $source_id = $m[1]; chomp($source_id); # uniqueid + $list_id = '939'; + $phone_code = '1'; + $full_name = $m[2]; @name = split(/,/, $full_name); + $first_name = $name[1]; chomp($first_name); + $middle_initial = ''; + $last_name = $name[0]; chomp($last_name); + $province = $m[3]; # acct main phone + $address2 = $m[4]; # balance + $alt_phone = $m[5]; chomp($alt_phone); $alt_phone =~ s/\D//gi; # ssn + $postal_code = $m[6]; chomp($postal_code); $postal_code =~ s/\D//gi; # zip + $address1 = $m[7]; # descrip + $address3 = $m[8]; # script + $security_phrase = $m[9]; chomp($security_phrase); $security_phrase =~ s/\D//gi; # cid + $email = $m[36]; # collectorid + $title = $m[28]; # folderid + $phone_number = $m[3]; + $USarea = substr($phone_number, 0, 3); + $state = ''; + $country = ''; + $gender = ''; + $date_of_birth = ''; + $comments = ''; + $called_count = '0'; + $status = 'NEW'; + $insert_date = $pulldate0; + $rank = ''; + $owner = ''; + $entry_date = ''; + $multi_alt_phones = ''; + $phone_found=0; + + + if (length($m[11]) > 9) + { + $phone_number = $m[11]; + $rank = '1'; + $owner = 'home'; + &cid_state_areacode; # lookup areacode-state-based CID + print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$owner|$called_count|$status|$entry_date|$rank|$owner|\n"; + $b++; $phone_found++; + if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$vendor_lead_code|$source_id\n";} + } + if (length($m[12]) > 9) + { + $phone_number = $m[12]; + $rank = '2'; + $owner = 'home2'; + &cid_state_areacode; # lookup areacode-state-based CID + print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$owner|$called_count|$status|$entry_date|$rank|$owner|\n"; + $b++; $phone_found++; + if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$vendor_lead_code|$source_id\n";} + } + if (length($m[13]) > 9) + { + $phone_number = $m[13]; + $rank = '3'; + $owner = 'work'; + &cid_state_areacode; # lookup areacode-state-based CID + print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$owner|$called_count|$status|$entry_date|$rank|$owner|\n"; + $b++; $phone_found++; + if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$vendor_lead_code|$source_id\n";} + } + if (length($m[14]) > 9) + { + $phone_number = $m[14]; + $rank = '4'; + $owner = 'work2'; + &cid_state_areacode; # lookup areacode-state-based CID + print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$owner|$called_count|$status|$entry_date|$rank|$owner|\n"; + $b++; $phone_found++; + if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$vendor_lead_code|$source_id\n";} + } + if (length($m[15]) > 9) + { + $phone_number = $m[15]; + $rank = '5'; + $owner = 'cell'; + &cid_state_areacode; # lookup areacode-state-based CID + print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$owner|$called_count|$status|$entry_date|$rank|$owner|\n"; + $b++; $phone_found++; + if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$vendor_lead_code|$source_id\n";} + } + if (length($m[16]) > 9) + { + $phone_number = $m[16]; + $rank = '6'; + $owner = 'cell2'; + &cid_state_areacode; # lookup areacode-state-based CID + print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$owner|$called_count|$status|$entry_date|$rank|$owner|\n"; + $b++; $phone_found++; + if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$vendor_lead_code|$source_id\n";} + } + if (length($m[17]) > 9) + { + $phone_number = $m[17]; + $rank = '7'; + $owner = 'alt1'; + &cid_state_areacode; # lookup areacode-state-based CID + print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$owner|$called_count|$status|$entry_date|$rank|$owner|\n"; + $b++; $phone_found++; + if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$vendor_lead_code|$source_id\n";} + } + if (length($m[18]) > 9) + { + $phone_number = $m[18]; + $rank = '8'; + $owner = 'alt2'; + &cid_state_areacode; # lookup areacode-state-based CID + print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$owner|$called_count|$status|$entry_date|$rank|$owner|\n"; + $b++; $phone_found++; + if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$vendor_lead_code|$source_id\n";} + } + if (length($m[19]) > 9) + { + $phone_number = $m[19]; + $rank = '9'; + $owner = 'alt3'; + &cid_state_areacode; # lookup areacode-state-based CID + print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$owner|$called_count|$status|$entry_date|$rank|$owner|\n"; + $b++; $phone_found++; + if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$vendor_lead_code|$source_id\n";} + } + if (length($m[20]) > 9) + { + $phone_number = $m[20]; + $rank = '10'; + $owner = 'trigger1'; + &cid_state_areacode; # lookup areacode-state-based CID + print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$owner|$called_count|$status|$entry_date|$rank|$owner|\n"; + $b++; $phone_found++; + if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$vendor_lead_code|$source_id\n";} + } + if (length($m[21]) > 9) + { + $phone_number = $m[21]; + $rank = '11'; + $owner = 'trigger2'; + &cid_state_areacode; # lookup areacode-state-based CID + print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$owner|$called_count|$status|$entry_date|$rank|$owner|\n"; + $b++; $phone_found++; + if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$vendor_lead_code|$source_id\n";} + } + if (length($m[22]) > 9) + { + $phone_number = $m[22]; + $rank = '12'; + $owner = 'skiphome'; + &cid_state_areacode; # lookup areacode-state-based CID + print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$owner|$called_count|$status|$entry_date|$rank|$owner|\n"; + $b++; $phone_found++; + if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$vendor_lead_code|$source_id\n";} + } + if (length($m[23]) > 9) + { + $phone_number = $m[23]; + $rank = '13'; + $owner = 'skipwork'; + &cid_state_areacode; # lookup areacode-state-based CID + print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$owner|$called_count|$status|$entry_date|$rank|$owner|\n"; + $b++; $phone_found++; + if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$vendor_lead_code|$source_id\n";} + } + if (length($m[24]) > 9) + { + $phone_number = $m[24]; + $rank = '14'; + $owner = 'skipcell'; + &cid_state_areacode; # lookup areacode-state-based CID + print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$owner|$called_count|$status|$entry_date|$rank|$owner|\n"; + $b++; $phone_found++; + if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$vendor_lead_code|$source_id\n";} + } + + if ($phone_found < 1) + { + if ($DB) {print "No-Phone entry: $a|$vendor_lead_code|$source_id\n";} + $c++; + } + $format_set++; + } + ##### END ncacsv31 format ##### + + + ##### BEGIN ncacsv39 format ##### + # This is the format for the ncacsv39 lead files + #5200556,"00052555570016383767","SERVERS JR,JIM M","2915551802",1121.31,"627555120","77380","HSBC","SCRIPT4","6205554433","No Message","2915551802","16383767","","","","","","","","","","","","","","","6001","DLR3","549","","","","","","","","","" + + # field mappings: + # $vendor_lead_code = 1 - acctid + # $source_id = 2 - uniqueid + # $first_name = 3 - first_name + # $middle_initial = + # $last_name = 3 - last_name + # $province = 4 - acct main phone + # $address2 = 5 - balance + # $alt_phone = 6 - ssn + # $postal_code = 7 - zip + # $address1 = 8 - descrip + # $address3 = 9 - script + # $security_phrase = 10 - cid + # $email = 37 - collectorid + # $title = 29 - folderid + # $state = + # $country = + # $gender = + # $date_of_birth = + # $comments = + # $rank = + # $owner = + # $city = if ( ($format =~ /ncacsv39/) && ($format_set < 1) ) { @@ -669,35 +905,37 @@ foreach(@FILES) } $format_set++; } + ##### END ncacsv39 format ##### - # This is the format for the dccsv52 lead files - #"BFRAME","RECORD_TYPE","LAST_NAME","FIRST_NAME","ADDR1","ADDR2","CITY","STATE","ZIP","ZIP4","ADDR_STATUS","DATE_PLACED","DATE_ADDED","DOB","LAST_LETTER","LAST_LETTER_DATE","LAST_WORKED","NEXT_ACTION_DATE","CAPTURE_CODE","CUR_CATEGORY","TIMES_DIALED","LAST_DIALED","TOTAL_PAID","DATE_LAST_PAID","NMBR_CALLS","NMBR_CONTACTS","NMBR_TIMES_WRKD","NMBR_LETTERS","STATUS_CODE","STATUS_DATE","SCORE","TIMES_TO_SERVICER","1ST-PMT-DEFAULT","TIME_ZONE","ORIG_CREDITOR","BALANCE","HOME_PHONE","WORK_PHONE","OTHER_PHONE","ACCT_OTHTEL2","ACCT_OTHTEL3","ACCT_OTHTEL4","ACCT_OTHTEL5","REF-NAME","REF-AD1","REF-AD2","REF-CITY","REF-ST","REF-POSTAL","REF-TEL1","REF-TEL2","SSN" - #"II ACCT/1103566666 ","P","SMITH "," SAMMY","7838 W 109TH ST APT 12 "," ","OVERLAND PARK ","KS","66212","0000","G","20091110","20091110","19661216","NOLTTR","00000000","20091214","20091219","1000","03","000","00000000","000000000.00 ","00000000","0004","0003","0004","000","ACTIVE","20091110","0648","00"," ","C","HSBC ","000000692.09 ","9135551212","0000000000","0000000000","0000000000","0000000000","0000000000","0000000000","","","",""," "," "," "," ","578888888" + ##### BEGIN dccsv52 format ##### + # This is the format for the dccsv52 lead files + #"BFRAME","RECORD_TYPE","LAST_NAME","FIRST_NAME","ADDR1","ADDR2","CITY","STATE","ZIP","ZIP4","ADDR_STATUS","DATE_PLACED","DATE_ADDED","DOB","LAST_LETTER","LAST_LETTER_DATE","LAST_WORKED","NEXT_ACTION_DATE","CAPTURE_CODE","CUR_CATEGORY","TIMES_DIALED","LAST_DIALED","TOTAL_PAID","DATE_LAST_PAID","NMBR_CALLS","NMBR_CONTACTS","NMBR_TIMES_WRKD","NMBR_LETTERS","STATUS_CODE","STATUS_DATE","SCORE","TIMES_TO_SERVICER","1ST-PMT-DEFAULT","TIME_ZONE","ORIG_CREDITOR","BALANCE","HOME_PHONE","WORK_PHONE","OTHER_PHONE","ACCT_OTHTEL2","ACCT_OTHTEL3","ACCT_OTHTEL4","ACCT_OTHTEL5","REF-NAME","REF-AD1","REF-AD2","REF-CITY","REF-ST","REF-POSTAL","REF-TEL1","REF-TEL2","SSN" + #"II ACCT/1103566666 ","P","SMITH "," SAMMY","7838 W 109TH ST APT 12 "," ","OVERLAND PARK ","KS","66212","0000","G","20091110","20091110","19661216","NOLTTR","00000000","20091214","20091219","1000","03","000","00000000","000000000.00 ","00000000","0004","0003","0004","000","ACTIVE","20091110","0648","00"," ","C","HSBC ","000000692.09 ","9135551212","0000000000","0000000000","0000000000","0000000000","0000000000","0000000000","","","",""," "," "," "," ","578888888" - # field mappings: - # $vendor_lead_code = 1 - BFRAME (number only) - # $source_id = 1 - BFRAME - # $first_name = 4 - FIRST_NAME - # $middle_initial = - # $last_name = 3 - LAST_NAME - # $province = 36 - BALANCE - # $address1 = 5 - ADDR1 - # $address2 = 6 - ADDR2 - # $city = 7 - CITY - # $state = 8 - STATE - # $postal_code = 9 - ZIP - # $address3 = 35 - ORIG_CREDITOR - # $date_of_birth = 14 - DOB - # $alt_phone = 27&29 - NMBR_TIMES_WRKD & STATUS_CODE - # $email = 52 - SSN - # $title = 26 - NMBR_CONTACTS - # $security_phrase = - # $comments = 44 - REF-NAME - # $country = - # $gender = - # $rank = - # $owner = + # field mappings: + # $vendor_lead_code = 1 - BFRAME (number only) + # $source_id = 1 - BFRAME + # $first_name = 4 - FIRST_NAME + # $middle_initial = + # $last_name = 3 - LAST_NAME + # $province = 36 - BALANCE + # $address1 = 5 - ADDR1 + # $address2 = 6 - ADDR2 + # $city = 7 - CITY + # $state = 8 - STATE + # $postal_code = 9 - ZIP + # $address3 = 35 - ORIG_CREDITOR + # $date_of_birth = 14 - DOB + # $alt_phone = 27&29 - NMBR_TIMES_WRKD & STATUS_CODE + # $email = 52 - SSN + # $title = 26 - NMBR_CONTACTS + # $security_phrase = + # $comments = 44 - REF-NAME + # $country = + # $gender = + # $rank = + # $owner = if ( ($format =~ /dccsv52/) && ($format_set < 1) ) { @@ -876,6 +1114,7 @@ foreach(@FILES) } $format_set++; } + ##### END dccsv52 format ##### # This is the format for the standard lead files @@ -1041,18 +1280,51 @@ exit; ##### SUBROUTINES ##### -sub cid_state { -### look up the custom CID to use for this state -$stmtA = "select cid from vicidial_custom_cid where state='$state';"; -$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; -$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; -$sthArows=$sthA->rows; - if($DBX){print STDERR "\n$sthArows|$stmtA|\n";} -if ($sthArows > 0) +sub cid_state { - @aryA = $sthA->fetchrow_array; - $security_phrase = $aryA[0]; + ### look up the custom CID to use for this state + $stmtA = "select cid from vicidial_custom_cid where state='$state';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if($DBX){print STDERR "\n$sthArows|$stmtA|\n";} + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $security_phrase = $aryA[0]; + } + $sthA->finish(); + } + + +sub cid_state_areacode + { + ### look up the custom CID to use for this areacode's state + $USarea = substr($phone_number, 0, 3); + $state=''; + + $stmtA = "select state from vicidial_phone_codes where areacode='$USarea' and country_code='1';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if($DBX){print STDERR "\n$sthArows|$stmtA|\n";} + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $state = $aryA[0]; + } + $sthA->finish(); + + $stmtA = "select cid from vicidial_custom_cid where state='$state';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if($DBX){print STDERR "\n$sthArows|$stmtA|\n";} + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $security_phrase = $aryA[0]; + } + $sthA->finish(); } -$sthA->finish(); -} 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 07b42856..05b202e5 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -2382,6 +2382,20 @@ label_email VARCHAR(40) default '', label_comments VARCHAR(40) default '' ); +CREATE TABLE vicidial_agent_skip_log ( +user_skip_log_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +user VARCHAR(20), +event_date DATETIME, +lead_id INT(9) UNSIGNED, +campaign_id VARCHAR(20) default '', +previous_status VARCHAR(6) default '', +previous_called_count SMALLINT(5) UNSIGNED default '0', +index (user), +index (event_date), +index (campaign_id) +); + + ALTER TABLE vicidial_campaign_server_stats ENGINE=MEMORY; ALTER TABLE live_channels ENGINE=MEMORY; @@ -2535,7 +2549,7 @@ ALTER TABLE vicidial_closer_log_archive MODIFY closecallid INT(9) UNSIGNED NOT N CREATE TABLE vicidial_outbound_ivr_log_archive LIKE vicidial_outbound_ivr_log; -UPDATE system_settings SET db_schema_version='1286',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1287',db_schema_update_date=NOW(); GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/agc_2-X/trunk/extras/upgrade_2.4.sql b/agc_2-X/trunk/extras/upgrade_2.4.sql index 5a1fcdc7..2a4c3f3f 100644 --- a/agc_2-X/trunk/extras/upgrade_2.4.sql +++ b/agc_2-X/trunk/extras/upgrade_2.4.sql @@ -876,3 +876,17 @@ ALTER TABLE vicidial_inbound_groups MODIFY next_agent_call VARCHAR(30) default ' UPDATE system_settings SET db_schema_version='1286',db_schema_update_date=NOW() where db_schema_version < 1286; +CREATE TABLE vicidial_agent_skip_log ( +user_skip_log_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +user VARCHAR(20), +event_date DATETIME, +lead_id INT(9) UNSIGNED, +campaign_id VARCHAR(20) default '', +previous_status VARCHAR(6) default '', +previous_called_count SMALLINT(5) UNSIGNED default '0', +index (user), +index (event_date), +index (campaign_id) +); + +UPDATE system_settings SET db_schema_version='1287',db_schema_update_date=NOW() where db_schema_version < 1287; diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt index a600278b..7a604d4a 100644 --- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt +++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt @@ -652,6 +652,22 @@ For AGENTDIRECT in-groups, you can put AGENTEXT in this field and the system wil You can also put AGENTEXT in this field if it is set to EXTENSION and the system will look up the user custom five field and send the call to that dialplan number|| orders by the last time an agent was sent an inbound call. Results in agents receiving about the same number of calls overall|| orders by the last time an agent finished an inbound call. AKA agent waiting longest receives first call|| +Servers|| +This is a list of the server IP addresses of existing servers in the system that you want the phone entries to be populated across. These must be valid IP addresses, they must be active in the system and you must put one per line in this text area input box|| +Phones|| +This is a list of the phone extensions that you want to be created on all of the servers listed above. The phone extensions should be letters and numbers only, with no special characters and you must put one per line in this text area box|| +Registration Password|| +This is the registration password that will be used for all of the phones that are created. For SIP and IAX2 protocol you should use a complex password for secutiry reasons|| +Login Password|| +This is the agent screen login password that will be used for all of the phones that are created|| +Create Alias Entries|| +Setting this option to YES will create a phones alias entry for each of the extensions listed above that will tie all of the same extension entries on each server together allowing phone login load balancing to work in the agent interface|| +Alias Suffix|| +This is the suffix that will be added to the extension to form the phone alias id. For example, if the extension is cc100 and the alias suffix is x, then the phone alias id used for that would be cc100x|| +Client Protocol|| +This is the phone protocol that will be used for all phones created when submitted. SIP and IAX2 are VOIP protocols that will create conf file entries to allow those phoens to register on the servers|| +Local GMT|| +This is the time zone that all of the phones will be created with|| lead_report_export.php diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php index 09cc1525..d824fff7 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -285,12 +285,13 @@ # 110430-1925 - Added post_phone_time_diff_alert campaign feature # 110625-0814 - Added screen_labels and label hide functions # 110626-0127 - Added queuemetrics_pe_phone_append +# 110718-1158 - Added logging of skipped leads # -$version = '2.4-190'; -$build = '110626-0127'; +$version = '2.4-191'; +$build = '110718-1158'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=418; +$mysql_log_count=419; $one_mysql_log=0; require("dbconnect.php"); @@ -2782,12 +2783,17 @@ if ($ACTION == 'manDiaLskip') else { $called_count = ($called_count - 1); - ### flag the lead as called and change it's status to INCALL + ### set the lead back to previous status and called_count $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00042',$user,$server_ip,$session_name,$one_mysql_log);} + ### log the skip event + $stmt = "INSERT INTO vicidial_agent_skip_log set campaign_id='$campaign', previous_status='$stage', previous_called_count='$called_count',user='$user', lead_id='$lead_id', event_date=NOW();"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00419',$user,$server_ip,$session_name,$one_mysql_log);} echo "LEAD REVERTED\n"; } diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index 363f8b7d..8ad3bcd3 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -358,10 +358,11 @@ # 110626-2234 - Added queuemetrics_pe_phone_append # 110707-1412 - Added last_inbound_call_time and finish compatibility # 110713-0048 - Allow for full hiding of the phone number field label +# 110718-1159 - Added logging of skipped leads # -$version = '2.4-335c'; -$build = '110713-0048'; +$version = '2.4-336c'; +$build = '110718-1159'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=73; $one_mysql_log=0; @@ -6654,7 +6655,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } if (xmlhttp) { - manDiaLskip_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLskip&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&lead_id=" + document.vicidial_form.lead_id.value + "&stage=" + previous_dispo + "&called_count=" + previous_called_count; + manDiaLskip_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLskip&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&lead_id=" + document.vicidial_form.lead_id.value + "&stage=" + previous_dispo + "&called_count=" + previous_called_count + "&campaign=" + campaign; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(manDiaLskip_query); diff --git a/agc_2-X/trunk/www/vicidial/admin_phones_bulk_insert.php b/agc_2-X/trunk/www/vicidial/admin_phones_bulk_insert.php index 14bcd115..54780740 100644 --- a/agc_2-X/trunk/www/vicidial/admin_phones_bulk_insert.php +++ b/agc_2-X/trunk/www/vicidial/admin_phones_bulk_insert.php @@ -1,16 +1,17 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # this screen will insert phones into your multi-server system with aliases # # changes: # 101230-0501 - First Build +# 110712-0932 - Added extension suffix exception for non-SIP/IAX phones, added HELP # -$admin_version = '2.4-1'; -$build = '101230-0501'; +$admin_version = '2.4-2'; +$build = '110712-0932'; require("dbconnect.php"); @@ -147,6 +148,69 @@ else ADMINISTRATION: Phones Bulk Insert <?php +################################################################################ +##### BEGIN help section +if ($action == "HELP") + { + ?> + + + +
+
+
+ Bulk Phones Insert Help +

+ + +
+ Servers - This is a list of the server IP addresses of existing servers in the system that you want the phone entries to be populated across. These must be valid IP addresses, they must be active in the system and you must put one per line in this text area input box. +

+ +
+
+ Phones - This is a list of the phone extensions that you want to be created on all of the servers listed above. The phone extensions should be letters and numbers only, with no special characters and you must put one per line in this text area box. +

+ +
+
+ Registration Password - This is the registration password that will be used for all of the phones that are created. For SIP and IAX2 protocol you should use a complex password for secutiry reasons. +

+ +
+
+ Login Password - This is the agent screen login password that will be used for all of the phones that are created. +

+ +
+
+ Create Alias Entries - Setting this option to YES will create a phones alias entry for each of the extensions listed above that will tie all of the same extension entries on each server together allowing phone login load balancing to work in the agent interface. +

+ +
+
+ Alias Suffix - This is the suffix that will be added to the extension to form the phone alias id. For example, if the extension is cc100 and the alias suffix is x, then the phone alias id used for that would be cc100x. +

+ +
+
+ Client Protocol - This is the phone protocol that will be used for all phones created when submitted. SIP and IAX2 are VOIP protocols that will create conf file entries to allow those phoens to register on the servers. +

+ +
+
+ Local GMT - This is the time zone that all of the phones will be created with. +

+ +
+ + + 0) echo "$DB,$action,$servers,$phones,$conf_secret,$pass,$alias_option,$protocol,$logal_gmt,$alias_suffix\n
"; } +$NWB = "   \"HELP\""; @@ -195,17 +261,17 @@ if ($action == "BLANK") 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 " $NWB#create_alias$NWE \n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo "
Servers:

(one server_ip per line only)
Phones:

(one extension per line only)
Registration Password:
Login Password:
Servers:

(one server_ip per line only)
$NWB#servers$NWE
Phones:

(one extension per line only)
$NWB#phones$NWE
Registration Password: $NWB#registration_password$NWE
Login Password: $NWB#login_password$NWE
Create Alias Entries:
Alias Suffix:
Client Protocol:
Local GMT: (Do NOT Adjust for DST)
Alias Suffix: $NWB#alias_suffix$NWE
Client Protocol: $NWB#protocol$NWE
Local GMT: (Do NOT Adjust for DST) $NWB#gmt$NWE
\n"; echo "\n"; @@ -316,7 +382,11 @@ if ($action == "ADD_PHONES_SUBMIT") if ($s >= 49) {$login_suffix = 'ax';} $extension = $PN[$p]; - $dialplan_number = "$dialplan_prefix$PN[$p]"; $dialplan_number = preg_replace('/\D/', '', $dialplan_number); + if ( ($protocol == 'SIP') or ($protocol == 'IAX2') ) + {$dialplan_number = "$dialplan_prefix$PN[$p]";} + else + {$dialplan_number = "$PN[$p]";} + $dialplan_number = preg_replace('/\D/', '', $dialplan_number); $voicemail_id = $PN[$p]; $voicemail_id = preg_replace('/\D/', '', $voicemail_id); $phone_server_ip = $SN[$s]; $login = "$PN[$p]$login_suffix"; diff --git a/agc_2-X/trunk/www/vicidial/user_stats.php b/agc_2-X/trunk/www/vicidial/user_stats.php index 8fd1d4fa..2a77952b 100644 --- a/agc_2-X/trunk/www/vicidial/user_stats.php +++ b/agc_2-X/trunk/www/vicidial/user_stats.php @@ -30,6 +30,7 @@ # 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links # 110218-1523 - Added searches display # 110703-1836 - Added download option +# 110718-1204 - Added skipped manual dial leads display # @@ -989,6 +990,42 @@ if ($did < 1) $MAIN.="

\n"; } +if ($did < 1) + { + ##### vicidial agent manual dial lead preview skips for this time period ##### + + $MAIN.="PREVIEW LEAD SKIPS FOR THIS TIME PERIOD: (10000 record limit)     [DOWNLOAD]\n"; + $MAIN.="\n"; + $MAIN.="\n"; + $CSV_text11.="\"PREVIEW LEAD SKIPS FOR THIS TIME PERIOD: (10000 record limit)\"\n"; + $CSV_text11.="\"\",\"#\",\"DATE/TIME\",\"LEAD ID\",\"STATUS\",\"COUNT\",\"CAMPAIGN\"\n"; + + $stmt="select user,event_date,lead_id,campaign_id,previous_status,previous_called_count from vicidial_agent_skip_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by event_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + $MAIN.=""; + $MAIN.=""; + $MAIN.=""; + $MAIN.="\n"; + $MAIN.="\n"; + $MAIN.="\n"; + $MAIN.="\n"; + $CSV_text11.="\"\",\"$u\",\"$row[1]\",\"$row[2]\",\"$row[4]\",\"$row[5]\",\"$row[3]\"\n"; + } + $MAIN.="
# DATE/TIME   LEAD ID   STATUS   COUNT   CAMPAIGN
$u$row[1] $row[2] $row[4] $row[5] $row[3]


\n"; + } + $ENDtime = date("U"); @@ -1004,34 +1041,37 @@ $MAIN.=""; $MAIN.=""; - if ($file_download>0) { - $FILE_TIME = date("Ymd-His"); - $CSVfilename = "user_stats_$US$FILE_TIME.csv"; - $CSV_var="CSV_text".$file_download; - $CSV_text=preg_replace('/^\s+/', '', $$CSV_var); - $CSV_text=preg_replace('/\n\s+,/', ',', $CSV_text); - $CSV_text=preg_replace('/ +\"/', '"', $CSV_text); - $CSV_text=preg_replace('/\" +/', '"', $CSV_text); - // We'll be outputting a TXT file - header('Content-type: application/octet-stream'); +if ($file_download>0) + { + $FILE_TIME = date("Ymd-His"); + $CSVfilename = "user_stats_$US$FILE_TIME.csv"; + $CSV_var="CSV_text".$file_download; + $CSV_text=preg_replace('/^\s+/', '', $$CSV_var); + $CSV_text=preg_replace('/\n\s+,/', ',', $CSV_text); + $CSV_text=preg_replace('/ +\"/', '"', $CSV_text); + $CSV_text=preg_replace('/\" +/', '"', $CSV_text); + // We'll be outputting a TXT file + header('Content-type: application/octet-stream'); - // It will be called LIST_101_20090209-121212.txt - header("Content-Disposition: attachment; filename=\"$CSVfilename\""); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - ob_clean(); - flush(); + // It will be called LIST_101_20090209-121212.txt + header("Content-Disposition: attachment; filename=\"$CSVfilename\""); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Pragma: public'); + ob_clean(); + flush(); - echo "$CSV_text"; + echo "$CSV_text"; - exit; - } else { - header ("Content-type: text/html; charset=utf-8"); - echo $HEADER; - require("admin_header.php"); - echo $MAIN; - exit; + exit; + } +else + { + header ("Content-type: text/html; charset=utf-8"); + echo $HEADER; + require("admin_header.php"); + echo $MAIN; + exit; }