diff --git a/bin/AST_VDadapt.pl b/bin/AST_VDadapt.pl index b5c702b9..ff2557c6 100644 --- a/bin/AST_VDadapt.pl +++ b/bin/AST_VDadapt.pl @@ -710,6 +710,37 @@ if ($DB) {print " $event_string\n";} sub calculate_drops { +$camp_ANS_STAT_SQL=''; +# GET LIST OF HUMAN-ANSWERED STATUSES +$stmtA = "SELECT status from vicidial_statuses where human_answered='Y';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $camp_ANS_STAT_SQL .= "'$aryA[0]',"; + $rec_count++; + } +$sthA->finish(); + +$stmtA = "SELECT status from vicidial_campaign_statuses where campaign_id='$campaign_id[$i]' and human_answered='Y';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $camp_ANS_STAT_SQL .= "'$aryA[0]',"; + $rec_count++; + } +$sthA->finish(); +chop($camp_ANS_STAT_SQL); + +if ($DBX) {print " CAMPAIGN ANSWERED STATUSES: $campaign_id[$i]|$camp_ANS_STAT_SQL|\n";} + $RESETdrop_count_updater++; $VCScalls_today[$i]=0; $VCSanswers_today[$i]=0; @@ -749,7 +780,7 @@ $sthA->finish(); if ($VCScalls_one[$i] > 0) { # LAST MINUTE ANSWERS - $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_one' and status NOT IN('NA','B');"; + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_one' and status IN($camp_ANS_STAT_SQL);"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -797,7 +828,7 @@ $sthA->finish(); if ($VCScalls_today[$i] > 0) { # TODAY ANSWERS - $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_date' and status NOT IN('NA','B');"; + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_date' and status IN($camp_ANS_STAT_SQL);"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -848,7 +879,7 @@ $sthA->finish(); if ($VCScalls_hour[$i] > 0) { # ANSWERS LAST HOUR - $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_hour' and status NOT IN('NA','B');"; + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_hour' and status IN($camp_ANS_STAT_SQL);"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -896,7 +927,7 @@ $sthA->finish(); if ($VCScalls_halfhour[$i] > 0) { # ANSWERS HALFHOUR - $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_halfhour' and status NOT IN('NA','B');"; + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_halfhour' and status IN($camp_ANS_STAT_SQL);"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -944,7 +975,7 @@ $sthA->finish(); if ($VCScalls_five[$i] > 0) { # ANSWERS FIVEMINUTE - $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_five' and status NOT IN('NA','B');"; + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_five' and status IN($camp_ANS_STAT_SQL);"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index c27d3608..0d414e68 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -524,7 +524,8 @@ campaign_stats_refresh ENUM('Y','N') default 'N', campaign_logindate DATETIME, dial_statuses VARCHAR(255) default ' NEW -', disable_alter_custdata ENUM('Y','N') default 'N', -no_hopper_leads_logins ENUM('Y','N') default 'N' +no_hopper_leads_logins ENUM('Y','N') default 'N', +list_order_mix VARCHAR(20) default 'DISABLED' ); CREATE TABLE vicidial_lists ( @@ -540,7 +541,8 @@ list_lastcalldate DATETIME CREATE TABLE vicidial_statuses ( status VARCHAR(6) PRIMARY KEY NOT NULL, status_name VARCHAR(30), -selectable ENUM('Y','N') +selectable ENUM('Y','N'), +human_answered ENUM('Y','N') default 'N' ); CREATE TABLE vicidial_campaign_statuses ( @@ -548,6 +550,7 @@ status VARCHAR(6) NOT NULL, status_name VARCHAR(30), selectable ENUM('Y','N'), campaign_id VARCHAR(8), +human_answered ENUM('Y','N') default 'N', index (campaign_id) ); @@ -885,6 +888,17 @@ allow_sipsak_messages ENUM('0','1') default '0', admin_home_url VARCHAR(255) default '../vicidial/welcome.php' ); + CREATE TABLE vicidial_campaigns_list_mix ( +vcl_id VARCHAR(20) PRIMARY KEY NOT NULL, +vcl_name VARCHAR(50), +campaign_id VARCHAR(8), +list_mix_container TEXT, +mix_method ENUM('EVEN_MIX','IN_ORDER','RANDOM') default 'IN_ORDER', +status ENUM('ACTIVE','INACTIVE') default 'INACTIVE', +index (campaign_id) +); + + INSERT INTO system_settings (version,install_date) values('2.0.X', CURDATE()); diff --git a/extras/upgrade_2.0.4.sql b/extras/upgrade_2.0.4.sql index 780181f6..a9199c91 100644 --- a/extras/upgrade_2.0.4.sql +++ b/extras/upgrade_2.0.4.sql @@ -1,3 +1,8 @@ +ALTER TABLE vicidial_statuses ADD human_answered ENUM('Y','N') default 'N'; +ALTER TABLE vicidial_campaign_statuses ADD human_answered ENUM('Y','N') default 'Y'; + +UPDATE vicidial_statuses SET human_answered='Y' where status IN('DROP','DNC','DEC','SALE','XFER','CALLBK','NP','NI','N'); + ALTER TABLE vicidial_campaigns ADD list_order_mix VARCHAR(20) default 'DISABLED'; CREATE TABLE vicidial_campaigns_list_mix ( diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.4.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.4.txt index 34347706..3dc88952 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.4.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.4.txt @@ -26,6 +26,17 @@ List Mix Name -<\/B> Descriptive name of the list mix. Must be from 2-50 charact List Mix Detail -<\/B> The composition of the List Mix entry. Contains the List ID, mix order, percentages and statuses that make up this List Mix. The percentages always have to add up to 100, and the lists all have to be active and set to the campaign for the order mix entry to be Activated|| List Mix Method -<\/B> The method of mixing all of the parts of the List Mix Detail together. EVEN_MIX will mix leads from each part interleaved with the other parts, like this 1,2,3,1,2,3,1,2,3. IN_ORDER will put the leads in the order in which they are listed in the List Mix Detail screen 1,1,1,2,2,2,3,3,3. RANDOM will put them in RANDOM order 1,3,2,1,1,3,2,1,3. Default is IN_ORDER.|| LIST MIXES FOR THIS CAMPAIGN: || +The human_answered field is used when calculating the drop percentage, or abandon rate. Setting human_answered to Y will use this status when counting the human-answered calls.|| +HUMAN ANSWER|| +ADDING VICIDIAL SYSTEM STATUSES|| +MODIFY VICIDIAL SYSTEM STATUSES|| +SYSTEM STATUS NOT ADDED|| +SYSTEM STATUS ADDED|| +SYSTEM STATUS NOT DELETED|| +the system status cannot be a reserved status: || +the system status needs to be at least 1 characters in length|| +VICIDIAL STATUSES WITHIN THIS SYSTEM: || +ADD NEW SYSTEM STATUS|| ############################################################ CLIENT diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index a37527b4..ad3fd15c 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -599,7 +599,8 @@ if (isset($_GET["list_mix_container"])) {$list_mix_container=$_GET["list_mix_ elseif (isset($_POST["list_mix_container"])) {$list_mix_container=$_POST["list_mix_container"];} if (isset($_GET["mix_method"])) {$mix_method=$_GET["mix_method"];} elseif (isset($_POST["mix_method"])) {$mix_method=$_POST["mix_method"];} - +if (isset($_GET["human_answered"])) {$human_answered=$_GET["human_answered"];} + elseif (isset($_POST["human_answered"])) {$human_answered=$_POST["human_answered"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);} @@ -751,6 +752,7 @@ $agent_pause_codes_active = ereg_replace("[^NY]","",$agent_pause_codes_active); $campaign_stats_refresh = ereg_replace("[^NY]","",$campaign_stats_refresh); $disable_alter_custdata = ereg_replace("[^NY]","",$disable_alter_custdata); $no_hopper_leads_logins = ereg_replace("[^NY]","",$no_hopper_leads_logins); +$human_answered = ereg_replace("[^NY]","",$human_answered); ### ALPHA-NUMERIC ONLY ### $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); @@ -1016,11 +1018,12 @@ $list_mix_container = ereg_replace(";","",$list_mix_container); # 70402-1157 - Added HOME link and entry to system_settings table, added QM link on reports section # 70516-1628 - Started reformatting campaigns to use submenus to break up options # 70529-1653 - Added help for list mix +# 70530-1354 - Added human_answered field to statuses, added system status modification # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.0.97'; -$build = '70529-1653'; +$admin_version = '2.0.98'; +$build = '70530-1354'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -1162,6 +1165,7 @@ if ($ADD==211111111111) {$hh='admin'; $sh='server'; echo "ADDING NEW SERVER";} if ($ADD==221111111111) {$hh='admin'; $sh='server'; echo "ADDING NEW SERVER VICIDIAL TRUNK RECORD";} if ($ADD==2111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW CONFERENCE";} if ($ADD==21111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW VICIDIAL CONFERENCE";} +if ($ADD==221111111111111) {$hh='admin'; $sh='settings'; echo "ADDING VICIDIAL SYSTEM STATUSES";} if ($ADD==3) {$hh='users'; echo "Modify User";} if ($ADD==30) {$hh='campaigns'; echo "Campaign Not Allowed";} if ($ADD==31) @@ -1205,7 +1209,7 @@ if ($ADD==43) {$hh='campaigns'; $sh='hotkey'; echo "Modify Campaign HotKey";} if ($ADD==44) {$hh='campaigns'; $sh='basic'; echo "Modify Campaign - Basic View";} if ($ADD==45) {$hh='campaigns'; $sh='recycle'; echo "Modify Campaign Lead Recycle";} if ($ADD==47) {$hh='campaigns'; $sh='pause'; echo "Modify Agent Pause Code";} -if ($ADD==47) {$hh='campaigns'; $sh='listmix'; echo "Modify Campaign List Mix";} +if ($ADD==49) {$hh='campaigns'; $sh='listmix'; echo "Modify Campaign List Mix";} if ($ADD==411) {$hh='lists'; echo "Modify List";} if ($ADD==4111) {$hh='ingroups'; echo "Modify In-Group";} if ($ADD==41111) {$hh='remoteagent'; echo "Modify Remote Agents";} @@ -1220,6 +1224,7 @@ if ($ADD==421111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER VICIDIAL if ($ADD==4111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY CONFERENCE";} if ($ADD==41111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} if ($ADD==411111111111111) {$hh='admin'; $sh='settings'; echo "MODIFY VICIDIAL SYSTEM SETTINGS";} +if ($ADD==421111111111111) {$hh='admin'; $sh='settings'; echo "MODIFY VICIDIAL SYSTEM STATUSES";} if ($ADD==5) {$hh='users'; echo "Delete User";} if ($ADD==51) {$hh='campaigns'; $sh='detail'; echo "Delete Campaign";} if ($ADD==52) {$hh='campaigns'; $sh='detail'; echo "Logout Agents";} @@ -2203,7 +2208,7 @@ echo "
VICIDIAL_CAMPAIGN_STATUSES TABLE


-Through the use of custom campaign statuses, you can have statuses that only exist for a specific campaign. The Status must be 1-8 characters in length, the description must be 2-30 characters in length and Selectable defines whether it shows up in VICIDIAL as a disposition. +Through the use of custom campaign statuses, you can have statuses that only exist for a specific campaign. The Status must be 1-8 characters in length, the description must be 2-30 characters in length and Selectable defines whether it shows up in VICIDIAL as a disposition. The human_answered field is used when calculating the drop percentage, or abandon rate. Setting human_answered to Y will use this status when counting the human-answered calls. @@ -4143,14 +4148,14 @@ if ($ADD==22) { echo "
CAMPAIGN STATUS ADDED: $campaign_id - $status\n"; - $stmt="INSERT INTO vicidial_campaign_statuses values('$status','$status_name','$selectable','$campaign_id');"; + $stmt="INSERT INTO vicidial_campaign_statuses (status,status_name,selectable,campaign_id,human_answered) values('$status','$status_name','$selectable','$campaign_id','$human_answered');"; $rslt=mysql_query($stmt, $link); ### LOG CHANGES TO LOG FILE ### if ($WeBRooTWritablE > 0) { $fp = fopen ("./admin_changes_log.txt", "a"); - fwrite ($fp, "$date|ADD A NEW CAMPAIGN STATUS |$PHP_AUTH_USER|$ip|'$status','$status_name','$selectable','$campaign_id'|\n"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); fclose($fp); } } @@ -4872,6 +4877,55 @@ $ADD=31111111111111; } +###################### +# ADD=221111111111111 adds the new system status to the system +###################### + +if ($ADD==221111111111111) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SYSTEM STATUS NOT ADDED - there is already a campaign-status in the system with this name: $row[0]\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SYSTEM STATUS NOT ADDED - there is already a global-status in the system with this name\n";} + else + { + if ( (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
SYSTEM STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 8 characters in length\n"; + echo "
status name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
SYSTEM STATUS ADDED: $status_name - $status\n"; + + $stmt="INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered) values('$status','$status_name','$selectable','$human_answered');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=311111111111111; +} + + ###################################################################################################### ###################################################################################################### @@ -5157,7 +5211,7 @@ if ($ADD==43) if ($WeBRooTWritablE > 0) { $fp = fopen ("./admin_changes_log.txt", "a"); - fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey'|\n"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey'|\n"); fclose($fp); } } @@ -5955,6 +6009,46 @@ $ADD=311111111111111; # go to vicidial system settings form below } +###################### +# ADD=421111111111111 delete system status in the system +###################### + +if ($ADD==421111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if ( (strlen($status) < 1) or (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$status)) ) + { + echo "
SYSTEM STATUS NOT DELETED - Please go back and look at the data you entered\n"; + echo "
the system status cannot be a reserved status: B,NA,DNC,NA,DROP,INCALL,QUEUE,NEW\n"; + echo "
the system status needs to be at least 1 characters in length\n"; + } + else + { + echo "
SYSTEM STATUS DELETED: $status\n"; + + $stmt="DELETE FROM vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111111111; # go to system settings modification form below +} + ###################################################################################################### ###################################################################################################### @@ -7745,8 +7839,8 @@ if ($ADD==31) { echo "
\n"; echo "
CUSTOM STATUSES WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_statuses$NWE
\n"; - echo "\n"; - echo "\n"; + echo "
STATUSDESCRIPTIONSELECTABLEDELETE
\n"; + echo "\n"; $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id'"; $rslt=mysql_query($stmt, $link); @@ -7761,7 +7855,7 @@ if ($ADD==31) else {$bgcolor='bgcolor="#9BB9FB"';} - echo "\n"; + echo "\n"; } @@ -7773,6 +7867,7 @@ if ($ADD==31) echo "Status:   \n"; echo "Description:   \n"; echo "Selectable:   \n"; + echo "Human Answer:   \n"; echo "
\n"; echo "
\n"; @@ -9781,7 +9876,53 @@ if ($ADD==311111111111111) echo "\n"; echo "
STATUSDESCRIPTIONSELECTABLEHUMAN ANSWERDELETE
$rowx[0]$rowx[1]$rowx[2]DELETE
$rowx[0]$rowx[1]$rowx[2]$rowx[4]DELETE
\n"; - echo "
\n"; + echo "
\n"; + + + + echo "
\n"; + echo "
VICIDIAL STATUSES WITHIN THIS SYSTEM:   $NWB#vicidial_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_statuses order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + + echo "
STATUSDESCRIPTIONSELECTABLEHUMAN ANSWERDELETE
$rowx[0]$rowx[1]$rowx[2]$rowx[3]\n"; + if (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$rowx[0])) + { + echo "DELETE\n"; + } + else + { + echo "DELETE\n"; + } + echo "
\n"; + + echo "
ADD NEW SYSTEM STATUS
\n"; + echo "\n"; + echo "Status:   \n"; + echo "Description:   \n"; + echo "Selectable:   \n"; + echo "Human Answer:   \n"; + echo "
\n"; + + echo "

\n"; + } else {