Fixed auto-generated conf file bug for globals varaibles
Added welcome to VICIDIAL sound and set it to first testing extension trunk - more Vtiger enhancements, fax and email log entries git-svn-id: svn://192.168.202.10@1086 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
# 90211-1236 - Added auto-generation of conf files functions
|
||||
# 90213-0625 - Separated the reloading of Asterisk into 4 separate steps
|
||||
# 90325-2239 - Rewrote sending of reload commands to Asterisk
|
||||
# 90327-1421 - Removed [globals] tag from auto-generated extensions file
|
||||
#
|
||||
|
||||
$DB=0; # Debug flag
|
||||
@@ -848,7 +849,6 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
|
||||
open(vm, ">/etc/asterisk/voicemail-vicidial.conf") || die "can't open /etc/asterisk/voicemail-vicidial.conf: $!\n";
|
||||
|
||||
print ext "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
|
||||
print ext "[globals]\n";
|
||||
print ext "$ext\n";
|
||||
print ext "[vicidial-auto]\n";
|
||||
print ext "exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})\n";
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
# CHANGES
|
||||
# 90127-1206 - First build
|
||||
# 90318-0142 - Added vicidialalt import format and importasdeleted option
|
||||
# 90327-1149 - Added phone-limit option
|
||||
#
|
||||
|
||||
$secX = time();
|
||||
@@ -107,6 +108,7 @@ if (length($ARGV[0])>1)
|
||||
print " [--duplicate-system-siccode] = checks for the same SIC code in the entire system before inserting lead\n";
|
||||
print " [--duplicate-system-website] = checks for the same website in the entire system before inserting lead\n";
|
||||
print " [--import-as-deleted] = imports the accounts as deleted in vtiger_crmentity\n";
|
||||
print " [--phone-limit=X] = limit phone and fax numbers to X digits\n";
|
||||
print " [--ftp-pull] = grabs lead files from a remote FTP server, uses REPORTS FTP login information\n";
|
||||
print " [--ftp-dir=leads_in] = remote FTP server directory to grab files from, should have a DONE sub-directory\n";
|
||||
print " [--email-list=test@test.com:test2@test.com] = send email results for each file to these addresses\n";
|
||||
@@ -161,6 +163,16 @@ if (length($ARGV[0])>1)
|
||||
else
|
||||
{$format = 'standard';}
|
||||
|
||||
if ($args =~ /-phone-limit=/i)
|
||||
{
|
||||
@data_in = split(/-phone-limit=/,$args);
|
||||
$phone_limit = $data_in[1];
|
||||
$phone_limit =~ s/ .*//gi;
|
||||
print "\n----- PHONE LIMIT: $phone_limit -----\n\n";
|
||||
}
|
||||
else
|
||||
{$phone_limit = 0;}
|
||||
|
||||
if ($args =~ /-duplicate-system-check/i)
|
||||
{
|
||||
$dupchecksys=1;
|
||||
@@ -410,10 +422,13 @@ foreach(@FILES)
|
||||
$state = $m[5]; chomp($state);
|
||||
$post_code = $m[6]; chomp($post_code);
|
||||
$phone_number = $m[2]; chomp($phone_number); $phone_number =~ s/\D//gi;
|
||||
if ($phone_limit > 6) {while (length($phone_number)>$phone_limit) {chop($phone_number);} }
|
||||
$ownership = $m[1]; chomp($ownership);
|
||||
$other_phone = '';
|
||||
if ($phone_limit > 6) {while (length($other_phone)>$phone_limit) {chop($other_phone);} }
|
||||
$email = '';
|
||||
$fax = '';
|
||||
if ($phone_limit > 6) {while (length($fax)>$phone_limit) {chop($fax);} }
|
||||
$other_email = '';
|
||||
$website = '';
|
||||
$emailoptout = '0';
|
||||
@@ -442,10 +457,13 @@ foreach(@FILES)
|
||||
$state = $m[8]; chomp($state);
|
||||
$post_code = $m[9]; chomp($post_code);
|
||||
$phone_number = $m[10]; chomp($phone_number); $phone_number =~ s/\D//gi;
|
||||
if ($phone_limit > 6) {while (length($phone_number)>$phone_limit) {chop($phone_number);} }
|
||||
$ownership = $m[11]; chomp($ownership);
|
||||
$fax = $m[12]; chomp($fax);
|
||||
if ($phone_limit > 6) {while (length($fax)>$phone_limit) {chop($fax);} }
|
||||
$email = $m[13]; chomp($email);
|
||||
$other_phone = $m[14]; chomp($other_phone);
|
||||
if ($phone_limit > 6) {while (length($other_phone)>$phone_limit) {chop($other_phone);} }
|
||||
$other_email = $m[15]; chomp($other_email);
|
||||
$website = $m[16]; chomp($website);
|
||||
if (length($website)<3) {$website="$web1-$revenue";}
|
||||
@@ -475,10 +493,13 @@ foreach(@FILES)
|
||||
$state = $m[8]; chomp($state);
|
||||
$post_code = $m[9]; chomp($post_code);
|
||||
$phone_number = $m[10]; chomp($phone_number); $phone_number =~ s/\D//gi;
|
||||
if ($phone_limit > 6) {while (length($phone_number)>$phone_limit) {chop($phone_number);} }
|
||||
$ownership = $m[11]; chomp($ownership);
|
||||
$fax = $m[12]; chomp($fax);
|
||||
if ($phone_limit > 6) {while (length($fax)>$phone_limit) {chop($fax);} }
|
||||
$email = $m[13]; chomp($email);
|
||||
$other_phone = $m[14]; chomp($other_phone);
|
||||
if ($phone_limit > 6) {while (length($other_phone)>$phone_limit) {chop($other_phone);} }
|
||||
$other_email = $m[15]; chomp($other_email);
|
||||
$website = $m[16]; chomp($website);
|
||||
if (length($website)<3) {$website="$sic_code-$revenue";}
|
||||
|
||||
@@ -0,0 +1,617 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Vtiger_IN_notes_activities_file.pl version 2.2.0 *DBI-version*
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# script lets you insert notes and activities into the vtiger system from a
|
||||
# CSV-formatted file that is in the proper format. (for format see --help)
|
||||
#
|
||||
# NOTE - written for a specific client use, you will probably need to modify
|
||||
# this script to be able to use it for your purposes
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
#
|
||||
# CHANGES
|
||||
# 90327-1148 - First build
|
||||
#
|
||||
|
||||
$secX = time();
|
||||
$MT[0]='';
|
||||
$Ealert='';
|
||||
$importasdeleted=0;
|
||||
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
$year = ($year + 1900);
|
||||
$mon++;
|
||||
if ($hour < 10) {$hour = "0$hour";}
|
||||
if ($min < 10) {$min = "0$min";}
|
||||
if ($sec < 10) {$sec = "0$sec";}
|
||||
if ($mon < 10) {$mon = "0$mon";}
|
||||
if ($mday < 10) {$mday = "0$mday";}
|
||||
$pulldate0 = "$year-$mon-$mday $hour:$min:$sec";
|
||||
$NOW_TIME = "$year-$mon-$mday $hour:$min:$sec";
|
||||
$inSD = $pulldate0;
|
||||
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
|
||||
$MT[0]='';
|
||||
|
||||
|
||||
# default path to astguiclient configuration file:
|
||||
$PATHconf = '/etc/astguiclient.conf';
|
||||
|
||||
open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
|
||||
@conf = <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;}
|
||||
if ( ($line =~ /^VARREPORT_host/) && ($CLIREPORT_host < 1) )
|
||||
{$VARREPORT_host = $line; $VARREPORT_host =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARREPORT_user/) && ($CLIREPORT_user < 1) )
|
||||
{$VARREPORT_user = $line; $VARREPORT_user =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARREPORT_pass/) && ($CLIREPORT_pass < 1) )
|
||||
{$VARREPORT_pass = $line; $VARREPORT_pass =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARREPORT_port/) && ($CLIREPORT_port < 1) )
|
||||
{$VARREPORT_port = $line; $VARREPORT_port =~ s/.*=//gi;}
|
||||
$i++;
|
||||
}
|
||||
|
||||
# Customized Variables
|
||||
$server_ip = $VARserver_ip; # Asterisk server IP
|
||||
|
||||
|
||||
if (!$VDHLOGfile) {$VDHLOGfile = "$PATHlogs/addnotes.$year-$mon-$mday";}
|
||||
|
||||
### begin parsing run-time options ###
|
||||
if (length($ARGV[0])>1)
|
||||
{
|
||||
$i=0;
|
||||
while ($#ARGV >= $i)
|
||||
{
|
||||
$args = "$args $ARGV[$i]";
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($args =~ /--help|-h/i)
|
||||
{
|
||||
print "allowed run time options:\n";
|
||||
print " [-q] = quiet\n";
|
||||
print " [-t] = test\n";
|
||||
print " [--debug] = debug output\n";
|
||||
print " [--format=notes] = select whether you are importing notes or activities\n";
|
||||
print " [--ftp-pull] = grabs lead files from a remote FTP server, uses REPORTS FTP login information\n";
|
||||
print " [--ftp-dir=leads_in] = remote FTP server directory to grab files from, should have a DONE sub-directory\n";
|
||||
print " [--email-list=test@test.com:test2@test.com] = send email results for each file to these addresses\n";
|
||||
print " [--email-sender=vicidial@localhost] = sender for the email results\n";
|
||||
print " [-h] = this help screen\n\n";
|
||||
print "\n";
|
||||
print "This script takes in notes or activities CSV files in the following order when they are placed in the $PATHhome/VTIGER_IN directory to be imported into the vtiger system (examples):\n\n";
|
||||
print "notes:\n";
|
||||
print "account,sequence,status,date,notes1,notes2\n";
|
||||
print "39207955,2,ANSWERING MACHINE,01/30/09,SPOKE WITH DEVONNE,SHE PLACED AN ORDER ONLINE THIS MORNING WILL CALL HER BACK IN TWO WEEKS ON FEB 19\n\n";
|
||||
print "activity:\n";
|
||||
print "account,sequence,date,time,session_length,call_length,status\n";
|
||||
print "39207955,2,01/30/09,14:47:42,205,116,ANSWERING MACHINE\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($args =~ /-debug/i)
|
||||
{
|
||||
$DB=1;
|
||||
print "\n----- DEBUGGING -----\n\n";
|
||||
}
|
||||
if ($args =~ /-debugX/i)
|
||||
{
|
||||
$DBX=1;
|
||||
print "\n----- SUPER-DUPER DEBUGGING -----\n\n";
|
||||
}
|
||||
else {$DBX=0;}
|
||||
|
||||
if ($args =~ /-q/i)
|
||||
{
|
||||
$q=1;
|
||||
}
|
||||
if ($args =~ /-t/i)
|
||||
{
|
||||
$T=1;
|
||||
$TEST=1;
|
||||
print "\n----- TESTING -----\n\n";
|
||||
}
|
||||
|
||||
if ($args =~ /-format=/i)
|
||||
{
|
||||
@data_in = split(/-format=/,$args);
|
||||
$format = $data_in[1];
|
||||
$format =~ s/ .*//gi;
|
||||
print "\n----- FORMAT OVERRIDE: $format -----\n\n";
|
||||
}
|
||||
else
|
||||
{$format = 'standard';}
|
||||
|
||||
if ($args =~ /-ftp-pull/i)
|
||||
{
|
||||
$ftp_pull=1;
|
||||
print "\n----- FTP LEAD FILE PULL -----\n\n";
|
||||
}
|
||||
if ($args =~ /--ftp-dir=/i)
|
||||
{
|
||||
@data_in = split(/--ftp-dir=/,$args);
|
||||
$ftp_dir = $data_in[1];
|
||||
$ftp_dir =~ s/ .*//gi;
|
||||
print "\n----- REMOTE FTP DIRECTORY: $ftp_dir -----\n\n";
|
||||
}
|
||||
else
|
||||
{$ftp_dir = '';}
|
||||
|
||||
if ($args =~ /--email-list=/i)
|
||||
{
|
||||
@data_in = split(/--email-list=/,$args);
|
||||
$email_list = $data_in[1];
|
||||
$email_list =~ s/ .*//gi;
|
||||
$email_list =~ s/:/,/gi;
|
||||
print "\n----- EMAIL NOTIFICATION: $email_list -----\n\n";
|
||||
}
|
||||
else
|
||||
{$email_list = '';}
|
||||
|
||||
if ($args =~ /--email-sender=/i)
|
||||
{
|
||||
@data_in = split(/--email-sender=/,$args);
|
||||
$email_sender = $data_in[1];
|
||||
$email_sender =~ s/ .*//gi;
|
||||
$email_sender =~ s/:/,/gi;
|
||||
print "\n----- EMAIL NOTIFICATION SENDER: $email_sender -----\n\n";
|
||||
}
|
||||
else
|
||||
{$email_sender = 'vicidial@localhost';}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "no command line options set\n";
|
||||
$args = "";
|
||||
$i=0;
|
||||
$forcelistid = '';
|
||||
$format='standard';
|
||||
}
|
||||
if ($format !~ /notes|activities/)
|
||||
{$format='notes';}
|
||||
### end parsing run-time options ###
|
||||
|
||||
if ($q < 1)
|
||||
{
|
||||
print "\n\n\n\n\n\n\n\n\n\n\n\n-- Vtiger_IN_notes_activities.pl --\n\n";
|
||||
print "This program is designed to take a CSV delimited file and import it as notes or activities into the Vtiger system. \n\n";
|
||||
}
|
||||
|
||||
$i=0;
|
||||
$US = '_';
|
||||
$phone_list = '|';
|
||||
$DASH='-';
|
||||
|
||||
if (!$VARDB_port) {$VARDB_port='3306';}
|
||||
|
||||
use DBI;
|
||||
|
||||
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
|
||||
or die "Couldn't connect to database: " . DBI->errstr;
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmtA = "SELECT use_non_latin,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass 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;
|
||||
$non_latin = "$aryA[0]";
|
||||
$vtiger_server_ip = "$aryA[1]";
|
||||
$vtiger_dbname = "$aryA[2]";
|
||||
$vtiger_login = "$aryA[3]";
|
||||
$vtiger_pass = "$aryA[4]";
|
||||
}
|
||||
$sthA->finish();
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
$dbhB = DBI->connect("DBI:mysql:$vtiger_dbname:$vtiger_server_ip:$VARDB_port", "$vtiger_login", "$vtiger_pass")
|
||||
or die "Couldn't connect to database: " . DBI->errstr;
|
||||
|
||||
if ($non_latin > 0) {$affected_rows = $dbhA->do("SET NAMES 'UTF8'");}
|
||||
|
||||
$suf = '.txt';
|
||||
$people_packages_id_update='';
|
||||
$dir1 = "$PATHhome/VTIGER_IN";
|
||||
$dir2 = "$PATHhome/VTIGER_IN/DONE";
|
||||
|
||||
if($DBX){print STDERR "\nVTIGER_IN directory: |$dir1|\n";}
|
||||
|
||||
if ($ftp_pull > 0)
|
||||
{
|
||||
$i=0;
|
||||
use Net::FTP;
|
||||
|
||||
$files_copied_count=0;
|
||||
|
||||
$ftp = Net::FTP->new("$VARREPORT_host", Port => "$VARREPORT_port", Debug => "$DBX", Passive => 1)
|
||||
or die "Can't connect: $@\n";
|
||||
$ftp->login("$VARREPORT_user","$VARREPORT_pass") or die "Cannot log in /: $!";
|
||||
@FILES = $ftp->dir("$ftp_dir")
|
||||
or die "Can't get a list of files in $ftp_dir: $!";
|
||||
|
||||
foreach(@FILES)
|
||||
{
|
||||
if ($DBX > 0) {print "$FILES[$i]\n";}
|
||||
if ($FILES[$i] !~ /^d/i)
|
||||
{
|
||||
chomp($FILES[$i]);
|
||||
@FILEDETAILS = split(/ \d\d:\d\d /, $FILES[$i]);
|
||||
$FILES[$i] = "$FILEDETAILS[1]";
|
||||
$FILES[$i] =~ s/ *$//gi;
|
||||
|
||||
if (length($FILES[$i]) > 4)
|
||||
{
|
||||
$GOODfname = $FILES[$i];
|
||||
$FILES[$i] =~ s/ /_/gi;
|
||||
$FILES[$i] =~ s/\(|\)|\||\\|\/|\'|\"|//gi;
|
||||
$ftp->rename("$ftp_dir/$GOODfname","$ftp_dir/$FILES[$i]");
|
||||
$FILEname = $FILES[$i];
|
||||
$ftp->get("$ftp_dir/$FILES[$i]", "$dir1/$FILES[$i]");
|
||||
|
||||
if (!$TEST) {$ftp->rename("$ftp_dir/$FILES[$i]", "$ftp_dir/DONE/$FILES[$i]");}
|
||||
if ($DB > 0) {print "FTP FILE COPIED: $FILES[$i]\n";}
|
||||
$files_copied_count++;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if (!$q) {print "$ftp_dir - $VARREPORT_host - $#FILES - $files_copied_count\n";}
|
||||
}
|
||||
|
||||
|
||||
$i=0;
|
||||
@FILES=@MT;
|
||||
opendir(FILE, "$dir1/");
|
||||
@FILES = readdir(FILE);
|
||||
|
||||
foreach(@FILES)
|
||||
{
|
||||
$size1 = 0;
|
||||
$size2 = 0;
|
||||
$person_id_delete = '';
|
||||
$transaction_id_delete = '';
|
||||
|
||||
if (length($FILES[$i]) > 4)
|
||||
{
|
||||
|
||||
$size1 = (-s "$dir1/$FILES[$i]");
|
||||
if (!$q) {print "$FILES[$i] $size1\n";}
|
||||
sleep(2);
|
||||
$size2 = (-s "$dir1/$FILES[$i]");
|
||||
if (!$q) {print "$FILES[$i] $size2\n\n";}
|
||||
|
||||
|
||||
if ( ($FILES[$i] !~ /^TRANSFERRED/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4))
|
||||
{
|
||||
$GOODfname = $FILES[$i];
|
||||
$FILES[$i] =~ s/ /_/gi;
|
||||
$FILES[$i] =~ s/\(|\)|\||\\|\/|\'|\"|//gi;
|
||||
rename("$dir1/$GOODfname","$dir1/$FILES[$i]");
|
||||
$FILEname = $FILES[$i];
|
||||
|
||||
`cp -f $dir1/$FILES[$i] $dir2/$source$FILES[$i]`;
|
||||
|
||||
### open the in file for reading ###
|
||||
open(infile, "$dir2/$source$FILES[$i]")
|
||||
|| die "Can't open $source$FILES[$i]: $!\n";
|
||||
|
||||
$a=0; ### each line of input file counter ###
|
||||
$b=0; ### status of 'APPROVED' counter ###
|
||||
$c=0; ### status of 'DECLINED' counter ###
|
||||
$d=0; ### status of 'REFERRED' counter ###
|
||||
$e=0; ### status of 'ERROR' counter ###
|
||||
$f=0; ### number of 'NOTFOUND' counter ###
|
||||
$g=0; ### number of leads with multi-alt-entries
|
||||
|
||||
$multi_insert_counter=0;
|
||||
$multistmt='';
|
||||
|
||||
#if ($DB)
|
||||
while (<infile>)
|
||||
{
|
||||
@m=@MT;
|
||||
# print "$a| $number\n";
|
||||
$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;
|
||||
@m = split(/\|/, $number);
|
||||
|
||||
$format_set=0;
|
||||
|
||||
### This is the format for the activities files
|
||||
# account,sequence,date,time,session_length,call_length,status
|
||||
# 39207955,2,01/30/09,14:47:42,205,116,ANSWERING MACHINE
|
||||
if ( ($format =~ /activities/) && ($format_set < 1) )
|
||||
{
|
||||
$format='activities';
|
||||
$web1 = $m[0]; chomp($web1); $web1 =~ s/\D//gi;
|
||||
$revenue = $m[1]; chomp($revenue); $revenue =~ s/\D//gi;
|
||||
$date = $m[2]; chomp($date);
|
||||
$time = $m[3]; chomp($time);
|
||||
$session_length = $m[4]; chomp($session_length);
|
||||
$call_length = $m[5]; chomp($call_length);
|
||||
$status = $m[6]; chomp($status);
|
||||
$website="$web1$DASH$revenue";
|
||||
@date_array = split(/\//,$date);
|
||||
$YYYY = $date_array[2]; $YYYY = ($YYYY + 2000);
|
||||
$MM = $date_array[0];
|
||||
$DD = $date_array[1];
|
||||
$date = "$YYYY-$MM-$DD";
|
||||
if ($session_length > 300)
|
||||
{$session_length = int($session_length / 60);}
|
||||
else
|
||||
{$session_length = '5';}
|
||||
@time_array = split(/:/,$time);
|
||||
$HH = ($time_array[0] + 0);
|
||||
$MM = ($time_array[1] + $session_length);
|
||||
$SS = $time_array[2];
|
||||
if ($MM > 59)
|
||||
{$MM = ($MM - 60); $HH = ($HH + 1);}
|
||||
if ($HH < 10) {$HH = "0$HH";}
|
||||
if ($MM < 10) {$MM = "0$MM";}
|
||||
$end_time = "$HH:$MM:$SS";
|
||||
|
||||
$format_set++;
|
||||
}
|
||||
|
||||
### This is the format for the notes files
|
||||
# account,sequence,status,date,notes1,notes2
|
||||
# 39207955,2,ANSWERING MACHINE,01/30/09,SPOKE WITH DEVONNE,SHE PLACED AN ORDER ONLINE THIS MORNING WILL CALL HER BACK IN TWO WEEKS ON FEB 19
|
||||
if ( ($format =~ /notes/) || ($format_set < 1) )
|
||||
{
|
||||
$format='notes';
|
||||
$web1 = $m[0]; chomp($web1); $web1 =~ s/\D//gi;
|
||||
$revenue = $m[1]; chomp($revenue); $revenue =~ s/\D//gi;
|
||||
$status = $m[2]; chomp($status);
|
||||
$date = $m[3]; chomp($date);
|
||||
$notes = "$m[4] $m[5]"; chomp($notes);
|
||||
$website="$web1$DASH$revenue";
|
||||
@date_array = split(/\//,$date);
|
||||
$YYYY = $date_array[2]; $YYYY = ($YYYY + 2000);
|
||||
$MM = $date_array[0];
|
||||
$DD = $date_array[1];
|
||||
$date = "$YYYY-$MM-$DD";
|
||||
$time = "14:00";
|
||||
|
||||
$format_set++;
|
||||
}
|
||||
|
||||
if ($DBX) {print "$a|$web1|$revenue|$website| $number\n";}
|
||||
|
||||
|
||||
|
||||
if (length($web1)>0)
|
||||
{
|
||||
# Get current vendor ID from vtiger_account
|
||||
$stmtB="SELECT accountid from vtiger_account where website='$website';";
|
||||
if($DBX){print STDERR "\n|$stmtB|\n";}
|
||||
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||
$sthBrows=$sthB->rows;
|
||||
if ($sthBrows < 1)
|
||||
{
|
||||
$sthB->finish();
|
||||
|
||||
print "BAD Account Not Found: $website|$a\n"; $f++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@aryB = $sthB->fetchrow_array;
|
||||
$vendor_id = $aryB[0];
|
||||
$sthB->finish();
|
||||
|
||||
|
||||
$user='6666';
|
||||
|
||||
#Get logged in user ID
|
||||
$stmtB="SELECT id from vtiger_users where user_name='$user';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||
$sthBrows=$sthB->rows;
|
||||
if ($sthBrows > 0)
|
||||
{
|
||||
@aryB = $sthB->fetchrow_array;
|
||||
$user_id = $aryB[0];
|
||||
}
|
||||
$sthB->finish();
|
||||
|
||||
# Get current ID from vtiger_crmentity_seq
|
||||
$stmtB="SELECT id from vtiger_crmentity_seq;";
|
||||
if($DBX){print STDERR "\n|$stmtB|\n";}
|
||||
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||
$sthBrows=$sthB->rows;
|
||||
if ($sthBrows > 0)
|
||||
{
|
||||
@aryB = $sthB->fetchrow_array;
|
||||
$crm_id = ($aryB[0] + 1);
|
||||
}
|
||||
$sthB->finish();
|
||||
|
||||
### update the crm ID ###
|
||||
$stmtB = "UPDATE vtiger_crmentity_seq SET id = '$crm_id';";
|
||||
if (!$T) {$affected_rows = $dbhB->do($stmtB); } # or die "Couldn't execute query: |$stmtB|\n";
|
||||
if($DB){print STDERR "\n|$affected_rows|$stmtB|\n";}
|
||||
|
||||
if ($format =~ /activities/)
|
||||
{
|
||||
### insert record into vtiger_salesmanactivityrel table ###
|
||||
$stmtB = "INSERT INTO vtiger_salesmanactivityrel SET smid='$user_id',activityid='$crm_id';";
|
||||
if (!$T) {$affected_rows = $dbhB->do($stmtB); } # or die "Couldn't execute query: |$stmtB|\n";
|
||||
if($DB){print STDERR "\n|$affected_rows|$stmtB|\n";}
|
||||
|
||||
### insert record into vtiger_seactivityrel table ###
|
||||
$stmtB = "INSERT INTO vtiger_seactivityrel SET crmid='$vendor_id',activityid='$crm_id';";
|
||||
if (!$T) {$affected_rows = $dbhB->do($stmtB); } # or die "Couldn't execute query: |$stmtB|\n";
|
||||
if($DB){print STDERR "\n|$affected_rows|$stmtB|\n";}
|
||||
|
||||
### insert record into crmentity table ###
|
||||
$stmtB = "INSERT INTO vtiger_crmentity SET crmid='$crm_id',smcreatorid='$user_id',smownerid='$user_id',modifiedby='$user_id',setype='Calendar',description='Old Call: $status',createdtime='$date $time',modifiedtime='$date $time', viewedtime='$date $time';";
|
||||
if (!$T) {$affected_rows = $dbhB->do($stmtB); } # or die "Couldn't execute query: |$stmtB|\n";
|
||||
if($DB){print STDERR "\n|$affected_rows|$stmtB|\n";}
|
||||
|
||||
### insert record into vtiger_activity table ###
|
||||
$stmtB = "INSERT INTO vtiger_activity SET activityid='$crm_id',subject='Old Call: $status',activitytype='Call',date_start='$date',due_date='$date',time_start='$time',time_end='$end_time',sendnotification='0',duration_hours='0',duration_minutes='$session_length',status='',eventstatus='Held',priority='Medium',location='VICIDIAL User $user',notime='0',visibility='Public',recurringtype='--None--';";
|
||||
if (!$T) {$affected_rows = $dbhB->do($stmtB); } # or die "Couldn't execute query: |$stmtB|\n";
|
||||
if($DB){print STDERR "\n|$affected_rows|$stmtB|\n";}
|
||||
}
|
||||
else
|
||||
{
|
||||
### insert record into crmentity table ###
|
||||
$stmtB = "INSERT INTO vtiger_crmentity SET crmid='$crm_id',smcreatorid='$user_id',smownerid='$user_id',modifiedby='$user_id',setype='Notes',description='Old Notes: $status',createdtime='$date $time',modifiedtime='$date $time', viewedtime='$date $time';";
|
||||
if (!$T) {$affected_rows = $dbhB->do($stmtB); } # or die "Couldn't execute query: |$stmtB|\n";
|
||||
if($DB){print STDERR "\n|$affected_rows|$stmtB|\n";}
|
||||
|
||||
### insert record into vtiger_notes table ###
|
||||
$stmtB = "INSERT INTO vtiger_notes SET notesid='$crm_id',title='Old Notes: $status',notecontent='$notes';";
|
||||
if (!$T) {$affected_rows = $dbhB->do($stmtB); } # or die "Couldn't execute query: |$stmtB|\n";
|
||||
if($DB){print STDERR "\n|$affected_rows|$stmtB|\n";}
|
||||
|
||||
### insert record into vtiger_senotesrel table ###
|
||||
$stmtB = "INSERT INTO vtiger_senotesrel SET crmid='$vendor_id',notesid='$crm_id';";
|
||||
if (!$T) {$affected_rows = $dbhB->do($stmtB); } # or die "Couldn't execute query: |$stmtB|\n";
|
||||
if($DB){print STDERR "\n|$affected_rows|$stmtB|\n";}
|
||||
}
|
||||
|
||||
$b++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "BAD Account Number: $web1|$revenue|$a\n"; $e++;
|
||||
}
|
||||
|
||||
$a++;
|
||||
|
||||
if ($a =~ /100$/i) {print STDERR "0 $a\r";}
|
||||
if ($a =~ /200$/i) {print STDERR "+ $a\r";}
|
||||
if ($a =~ /300$/i) {print STDERR "| $a\r";}
|
||||
if ($a =~ /400$/i) {print STDERR "\\ $a\r";}
|
||||
if ($a =~ /500$/i) {print STDERR "- $a\r";}
|
||||
if ($a =~ /600$/i) {print STDERR "/ $a\r";}
|
||||
if ($a =~ /700$/i) {print STDERR "| $a\r";}
|
||||
if ($a =~ /800$/i) {print STDERR "+ $a\r";}
|
||||
if ($a =~ /900$/i) {print STDERR "0 $a\r";}
|
||||
if ($a =~ /000$/i) {print "$a|$b|$c|$d|$e|$f|$g|$phone_number|\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
### open the stats out file for writing ###
|
||||
open(Sout, ">>$VDHLOGfile")
|
||||
|| die "Can't open $VDHLOGfile: $!\n";
|
||||
|
||||
|
||||
### close file handler and DB connections ###
|
||||
$Falert = "\n\nTOTALS FOR $FILEname:\n";
|
||||
$Falert .= "Lines in file: $a\n";
|
||||
$Falert .= "INSERTED: $b\n";
|
||||
$Falert .= "INSERT STATEMENTS: $c\n";
|
||||
$Falert .= "ERROR: $e\n";
|
||||
$Falert .= "NOT FOUND: $f\n";
|
||||
$Falert .= "MULTI-ALT-PHONE: $g\n";
|
||||
|
||||
print "$Falert";
|
||||
print Sout "$Falert";
|
||||
$Ealert .= "$Falert";
|
||||
|
||||
close(infile);
|
||||
close(Sout);
|
||||
chmod 0777, "$VDHLOGfile";
|
||||
|
||||
### Move file to the DONE directory locally
|
||||
if (!$T) {`mv -f $dir1/$FILEname $dir2/$FILEname`;}
|
||||
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$dbhA->disconnect();
|
||||
|
||||
### calculate time to run script ###
|
||||
$secY = time();
|
||||
$secZ = ($secY - $secX);
|
||||
$secZm = ($secZ /60);
|
||||
|
||||
if ($q < 1)
|
||||
{
|
||||
print "script execution time in seconds: $secZ minutes: $secZm\n";
|
||||
}
|
||||
|
||||
###### EMAIL SECTION
|
||||
|
||||
if ( (length($Ealert)>5) && (length($email_list) > 3) )
|
||||
{
|
||||
print "Sending email: $email_list\n";
|
||||
|
||||
use MIME::QuotedPrint;
|
||||
use MIME::Base64;
|
||||
use Mail::Sendmail;
|
||||
|
||||
$mailsubject = "VTIGER ACCOUNT FILE LOAD $pulldate0";
|
||||
|
||||
%mail = ( To => "$email_list",
|
||||
From => "$email_sender",
|
||||
Subject => "$mailsubject",
|
||||
Message => "VTIGER ACCOUNT FILE LOAD $pulldate0\n\n$Ealert\n"
|
||||
);
|
||||
sendmail(%mail) or die $mail::Sendmail::error;
|
||||
print "ok. log says:\n", $mail::sendmail::log; ### print mail log for status
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
+4
-1
@@ -11,6 +11,7 @@ Current integration features:
|
||||
- Added ViciDial status synchronization after each call to set the siccode field in Vtiger to the last selected VICIDIAL status
|
||||
- Ability to un-delete or resurrect deleted Accounts within Vtiger from the web form(this is a VICIDIAL campaign option)
|
||||
- Ability to click-to-dial a phone number from a record in Vtiger screen to the vicidial.php screen
|
||||
- Ability for an agent to click on a VC fax log or VC email log link to account for fax or email time through VICIDIAL
|
||||
- Optional script to bulk load leads into Vtiger from a CSV file since Vtiger only seems to want to load 500 at a time:
|
||||
Vtiger_IN_new_accounts_file.pl
|
||||
- Batch Account synchronization through script to output new leads from Vtiger and update existing leads in the VICIDIAL system:
|
||||
@@ -19,7 +20,7 @@ Current integration features:
|
||||
|
||||
There has been a basic vtiger integration option available in VICIDIAL since the 1.X release versions through the vtiger_search.php web script(when used as a web form in the campaign) that will search through the leads for the dialed phone number in vicidial.php and if it is not in the vtiger system as a lead then it will be put in as a new lead.
|
||||
|
||||
More in-depth integration with Vtiger is a bit complicated due to the fact that it has 312 database tables(and you though VICIDIAL had a lot with about 70). Attempts at using the built-in 5.0.4 API structure were unsuccessful because of inaccurate documentation and the inability to use the modules easily outside of the vtiger directory tree without major reworking of the vtiger code, so we decided to have VICIDIAL work directly with the database instead. Unfortunately, working only with the database doesn't get you the whole way with Vtiger. For user synchronization you need to make sure that the patch(Vtiger504_vicidial.patch) is applied to Vtiger(see instructions below). This patch is used to create blank user profile files so Vtiger will load properly with synchronized users from VICIDIAL. Vtiger doesn't check to see if these user profile files exist before trying to use them, so one thing this patch does is check if the files exist for each user, and if they do not, it will create them with a simple placeholder. Another purpose of this patch is to allow for click-to-dial phone numbers in Vtiger, so that the numbers will be dialed as manual dial calls in a VICIDIAL agent screen. For this to work you must have applied the patch, you need to have user 1000 set up in VICIDIAL with a password of 1234 and Agent API set to '1', and the agent needs to be logged into vicidial.php(there is also a VICIDIAL Campaign Detail option to automatically login to Vtiger when an agent logs into vicidial.php, this can log the agent into Vtiger within the SCRIPT tab or by opening a new browser window) then when the agent clicks on any phone number with a "VCcall:" label next to it, a call will be placed in their vicidial.php agent screen and the Vtiger window will be closed(or left open if using alternate patch) so that they can open it up again with the vicidial.php WEB FORM button in VICIDIAL.
|
||||
More in-depth integration with Vtiger is a bit complicated due to the fact that it has 312 database tables to start with(and you though VICIDIAL had a lot with about 70). Attempts at using the built-in 5.0.4 API structure were unsuccessful because of inaccurate documentation and the inability to use the modules easily outside of the vtiger directory tree without major reworking of the vtiger code, so we decided to have VICIDIAL work directly with the database instead. Unfortunately, working only with the database doesn't get you the whole way with Vtiger. For user synchronization you need to make sure that the patch(Vtiger504_vicidial.patch) is applied to Vtiger(see instructions below). Part of this patch is used to create blank user profile files so Vtiger will load properly with synchronized users from VICIDIAL. Vtiger doesn't check to see if these user profile files exist before trying to use them, so one thing this patch does is check if the files exist for each user, and if they do not, it will create them with a simple placeholder. Another purpose of this patch is to allow for click-to-dial phone numbers in Vtiger, so that the numbers will be dialed as manual dial calls in a VICIDIAL agent screen. For this to work you must have applied the patch, you need to have user 1000 set up in VICIDIAL with a password of 1234 and Agent API set to '1', and the agent needs to be logged into vicidial.php(there is also a VICIDIAL Campaign Detail option to automatically login to Vtiger when an agent logs into vicidial.php, this can log the agent into Vtiger within the SCRIPT tab or by opening a new browser window) then when the agent clicks on any phone number with a "VCcall:" label next to it, a call will be placed in their vicidial.php agent screen and the Vtiger window will be closed(or left open if using alternate patch) so that they can open it up again with the vicidial.php WEB FORM button in VICIDIAL.
|
||||
|
||||
as of 2008-12-31, several user synchronization features have been added to allow for the creation of vtiger users from the vicidial_users user database. The vtiger_search.php script has also been updated to work with the current vtiger release 5.0.4. To enable the Vtiger integration features you will need to go to the Admin -> System Settings section of the admin.php Administration web page to set Vtiger Integration to enabled and configure the connection details for the Vtiger database.
|
||||
|
||||
@@ -319,6 +320,8 @@ Files edited within Vtiger to allow for click-to-dial and user integration:
|
||||
|
||||
Click-to-dial:
|
||||
uitype = '11' for phone fields
|
||||
uitype = '1' for fax
|
||||
uitype = '13' for email
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -193,6 +193,10 @@ exten => _881NXXNXXXXXX,1,Answer
|
||||
exten => _881NXXNXXXXXX,2,Dial(${TRUNKloop}/9${EXTEN:2},,To)
|
||||
exten => _881NXXNXXXXXX,3,Hangup
|
||||
|
||||
; Vtiger fax and email log extensions
|
||||
exten => _9118XXXXXXXX,1,Dial(${TRUNKblind}/9998818112,55,to)
|
||||
exten => _9119XXXXXXXX,1,Dial(${TRUNKblind}/9998819112,55,to)
|
||||
|
||||
; dial a long distance outbound number through BINFONE
|
||||
; exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
|
||||
; exten => _91NXXNXXXXXX,2,Dial(${TRUNKIAX}/${EXTEN:1},55,To)
|
||||
@@ -497,7 +501,7 @@ exten => 8373,7,Hangup
|
||||
; PERFORMANCE TESTING
|
||||
exten => _999XXXXXX1,1,Answer
|
||||
exten => _999XXXXXX1,2,Wait(2)
|
||||
exten => _999XXXXXX1,3,Playback(beep)
|
||||
exten => _999XXXXXX1,3,Playback(vicidial-welcome)
|
||||
exten => _999XXXXXX1,4,Hangup
|
||||
|
||||
exten => _999XX11112,1,Wait(2)
|
||||
@@ -506,6 +510,18 @@ exten => _999XX11112,3,Playback(ss-noservice)
|
||||
exten => _999XX11112,4,Playback(vm-goodbye)
|
||||
exten => _999XX11112,5,Hangup
|
||||
|
||||
exten => _999XX18112,1,Wait(2)
|
||||
exten => _999XX18112,2,Answer
|
||||
exten => _999XX18112,3,Playback(vtiger-fax)
|
||||
exten => _999XX18112,4,Playback(vtiger-fax)
|
||||
exten => _999XX18112,5,Hangup
|
||||
|
||||
exten => _999XX19112,1,Wait(2)
|
||||
exten => _999XX19112,2,Answer
|
||||
exten => _999XX19112,3,Playback(vtiger-email)
|
||||
exten => _999XX19112,4,Playback(vtiger-email)
|
||||
exten => _999XX19112,5,Hangup
|
||||
|
||||
exten => _999XXXX112,1,Wait(5)
|
||||
exten => _999XXXX112,2,Answer
|
||||
exten => _999XXXX112,3,Playback(demo-instruct)
|
||||
|
||||
@@ -193,6 +193,10 @@ exten => _881NXXNXXXXXX,1,Answer
|
||||
exten => _881NXXNXXXXXX,2,Dial(${TRUNKloop}/9${EXTEN:2},,To)
|
||||
exten => _881NXXNXXXXXX,3,Hangup
|
||||
|
||||
; Vtiger fax and email log extensions
|
||||
exten => _9118XXXXXXXX,1,Dial(${TRUNKblind}/9998818112,55,to)
|
||||
exten => _9119XXXXXXXX,1,Dial(${TRUNKblind}/9998819112,55,to)
|
||||
|
||||
; dial a long distance outbound number through BINFONE
|
||||
; exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
|
||||
; exten => _91NXXNXXXXXX,2,Dial(${TRUNKIAX}/${EXTEN:1},55,To)
|
||||
@@ -497,7 +501,7 @@ exten => 8373,7,Hangup
|
||||
; PERFORMANCE TESTING
|
||||
exten => _999XXXXXX1,1,Answer
|
||||
exten => _999XXXXXX1,2,Wait(2)
|
||||
exten => _999XXXXXX1,3,Playback(beep)
|
||||
exten => _999XXXXXX1,3,Playback(vicidial-welcome)
|
||||
exten => _999XXXXXX1,4,Hangup
|
||||
|
||||
exten => _999XX11112,1,Wait(2)
|
||||
@@ -506,6 +510,18 @@ exten => _999XX11112,3,Playback(ss-noservice)
|
||||
exten => _999XX11112,4,Playback(vm-goodbye)
|
||||
exten => _999XX11112,5,Hangup
|
||||
|
||||
exten => _999XX18112,1,Wait(2)
|
||||
exten => _999XX18112,2,Answer
|
||||
exten => _999XX18112,3,Playback(vtiger-fax)
|
||||
exten => _999XX18112,4,Playback(vtiger-fax)
|
||||
exten => _999XX18112,5,Hangup
|
||||
|
||||
exten => _999XX19112,1,Wait(2)
|
||||
exten => _999XX19112,2,Answer
|
||||
exten => _999XX19112,3,Playback(vtiger-email)
|
||||
exten => _999XX19112,4,Playback(vtiger-email)
|
||||
exten => _999XX19112,5,Hangup
|
||||
|
||||
exten => _999XXXX112,1,Wait(5)
|
||||
exten => _999XXXX112,2,Answer
|
||||
exten => _999XXXX112,3,Playback(demo-instruct)
|
||||
|
||||
@@ -156,63 +156,6 @@
|
||||
}else if(uitype == '17')
|
||||
{
|
||||
getObj(dtlView).innerHTML = "<a href=\"http://"+ tagValue+"\" target=\"_blank\">"+tagValue+" </a>";
|
||||
--- ./include/js/general.js 2009-01-26 14:14:11.000000000 -0500
|
||||
+++ ./include/js/general.js 2009-01-26 21:26:31.000000000 -0500
|
||||
@@ -1768,6 +1768,54 @@
|
||||
openPopUp('xComposeEmail',this,url,'createemailWin',830,662,opts);
|
||||
}
|
||||
|
||||
+function VICIDIALcall(record_id,field_name,phone,user_name) {
|
||||
+//alert(record_id + "|" + field_name + "|" + phone + "|" user_name);
|
||||
+var xmlhttp=false;
|
||||
+/*@cc_on @*/
|
||||
+/*@if (@_jscript_version >= 5)
|
||||
+// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
+// and security blocked creation of the objects.
|
||||
+ try {
|
||||
+ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
+ } catch (e) {
|
||||
+ try {
|
||||
+ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
+ } catch (E) {
|
||||
+ xmlhttp = false;
|
||||
+ }
|
||||
+ }
|
||||
+@end @*/
|
||||
+if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
+ {
|
||||
+ xmlhttp = new XMLHttpRequest();
|
||||
+ }
|
||||
+if (xmlhttp)
|
||||
+ {
|
||||
+ var VCcallQuery = "VCcall=1&phone=" + phone + "&vendor_id=" + record_id;
|
||||
+ xmlhttp.open('POST', 'vtigerservice.php');
|
||||
+ xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
+ xmlhttp.send(VCcallQuery);
|
||||
+ xmlhttp.onreadystatechange = function()
|
||||
+ {
|
||||
+ if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
+ {
|
||||
+ // alert(xmlhttp.responseText);
|
||||
+ var Xoutput = null;
|
||||
+ Xoutput = xmlhttp.responseText;
|
||||
+ var regXFerr = new RegExp("ERROR","g");
|
||||
+ if (Xoutput.match(regXFerr))
|
||||
+ {
|
||||
+ alert(xmlhttp.responseText);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ self.close();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ delete xmlhttp;
|
||||
+ }
|
||||
+}
|
||||
function fnHide_Event(obj){
|
||||
document.getElementById(obj).style.visibility = 'hidden';
|
||||
}
|
||||
--- ./include/utils/ListViewUtils.php 2009-01-26 10:42:14.000000000 -0500
|
||||
+++ ./include/utils/ListViewUtils.php 2009-01-26 18:54:39.000000000 -0500
|
||||
@@ -1291,6 +1291,11 @@
|
||||
@@ -248,3 +191,87 @@
|
||||
require('user_privileges/user_privileges_'.$current_user->id.'.php');
|
||||
require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
|
||||
$permission = "no";
|
||||
--- ./Smarty/templates/DetailView.tpl 2008-03-10 08:54:31.000000000 -0400
|
||||
+++ ./Smarty/templates/DetailView.tpl 2009-03-26 19:52:24.000000000 -0400
|
||||
@@ -175,6 +175,10 @@
|
||||
<input title="{$APP.LBL_SENDMAIL_BUTTON_TITLE}" accessKey="{$APP.LBL_SENDMAIL_BUTTON_KEY}" class="crmbutton small edit" onclick="if(LTrim(document.DetailView.pri_email.value) !='' || LTrim(document.DetailView.sec_email.value) !=''){ldelim}fnvshobj(this,'sendmail_cont');sendmail('{$MODULE}',{$ID}){rdelim}else{ldelim}OpenCompose('','create'){rdelim}" type="button" name="SendMail" value="{$APP.LBL_SENDMAIL_BUTTON_LABEL}">
|
||||
{/if}
|
||||
{/if}
|
||||
+ {if $MODULE eq 'Accounts'}
|
||||
+ <a href="javascript:VICIDIALcall({$ID},'fax','');">VC fax log</a>
|
||||
+ <a href="javascript:VICIDIALcall({$ID},'email','');">VC email log</a>
|
||||
+ {/if}
|
||||
{if $MODULE eq 'Quotes' || $MODULE eq 'PurchaseOrder' || $MODULE eq 'SalesOrder' || $MODULE eq 'Invoice'}
|
||||
{if $CREATEPDF eq 'permitted'}
|
||||
<input title="Export To PDF" accessKey="Alt+e" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}'; this.form.module.value='{$MODULE}'; {if $MODULE eq 'SalesOrder'} this.form.action.value='CreateSOPDF'" {else} this.form.action.value='CreatePDF'" {/if} type="submit" name="Export To PDF" value="{$APP.LBL_EXPORT_TO_PDF}">
|
||||
--- ./include/js/general.js 2008-03-10 08:54:31.000000000 -0400
|
||||
+++ ./include/js/general.js 2009-03-26 20:07:23.000000000 -0400
|
||||
@@ -1768,6 +1768,68 @@
|
||||
openPopUp('xComposeEmail',this,url,'createemailWin',830,662,opts);
|
||||
}
|
||||
|
||||
+function VICIDIALcall(record_id,field_name,phone,user_name) {
|
||||
+//alert(record_id + "|" + field_name + "|" + phone + "|" user_name);
|
||||
+var xmlhttp=false;
|
||||
+/*@cc_on @*/
|
||||
+/*@if (@_jscript_version >= 5)
|
||||
+// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
+// and security blocked creation of the objects.
|
||||
+ try {
|
||||
+ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
+ } catch (e) {
|
||||
+ try {
|
||||
+ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
+ } catch (E) {
|
||||
+ xmlhttp = false;
|
||||
+ }
|
||||
+ }
|
||||
+@end @*/
|
||||
+if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
+ {
|
||||
+ xmlhttp = new XMLHttpRequest();
|
||||
+ }
|
||||
+if (xmlhttp)
|
||||
+ {
|
||||
+ if (field_name=='fax')
|
||||
+ {
|
||||
+ var log_call = record_id + '';
|
||||
+ while (log_call.length < 8)
|
||||
+ {log_call = "0" + log_call;}
|
||||
+ phone = "18" + log_call;
|
||||
+ }
|
||||
+ if (field_name=='email')
|
||||
+ {
|
||||
+ var log_call = record_id + '';
|
||||
+ while (log_call.length < 8)
|
||||
+ {log_call = "0" + log_call;}
|
||||
+ phone = "19" + log_call;
|
||||
+ }
|
||||
+ var VCcallQuery = "VCcall=1&phone=" + phone + "&vendor_id=" + record_id;
|
||||
+ xmlhttp.open('POST', 'vtigerservice.php');
|
||||
+ xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
+ xmlhttp.send(VCcallQuery);
|
||||
+ xmlhttp.onreadystatechange = function()
|
||||
+ {
|
||||
+ if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
+ {
|
||||
+ // alert(xmlhttp.responseText);
|
||||
+ var Xoutput = null;
|
||||
+ Xoutput = xmlhttp.responseText;
|
||||
+ var regXFerr = new RegExp("ERROR","g");
|
||||
+ if (Xoutput.match(regXFerr))
|
||||
+ {
|
||||
+ alert(xmlhttp.responseText);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ self.close();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ delete xmlhttp;
|
||||
+ }
|
||||
+}
|
||||
function fnHide_Event(obj){
|
||||
document.getElementById(obj).style.visibility = 'hidden';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
--- ./Smarty/templates/DetailViewFields.tpl 2009-01-26 11:01:37.000000000 -0500
|
||||
+++ ./Smarty/templates/DetailViewFields.tpl 2009-01-26 15:03:13.000000000 -0500
|
||||
@@ -13,28 +13,34 @@
|
||||
-->*}
|
||||
|
||||
<!-- This file is used to display the fields based on the ui type in detailview -->
|
||||
- {if $keyid eq '1' || $keyid eq 2 || $keyid eq '11' || $keyid eq '7' || $keyid eq '9' || $keyid eq '55' || $keyid eq '71' || $keyid eq '72' || $keyid eq '255'} <!--TextBox-->
|
||||
- <td width=25% class="dvtCellInfo" align="left">
|
||||
- {if $keyid eq '55' || $keyid eq '255'}<!--SalutationSymbol-->
|
||||
- {if $keyaccess eq $APP.LBL_NOT_ACCESSIBLE}
|
||||
- <font color='red'>{$APP.LBL_NOT_ACCESSIBLE}</font>
|
||||
- {else}
|
||||
- {$keysalut}
|
||||
- {/if}
|
||||
- {*elseif $keyid eq '71' || $keyid eq '72'} <!--CurrencySymbol-->
|
||||
+ {if $keyid eq '1' || $keyid eq 2 || $keyid eq '7' || $keyid eq '9' || $keyid eq '55' || $keyid eq '71' || $keyid eq '72' || $keyid eq '255'} <!--TextBox-->
|
||||
+ <td width=25% class="dvtCellInfo" align="left">
|
||||
+ {if $keyid eq '55' || $keyid eq '255'}<!--SalutationSymbol-->
|
||||
+ {if $keyaccess eq $APP.LBL_NOT_ACCESSIBLE}
|
||||
+ <font color='red'>{$APP.LBL_NOT_ACCESSIBLE}</font>
|
||||
+ {else}
|
||||
+ {$keysalut}
|
||||
+ {/if}
|
||||
+ {*elseif $keyid eq '71' || $keyid eq '72'} <!--CurrencySymbol-->
|
||||
{$keycursymb*}
|
||||
{/if}
|
||||
<span id ="dtlview_{$label}">{$keyval}</span>
|
||||
</td>
|
||||
{elseif $keyid eq '13'} <!--Email-->
|
||||
<td width=25% class="dvtCellInfo" align="left">
|
||||
- {if $smarty.session.internal_mailer eq 1}
|
||||
+ {if $smarty.session.internal_mailer eq 1}
|
||||
<a href="javascript:InternalMailer({$ID},{$keyfldid},'{$keyfldname}','{$MODULE}','record_id');">{$keyval}</a>
|
||||
{else}
|
||||
<a href="mailto:{$keyval}" target="_blank" >{$keyval}</a>
|
||||
{/if}
|
||||
</span>
|
||||
- </td>
|
||||
+ </td>
|
||||
+ {elseif $keyid eq '11'} <!--VICIDIALcall-->
|
||||
+ <td width=25% class="dvtCellInfo" align="left">
|
||||
+ <span id ="dtlview_{$label}">
|
||||
+ VCcall: <a href="javascript:VICIDIALcall({$ID},'{$keyfldname}','{$keyval}');">{$keyval}</a>
|
||||
+ </span>
|
||||
+ </td>
|
||||
{elseif $keyid eq '15' || $keyid eq '16' || $keyid eq '111'} <!--ComboBox-->
|
||||
<td width=25% class="dvtCellInfo" align="left">
|
||||
{foreach item=arr from=$keyoptions}
|
||||
--- ./Smarty/templates/DetailViewUI.tpl 2009-01-26 11:03:34.000000000 -0500
|
||||
+++ ./Smarty/templates/DetailViewUI.tpl 2009-01-26 15:03:44.000000000 -0500
|
||||
@@ -13,7 +13,7 @@
|
||||
-->*}
|
||||
|
||||
<!-- This file is used to display the fields based on the ui type in detailview -->
|
||||
- {if $keyid eq '1' || $keyid eq 2 || $keyid eq '11' || $keyid eq '7' || $keyid eq '9' || $keyid eq '55' || $keyid eq '71' || $keyid eq '72' || $keyid eq '103' || $keyid eq '255'} <!--TextBox-->
|
||||
+ {if $keyid eq '1' || $keyid eq 2 || $keyid eq '7' || $keyid eq '9' || $keyid eq '55' || $keyid eq '71' || $keyid eq '72' || $keyid eq '103' || $keyid eq '255'} <!--TextBox-->
|
||||
<td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">
|
||||
{if $keyid eq '55' || $keyid eq '255'}<!--SalutationSymbol-->
|
||||
{if $keyaccess eq $APP.LBL_NOT_ACCESSIBLE}
|
||||
@@ -46,6 +46,17 @@
|
||||
</div>
|
||||
<div id="internal_mailer_{$keyfldname}" style="display: none;">{$keyfldid}####{$smarty.session.internal_mailer}</div>
|
||||
</td>
|
||||
+ {elseif $keyid eq '11'} <!--VICIDIALcall-->
|
||||
+ <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">
|
||||
+ VCcall: <span id="dtlview_{$label}">
|
||||
+ <a href="javascript:VICIDIALcall({$ID},'{$keyfldname}','{$keyval}');">{$keyval}</a>
|
||||
+ </span>
|
||||
+ <div id="editarea_{$label}" style="display:none;">
|
||||
+ <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}" name="{$keyfldname}" maxlength='100' value="{$keyval}"></input>
|
||||
+ <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
|
||||
+ <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
|
||||
+ </div>
|
||||
+ </td>
|
||||
<!-- uitype 111 added for noneditable existing picklist values - ahmed -->
|
||||
{elseif $keyid eq '15' || $keyid eq '16' || $keyid eq '111'} <!--ComboBox-->
|
||||
{foreach item=arr from=$keyoptions}
|
||||
--- ./vtigerservice.php 2009-01-26 20:13:22.000000000 -0500
|
||||
+++ ./vtigerservice.php 2009-01-26 22:16:02.000000000 -0500
|
||||
@@ -42,6 +42,58 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
+ if(isset($_REQUEST['VCcall']))
|
||||
+ {
|
||||
+ $CL=':';
|
||||
+ $server_name = getenv("SERVER_NAME");
|
||||
+ $server_port = getenv("SERVER_PORT");
|
||||
+ if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';}
|
||||
+ else {$HTTPprotocol = 'http://';}
|
||||
+ if (($server_port == '80') or ($server_port == '443') ) {$server_port='';}
|
||||
+ else {$server_port = "$CL$server_port";}
|
||||
+ $URLbase = "$HTTPprotocol$server_name$server_port";
|
||||
+
|
||||
+ global $entityDel;
|
||||
+ global $display;
|
||||
+ global $category;
|
||||
+ header('Content-Type: text/html; charset='. $charset);
|
||||
+ session_start();
|
||||
+ require_once('include/utils/utils.php');
|
||||
+ require_once('config.inc.php');
|
||||
+ $default_config_values = Array( "allow_exports"=>"all","upload_maxsize"=>"3000000", "listview_max_textlength" => "40" );
|
||||
+ set_default_config($default_config_values);
|
||||
+ require_once('include/logging.php');
|
||||
+ require_once('modules/Users/Users.php');
|
||||
+ global $currentModule;
|
||||
+ $current_user = new Users();
|
||||
+
|
||||
+ $log =& LoggerManager::getLogger('index');
|
||||
+ global $seclog;
|
||||
+ $seclog =& LoggerManager::getLogger('SECURITY');
|
||||
+ $log->debug($_REQUEST);
|
||||
+
|
||||
+ // Check to see if there is an authenticated user in the session.
|
||||
+ if(isset($_SESSION["authenticated_user_id"]) && (isset($_SESSION["app_unique_key"]) && $_SESSION["app_unique_key"] == $application_unique_key))
|
||||
+ {
|
||||
+ $log->debug("We have an authenticated user id: ".$_SESSION["authenticated_user_id"]);
|
||||
+ $result = $current_user->retrieveCurrentUserInfoFromFile($_SESSION['authenticated_user_id']);
|
||||
+ $log->debug('Current user is: '.$current_user->user_name);
|
||||
+ }
|
||||
+
|
||||
+ $phone = $_REQUEST['phone']; $vendor_id = $_REQUEST['vendor_id'];
|
||||
+ $user = $current_user->user_name;
|
||||
+
|
||||
+ $VCapiURL = "/agc/api.php";
|
||||
+ $VCpauseQuery = "?source=vtiger&user=1000&pass=1234&agent_user=$user&function=external_pause&value=PAUSE";
|
||||
+ $VCcallQuery = "?source=vtiger&user=1000&pass=1234&agent_user=$user&function=external_dial&value=$phone&phone_code=1&search=YES&preview=NO&focus=YES&vendor_id=$vendor_id";
|
||||
+ $replyP = file("$URLbase$VCapiURL$VCpauseQuery");
|
||||
+// sleep(1);
|
||||
+ $replyC = file("$URLbase$VCapiURL$VCcallQuery");
|
||||
+ echo "$replyP[0]|$replyC[0]\n";
|
||||
+// echo "$URLbase$VCapiURL$VCcallQuery\n";
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
echo "<h1>vtigerCRM Soap Services</h1>";
|
||||
echo "<li>vtigerCRM Outlook Plugin EndPoint URL -- Click <a href='vtigerservice.php?service=outlook'>here</a></li>";
|
||||
echo "<li>vtigerCRM Word Plugin EndPoint URL -- Click <a href='vtigerservice.php?service=wordplugin'>here</a></li>";
|
||||
@@ -49,6 +101,7 @@
|
||||
echo "<li>vtigerCRM Customer Portal EndPoint URL -- Click <a href='vtigerservice.php?service=customerportal'>here</a></li>";
|
||||
echo "<li>vtigerCRM WebForm EndPoint URL -- Click <a href='vtigerservice.php?service=webforms'>here</a></li>";
|
||||
echo "<li>vtigerCRM FireFox Extension EndPoint URL -- Click <a href='vtigerservice.php?service=firefox'>here</a></li>";
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
--- ./include/js/dtlviewajax.js 2009-01-26 13:59:25.000000000 -0500
|
||||
+++ ./include/js/dtlviewajax.js 2009-01-26 15:02:33.000000000 -0500
|
||||
@@ -293,6 +293,9 @@
|
||||
if(secEmail)
|
||||
secEmail.value = tagValue;
|
||||
}
|
||||
+ }else if(uitype == '11')
|
||||
+ {
|
||||
+ getObj(dtlView).innerHTML = "<a href=\"javascript:VICIDIALcall("+crmId+",'"+fieldName+"','"+tagValue+"');\">"+tagValue+" </a>";
|
||||
}else if(uitype == '17')
|
||||
{
|
||||
getObj(dtlView).innerHTML = "<a href=\"http://"+ tagValue+"\" target=\"_blank\">"+tagValue+" </a>";
|
||||
--- ./include/utils/ListViewUtils.php 2009-01-26 10:42:14.000000000 -0500
|
||||
+++ ./include/utils/ListViewUtils.php 2009-01-26 18:54:39.000000000 -0500
|
||||
@@ -1291,6 +1291,11 @@
|
||||
$value = '<a href="mailto:'.$field_val.'">'.$temp_val.'</a>';
|
||||
|
||||
}
|
||||
+ // VICIDIAL agent screen phone number click to dial
|
||||
+ elseif($uitype == 11)
|
||||
+ {
|
||||
+ $value = "VCcall: <a href=\"javascript:VICIDIALcall($entity_id,'$fieldname','$temp_val','$current_user->user_name');\">$temp_val</a>";
|
||||
+ }
|
||||
elseif($uitype == 56)
|
||||
{
|
||||
if($temp_val == 1)
|
||||
--- ./include/utils/UserInfoUtil.php 2008-12-31 21:39:39.000000000 -0500
|
||||
+++ ./include/utils/UserInfoUtil.php 2009-01-01 01:20:17.000000000 -0500
|
||||
@@ -1175,6 +1175,18 @@
|
||||
global $adb;
|
||||
global $current_user;
|
||||
global $seclog;
|
||||
+ if (!file_exists('user_privileges/user_privileges_'.$current_user->id.'.php'))
|
||||
+ {
|
||||
+ $up = fopen('user_privileges/user_privileges_'.$current_user->id.'.php',"a");
|
||||
+ fwrite($up, '<? $placeholder=0; ?>');
|
||||
+ fclose($up);
|
||||
+ }
|
||||
+ if (!file_exists('user_privileges/sharing_privileges_'.$current_user->id.'.php'))
|
||||
+ {
|
||||
+ $sp = fopen('user_privileges/sharing_privileges_'.$current_user->id.'.php',"a");
|
||||
+ fwrite($sp, '<? $placeholder=0; ?>');
|
||||
+ fclose($sp);
|
||||
+ }
|
||||
require('user_privileges/user_privileges_'.$current_user->id.'.php');
|
||||
require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
|
||||
$permission = "no";
|
||||
--- ./Smarty/templates/DetailView.tpl 2008-03-10 08:54:31.000000000 -0400
|
||||
+++ ./Smarty/templates/DetailView.tpl 2009-03-26 19:52:24.000000000 -0400
|
||||
@@ -175,6 +175,10 @@
|
||||
<input title="{$APP.LBL_SENDMAIL_BUTTON_TITLE}" accessKey="{$APP.LBL_SENDMAIL_BUTTON_KEY}" class="crmbutton small edit" onclick="if(LTrim(document.DetailView.pri_email.value) !='' || LTrim(document.DetailView.sec_email.value) !=''){ldelim}fnvshobj(this,'sendmail_cont');sendmail('{$MODULE}',{$ID}){rdelim}else{ldelim}OpenCompose('','create'){rdelim}" type="button" name="SendMail" value="{$APP.LBL_SENDMAIL_BUTTON_LABEL}">
|
||||
{/if}
|
||||
{/if}
|
||||
+ {if $MODULE eq 'Accounts'}
|
||||
+ <a href="javascript:VICIDIALcall({$ID},'fax','');">VC fax log</a>
|
||||
+ <a href="javascript:VICIDIALcall({$ID},'email','');">VC email log</a>
|
||||
+ {/if}
|
||||
{if $MODULE eq 'Quotes' || $MODULE eq 'PurchaseOrder' || $MODULE eq 'SalesOrder' || $MODULE eq 'Invoice'}
|
||||
{if $CREATEPDF eq 'permitted'}
|
||||
<input title="Export To PDF" accessKey="Alt+e" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}'; this.form.module.value='{$MODULE}'; {if $MODULE eq 'SalesOrder'} this.form.action.value='CreateSOPDF'" {else} this.form.action.value='CreatePDF'" {/if} type="submit" name="Export To PDF" value="{$APP.LBL_EXPORT_TO_PDF}">
|
||||
--- ./include/js/general.js 2008-03-10 08:54:31.000000000 -0400
|
||||
+++ ./include/js/general.js 2009-03-26 20:07:23.000000000 -0400
|
||||
@@ -1768,6 +1768,68 @@
|
||||
openPopUp('xComposeEmail',this,url,'createemailWin',830,662,opts);
|
||||
}
|
||||
|
||||
+function VICIDIALcall(record_id,field_name,phone,user_name) {
|
||||
+//alert(record_id + "|" + field_name + "|" + phone + "|" user_name);
|
||||
+var xmlhttp=false;
|
||||
+/*@cc_on @*/
|
||||
+/*@if (@_jscript_version >= 5)
|
||||
+// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
+// and security blocked creation of the objects.
|
||||
+ try {
|
||||
+ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
+ } catch (e) {
|
||||
+ try {
|
||||
+ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
+ } catch (E) {
|
||||
+ xmlhttp = false;
|
||||
+ }
|
||||
+ }
|
||||
+@end @*/
|
||||
+if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
+ {
|
||||
+ xmlhttp = new XMLHttpRequest();
|
||||
+ }
|
||||
+if (xmlhttp)
|
||||
+ {
|
||||
+ if (field_name=='fax')
|
||||
+ {
|
||||
+ var log_call = record_id + '';
|
||||
+ while (log_call.length < 8)
|
||||
+ {log_call = "0" + log_call;}
|
||||
+ phone = "18" + log_call;
|
||||
+ }
|
||||
+ if (field_name=='email')
|
||||
+ {
|
||||
+ var log_call = record_id + '';
|
||||
+ while (log_call.length < 8)
|
||||
+ {log_call = "0" + log_call;}
|
||||
+ phone = "19" + log_call;
|
||||
+ }
|
||||
+ var VCcallQuery = "VCcall=1&phone=" + phone + "&vendor_id=" + record_id;
|
||||
+ xmlhttp.open('POST', 'vtigerservice.php');
|
||||
+ xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
+ xmlhttp.send(VCcallQuery);
|
||||
+ xmlhttp.onreadystatechange = function()
|
||||
+ {
|
||||
+ if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
+ {
|
||||
+ // alert(xmlhttp.responseText);
|
||||
+ var Xoutput = null;
|
||||
+ Xoutput = xmlhttp.responseText;
|
||||
+ var regXFerr = new RegExp("ERROR","g");
|
||||
+ if (Xoutput.match(regXFerr))
|
||||
+ {
|
||||
+ alert(xmlhttp.responseText);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ delete xmlhttp;
|
||||
+ }
|
||||
+}
|
||||
function fnHide_Event(obj){
|
||||
document.getElementById(obj).style.visibility = 'hidden';
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -194,12 +194,13 @@
|
||||
# 90320-0306 - Fixed agent log bug when using wrapup time
|
||||
# 90323-2013 - Added function to put phone numbers in the DNC lists if they were set to status type dnc=Y
|
||||
# 90324-1316 - Added functions to log calls to Vtiger accounts and update status to siccode
|
||||
# 90327-1348 - Changed Vtiger status populate to use status name
|
||||
#
|
||||
|
||||
$version = '2.2.0-106';
|
||||
$build = '90324-1316';
|
||||
$version = '2.2.0-107';
|
||||
$build = '90327-1348';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=210;
|
||||
$mysql_log_count=212;
|
||||
$one_mysql_log=0;
|
||||
|
||||
require("dbconnect.php");
|
||||
@@ -3520,6 +3521,32 @@ if ($ACTION == 'updateDISPO')
|
||||
}
|
||||
if ( (ereg('ACCTID',$vtiger_search_category)) or (ereg('ACCOUNT',$vtiger_search_category)) )
|
||||
{
|
||||
### find the full status name for this status
|
||||
$stmt = "select status_name from vicidial_statuses where status='$dispo_choice';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00211',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$vs_ct = mysql_num_rows($rslt);
|
||||
if ($vs_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$status_name = $row[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt = "select status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00212',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$vs_ct = mysql_num_rows($rslt);
|
||||
if ($vs_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$status_name = $row[0];
|
||||
}
|
||||
}
|
||||
if (strlen($dispo_choice) < 1) {$status_name = $dispo_chioce;}
|
||||
|
||||
### connect to your vtiger database
|
||||
$linkV=mysql_connect("$vtiger_server_ip", "$vtiger_login","$vtiger_pass");
|
||||
if (!$linkV) {die("Could not connect: $vtiger_server_ip|$vtiger_dbname|$vtiger_login|$vtiger_pass" . mysql_error());}
|
||||
@@ -3596,7 +3623,7 @@ if ($ACTION == 'updateDISPO')
|
||||
if ($DB) {echo "|$leadid|\n";}
|
||||
|
||||
#Insert values into vtiger_activity
|
||||
$stmt = "INSERT INTO vtiger_activity SET activityid='$activityid',subject='VICIDIAL Account call $vendor_id status $dispo_choice',activitytype='Call',date_start='$TODAY',due_date='$TODAY',time_start='$HHMMnow',time_end='$HHMMend',sendnotification='0',duration_hours='0',duration_minutes='1',status='',eventstatus='Held',priority='Medium',location='VICIDIAL User $user',notime='0',visibility='Public',recurringtype='--None--';";
|
||||
$stmt = "INSERT INTO vtiger_activity SET activityid='$activityid',subject='VC Call: $status_name',activitytype='Call',date_start='$TODAY',due_date='$TODAY',time_start='$HHMMnow',time_end='$HHMMend',sendnotification='0',duration_hours='0',duration_minutes='1',status='',eventstatus='Held',priority='Medium',location='VICIDIAL User $user',notime='0',visibility='Public',recurringtype='--None--';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $linkV);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00206',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
@@ -3622,7 +3649,7 @@ if ($ACTION == 'updateDISPO')
|
||||
|
||||
if ($insert_into_dnc > 0) {$emailoptoutSQL = ", emailoptout='1'";}
|
||||
#Update vtiger_account dnc=emailoptout
|
||||
$stmt = "UPDATE vtiger_account SET siccode='$dispo_choice' $emailoptoutSQL where accountid='$vendor_id';";
|
||||
$stmt = "UPDATE vtiger_account SET siccode='$status_name' $emailoptoutSQL where accountid='$vendor_id';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $linkV);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00209',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
Reference in New Issue
Block a user