From 96f8e9bbcdb7bf8b95fd3a32082c2dc7101a545e Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 16 Nov 2012 21:12:44 +0000 Subject: [PATCH] Added QC functionality git-svn-id: svn://192.168.202.10@1877 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 4 + docs/QC_PROCESS.txt | 195 ++- docs/VICIDIAL_statuses.txt | 1 + extras/MySQL_AST_CREATE_tables.sql | 69 +- extras/upgrade_2.6.sql | 69 + .../TO_BE_TRANSLATED_2.6.txt | 3 + www/agc/audit_comments.php | 98 ++ www/agc/vdc_db_query.php | 61 +- www/agc/vicidial.php | 87 +- www/vicidial/admin.php | 165 +-- www/vicidial/admin_header.php | 10 +- www/vicidial/admin_modify_lead.php | 6 +- www/vicidial/qc/QC_admin_include01.php | 105 ++ www/vicidial/qc/QC_admin_include02.php | 34 + .../qc/QC_admin_modify_lead_include.php | 20 + www/vicidial/qc/QC_admin_variables.php | 15 + www/vicidial/qc/QC_admin_variables01.php | 16 + www/vicidial/qc/QC_call_client_iframe.php | 263 ++++ www/vicidial/qc/QC_call_client_include.php | 45 + www/vicidial/qc/QC_header_include.php | 42 + www/vicidial/qc/QC_header_include01.php | 16 + www/vicidial/qc/QC_header_include02.php | 17 + www/vicidial/qc/QC_status_codes_include.php | 140 ++ www/vicidial/qc/audit_comments.php | 98 ++ www/vicidial/qc/qc_api.php | 627 ++++++++ www/vicidial/qc/qc_modify_lead.php | 1293 +++++++++++++++++ 26 files changed, 3356 insertions(+), 143 deletions(-) create mode 100644 www/agc/audit_comments.php create mode 100644 www/vicidial/qc/QC_admin_include01.php create mode 100644 www/vicidial/qc/QC_admin_include02.php create mode 100644 www/vicidial/qc/QC_admin_modify_lead_include.php create mode 100644 www/vicidial/qc/QC_admin_variables.php create mode 100644 www/vicidial/qc/QC_admin_variables01.php create mode 100644 www/vicidial/qc/QC_call_client_iframe.php create mode 100644 www/vicidial/qc/QC_call_client_include.php create mode 100644 www/vicidial/qc/QC_header_include.php create mode 100644 www/vicidial/qc/QC_header_include01.php create mode 100644 www/vicidial/qc/QC_header_include02.php create mode 100644 www/vicidial/qc/QC_status_codes_include.php create mode 100644 www/vicidial/qc/audit_comments.php create mode 100644 www/vicidial/qc/qc_api.php create mode 100644 www/vicidial/qc/qc_modify_lead.php diff --git a/UPGRADE b/UPGRADE index 70f9ae68..be6768d3 100644 --- a/UPGRADE +++ b/UPGRADE @@ -114,6 +114,10 @@ OTHER CHANGES: 24. Added recording filename variable INGROUP for the In-Group ID of a call +25. Added QC functionality contributed by PoundTeam and Affinity On-Call. + To enable, go to Admin -> System Settings and set "QC Features Active" + to "1", then submit. + diff --git a/docs/QC_PROCESS.txt b/docs/QC_PROCESS.txt index f53f14ef..66f7772f 100644 --- a/docs/QC_PROCESS.txt +++ b/docs/QC_PROCESS.txt @@ -1,4 +1,197 @@ -QC(Quality Control) process flow 2008-01-03 +QC(Quality Control) process flow 2012-11-16 + +Thanks to the Pound Team(pounteam.com) and Affinity On-Call(affinity.co.za) for +contributing this functionaly QC application to the vicidial project. + +Below are the basic operating instructions for how the QC system works. + +As of SVN/trunk revision 1877, this is built into the vicidial codebase. + +The full instructions for how to use these QC features will be added to the Vicidial +Manager Manuals soon. + +For the full QC manual, go here: +http://www.vicidial.org/docs/Vicidial_Quality_Control_Manual_v1.pdf + + + +To enable QC functionality, go to Admin -> System Settings and set "QC Features Active" to "1", then submit. +(Note: API must also be active in the System Settings for this to work) + + +Configure Campaigns/Lists/Users: + +For Each Campaign: +Detail View (top menu) +QC (top menu) +QC Enabled: Y +Check boxes for one or more Statuses + +For Each List: +Audit Comments: Y (Optional, only if using Audited Comments) + +For Each QC User: (such as 6666 or admin, plus any other QC users) +QC Enabled: 1 +QC User Level: 1 +QC Pass: 1 +QC Finish: 1 +QC Commit: 1 +Agent Call Manual: 1 +Agent API Access: 1 + +For Each AGENT: (non QC, standard agents) +Agent-Only Callbacks: 1 +Agent Call Manual: 1 + + +Notes: +Campaigns with QC active will now appear under the “Quality Control” left menu. +Calls dispositioned in one of those campaigns with a QC selected status will appear under the Campaign. +Clicking on each lead will allow the QC agent to “Pass/Fail/Cancel” each lead. Fail will appear in the “Callbacks” for the originating agent to “re-sell” or fix the problem(s) with the sale. +If activated, Audited Comments will be visible in QC Modify Lead (NOT in “Comments” for each lead, they are removed from this editable field and placed in a view only table!). Agents may view comment history when on a call with a client who has comment history. Administrators must be in QC Modify Lead to view comment history. + + + + + + +Each Campaign: + +Enable QC for each campaign +Detail View -> QC -> QC Enabled = Y + +Choose QC Statuses +Check the boxes for each Status you want to be managed by the QC system. You can select just one (such as SALE), or you can select as many as you would like. +Any previously dispositioned leads with these statuses will automatically be included in the QC system, even though QC was not installed when they happened. + + +Each List: + +Enable Audited Comments for each List +Audited Comments = Y +Audited comments will move comments made by agents to a secure table where agents will be able to VIEW but not CHANGE those previous comments. They will also be available for VIEW in the QC system for modifying leads. This can also be accessed by those in the Admin Modify Lead page for those with QC privileges (link at the bottom of the page to move to the QC modify page, which will log all views/edits). + +Note: This is optional and only applies if you want to activate the audited comments system. This will only affect campaigns on which it is turned on. This cannot be “deactivated” to retrieve the comments. Once comments are “audited” they are moved to a separate table and no longer editable or visible on the record except in the audited comments system. +Choose QC Statuses +Check the boxes for each Status you want to be managed by the QC system. You can select just one (such as SALE), or you can select as many as you would like. +Any previously dispositioned leads with these statuses will automatically be included in the QC system, even though QC was not installed when they happened. + +Modify/Create System QC Results +Admin -> System Statuses -> QC Status Codes + +Modify the names of the “CANCEL”, “PASS”, “FAIL” status codes to suit your needs (do not change the CATEGORY). + +Note: We have not tested qc with different names. Please send feedback regarding success OR failure of changing the names! + +Note: Creating new QC Results is (as yet) untested. (Alpha: use at your own risk, please report results) + +Note: “Commit” category is not yet active (Can be created and possibly chosen, but will cause no “action” within Vicidial regarding QC). + +Info Regarding QC Categories + “Cancel” category items will simply change the status to the given statuscode. +“Pass” category items will simply change the status to the given statuscode. +“Fail” category items will create a callback for the sales agent which will require that the sale be re-sold to get back to QC again. + +Note: Fail category items require a MATCHING System Status or Campaign Status with “Schedule Callback” = “Y” to cause a callback to be created. + +Note: Adding new “Fail” or other QC Results is (as yet) untested. . (Alpha: use at your own risk, please report results) + + +Standard and QC User requirements + +Regular users must have agent-only callback and Agent Call Manual (or they cannot call clients back for a QC reject, so this is required for QC callbacks). +Vicidial Administration->Users->(choose user)->Agent-Only Callbacks + +Agent Call Manual + +QC Users must have Agent Call Manual (or they cannot call clients during QC) +Vicidial Administration->Users->(choose user)->Agent Call Manual + +Agent Call Manual + +User Level of 2 or greater + +QC Enabled + +Agent API Access + +QC User Level 1 (or higher, levels are not yet differentiated but will be as the package matures) + +QC Pass / Finish / Commit – Not in use yet. +User Group settings for QC Allowed Campaigns / InGroups – Not in use yet. +Standard Agent Interface +QC Rejections will be received in “Callbacks”. +Method to resolve a QC Rejection: Manual dial client, correct errors and/or create new recording based on notes from QC agent in the QCFAIL callback record. +Agent Call Manual – Without this the agent cannot manual dial + +Agent-Only Callbacks – Without this the agent will not see callback notification in agent window + +QC User Interface +Note: Until there are QC campaigns with Sales in them … there will be nothing to look at in the QC menu! +Enter the QC System +Admin->Quality Control + +Choose a Campaign to QC + +Select one record at a time to QC + +QC Each Record in Queue +With Each Record: +Listen to recordings listed at bottom of screen +To call client you must be logged in, in manual dial mode, in the correct campaign (Alpha NOTE: System does not presently verify Campaign!) +IF you call the client, disposition that call normally FIRST (as any agent would). THEN disposition in the QC window. Do not make changes in the AGENT screen (this may change in later versions), except to disposition at the end of the call. +After completing the call on the agent screen and dispositioning, choose your QC Result in the QC screen. +To set the call to FAIL (and require the original agent to re-call the client): +QC Result: FAIL +SUBMIT +If you want to make specific notes regarding the reason for the failure, they can be made in one of two ways: +1. Use the Comment field before submitting (At present these notes will be editable / deletable by the agent). +2. After submitting press Go back to re-modify this QC lead and modify the CallBack Details. (These will be temporary and viewable only by the agent during the call. However, in the future these will then appear with the Audited Comments because they are stored in the Vicidial callbacks table.) +To specify a Date/Time other than “NOW” for the callback OR to schedule for a different user or to leave notes for the reason for the FAIL: +Press “Go back to re-modify this QC lead” on the resulting page +Then set the date/time/user +SUBMIT (at the bottom of the callback details, not the QC Result!) +When done, click on QC Campaign at the top of the page for your next record +Quality Control Log +Viewing: +The QC log records are only visible within the QC system. Each time a QC agent views or modifies a record, the view and all changes are logged. It can be viewed on each lead record along with the call and recording logs. +Log showing viewed*: + +Log showing modified*: + +*Note: There will always be a “viewed” record as the last entry when YOU are VIEWING the record. Obviously. +Viewing actual changes to the record: +The record is viewed via the “tooltip” accessed by putting your mouse over the word “details”. We will later add a “Detail viewing page”. This function works well in IE, but in Firefox there is no “Line Ending” option in a tooltip, so the lines are not easily read. + +Note for developers: All information for the viewed and modified records is stored in vicidial_qc_agent_log. All changes made to the vicidial_list record are stored in the “details” field. +Notes +Testing: “QC Only” user modeled after “Reporting Only” user. Requires user level > 1, active = “Y”, and QC Enabled. +To QC Modify a lead that is NOT presently a QC status (whether it was in the past or not), search for and Modify the lead (under Lists->Search for a Lead), then click on “Click here to QC Modify this lead” at the bottom of the Admin Modify Lead screen (if you have QC permissions, this will be visible). + + + + + + + + + + + + + + + + + + + + + +******************** ARCHIVED DOC BELOW, NOT APPLICABLE ********************************************** + +******************** PLEASE IGNORE FURTHER CONTENT, IT WILL BE DELETED IN A FUTURE REVISION ********** + ** THIS QC FUNCTIONALITY PROSESS IS PLANNED FOR THE 2.0.5 RELEASE AND IS CURRENTLY IN DEVELOPMENT ** diff --git a/docs/VICIDIAL_statuses.txt b/docs/VICIDIAL_statuses.txt index a2dd7323..a0838fdf 100644 --- a/docs/VICIDIAL_statuses.txt +++ b/docs/VICIDIAL_statuses.txt @@ -62,3 +62,4 @@ SVYCLM - Survey sent to Call Menu - Survey outbound campaign status only MLINAT - Multi-Lead auto-alt-dial lead set to inactive MAXCAL - Max Calls drop from in-group LRERR - Outbound Local Channel Resolution Error +QCFAIL - QC_FAIL_CALLBK diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 21466cb7..cd0d04ea 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -2698,6 +2698,63 @@ index (call_date) ); +CREATE TABLE vicidial_qc_agent_log ( +qc_agent_log_id INT(9) unsigned NOT NULL AUTO_INCREMENT, +qc_user VARCHAR(20) COLLATE utf8_unicode_ci NOT NULL, +qc_user_group VARCHAR(20) COLLATE utf8_unicode_ci NOT NULL, +qc_user_ip VARCHAR(15) COLLATE utf8_unicode_ci NOT NULL, +lead_user VARCHAR(20) COLLATE utf8_unicode_ci NOT NULL, +web_server_ip VARCHAR(15) COLLATE utf8_unicode_ci NOT NULL, +view_datetime DATETIME NOT NULL, +save_datetime DATETIME DEFAULT NULL, +view_epoch INT(10) unsigned NOT NULL, +save_epoch INT(10) unsigned DEFAULT NULL, +elapsed_seconds SMALLINT(5) unsigned DEFAULT NULL, +lead_id INT(9) unsigned NOT NULL, +list_id BIGINT(14) unsigned NOT NULL, +campaign_id VARCHAR(8) COLLATE utf8_unicode_ci NOT NULL, +old_status VARCHAR(6) COLLATE utf8_unicode_ci DEFAULT NULL, +new_status VARCHAR(6) COLLATE utf8_unicode_ci DEFAULT NULL, +details TEXT COLLATE utf8_unicode_ci, +processed ENUM('Y','N') COLLATE utf8_unicode_ci NOT NULL, +PRIMARY KEY (qc_agent_log_id), +KEY view_epoch (view_epoch) +); + +CREATE TABLE vicidial_comments ( +comment_id BIGINT(20) unsigned NOT NULL AUTO_INCREMENT, +lead_id INT(11) NOT NULL, +user_id INT(11) NOT NULL, +timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +list_id INT(11) NOT NULL, +campaign_id INT(11) NOT NULL, +comment VARCHAR(255) COLLATE utf8_unicode_ci NOT NULL, +hidden TINYINT(1) DEFAULT NULL, +hidden_user_id INT(11) DEFAULT NULL, +hidden_timestamp DATETIME DEFAULT NULL, +unhidden_user_id INT(11) DEFAULT NULL, +unhidden_timestamp DATETIME DEFAULT NULL, +PRIMARY KEY (comment_id), +index (lead_id) +); + +CREATE TABLE vicidial_configuration ( +id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY , +name VARCHAR(36) NOT NULL , +value VARCHAR(36) NOT NULL , +UNIQUE (name) +); + +CREATE TABLE vicidial_lists_custom ( +list_id BIGINT(14) unsigned NOT NULL, +audit_comments TINYINT(1) DEFAULT NULL COMMENT 'visible', +audit_comments_enabled TINYINT(1) DEFAULT NULL COMMENT 'invisible', +PRIMARY KEY (list_id) +); + + +ALTER TABLE vicidial_qc_codes ADD qc_result_type ENUM( 'PASS', 'FAIL', 'CANCEL', 'COMMIT' ) NOT NULL; + ALTER TABLE vicidial_campaign_server_stats ENGINE=MEMORY; ALTER TABLE live_channels ENGINE=MEMORY; @@ -2917,5 +2974,15 @@ INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,cate INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable,scheduled_callback,completed) values('MLINAT','Multi-Lead auto-alt-dial lead set to inactive','N','Y','UNDEFINED','N','N','N','N','N','N','Y'); INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable,scheduled_callback,completed) values('MAXCAL','Inbound Max Calls Drop','N','Y','UNDEFINED','N','N','N','N','N','N','N'); INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable,scheduled_callback,completed) values('LRERR','Outbound Local Channel Res Err','N','Y','UNDEFINED','N','N','N','N','N','N','N'); +INSERT INTO vicidial_statuses (status, status_name, selectable, human_answered, category, sale, dnc, customer_contact, not_interested, unworkable, scheduled_callback) VALUES ('QCFAIL', 'QC_FAIL_CALLBK', 'N', 'Y', 'QC', 'N', 'N', 'Y', 'N', 'N', 'Y'); -UPDATE system_settings SET db_schema_version='1330',db_schema_update_date=NOW(); +INSERT INTO vicidial_qc_codes (code,code_name,qc_result_type) VALUES ('QCPASS','PASS','PASS'); +INSERT INTO vicidial_qc_codes (code,code_name,qc_result_type) VALUES ('QCFAIL','FAIL','FAIL'); +INSERT INTO vicidial_qc_codes (code,code_name,qc_result_type) VALUES ('QCCANCEL','CANCEL','CANCEL'); + +INSERT INTO vicidial_configuration (id, name, value) VALUES (NULL, 'qc_database_version', '1638'); +UPDATE vicidial_configuration set value='1766' where name='qc_database_version'; + +UPDATE system_settings set vdc_agent_api_active='1'; + +UPDATE system_settings SET db_schema_version='1331',db_schema_update_date=NOW(); diff --git a/extras/upgrade_2.6.sql b/extras/upgrade_2.6.sql index 6daa345e..5f1a3a65 100644 --- a/extras/upgrade_2.6.sql +++ b/extras/upgrade_2.6.sql @@ -92,3 +92,72 @@ ALTER TABLE vicidial_campaigns ADD pause_after_next_call ENUM('ENABLED','DISABLE ALTER TABLE vicidial_campaigns ADD owner_populate ENUM('ENABLED','DISABLED') default 'DISABLED'; UPDATE system_settings SET db_schema_version='1330',db_schema_update_date=NOW() where db_schema_version < 1330; + +CREATE TABLE vicidial_qc_agent_log ( +qc_agent_log_id INT(9) unsigned NOT NULL AUTO_INCREMENT, +qc_user VARCHAR(20) COLLATE utf8_unicode_ci NOT NULL, +qc_user_group VARCHAR(20) COLLATE utf8_unicode_ci NOT NULL, +qc_user_ip VARCHAR(15) COLLATE utf8_unicode_ci NOT NULL, +lead_user VARCHAR(20) COLLATE utf8_unicode_ci NOT NULL, +web_server_ip VARCHAR(15) COLLATE utf8_unicode_ci NOT NULL, +view_datetime DATETIME NOT NULL, +save_datetime DATETIME DEFAULT NULL, +view_epoch INT(10) unsigned NOT NULL, +save_epoch INT(10) unsigned DEFAULT NULL, +elapsed_seconds SMALLINT(5) unsigned DEFAULT NULL, +lead_id INT(9) unsigned NOT NULL, +list_id BIGINT(14) unsigned NOT NULL, +campaign_id VARCHAR(8) COLLATE utf8_unicode_ci NOT NULL, +old_status VARCHAR(6) COLLATE utf8_unicode_ci DEFAULT NULL, +new_status VARCHAR(6) COLLATE utf8_unicode_ci DEFAULT NULL, +details TEXT COLLATE utf8_unicode_ci, +processed ENUM('Y','N') COLLATE utf8_unicode_ci NOT NULL, +PRIMARY KEY (qc_agent_log_id), +KEY view_epoch (view_epoch) +); + +CREATE TABLE vicidial_comments ( +comment_id BIGINT(20) unsigned NOT NULL AUTO_INCREMENT, +lead_id INT(11) NOT NULL, +user_id INT(11) NOT NULL, +timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +list_id INT(11) NOT NULL, +campaign_id INT(11) NOT NULL, +comment VARCHAR(255) COLLATE utf8_unicode_ci NOT NULL, +hidden TINYINT(1) DEFAULT NULL, +hidden_user_id INT(11) DEFAULT NULL, +hidden_timestamp DATETIME DEFAULT NULL, +unhidden_user_id INT(11) DEFAULT NULL, +unhidden_timestamp DATETIME DEFAULT NULL, +PRIMARY KEY (comment_id), +index (lead_id) +); + +CREATE TABLE vicidial_configuration ( +id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY , +name VARCHAR(36) NOT NULL , +value VARCHAR(36) NOT NULL , +UNIQUE (name) +); + +CREATE TABLE vicidial_lists_custom ( +list_id BIGINT(14) unsigned NOT NULL, +audit_comments TINYINT(1) DEFAULT NULL COMMENT 'visible', +audit_comments_enabled TINYINT(1) DEFAULT NULL COMMENT 'invisible', +PRIMARY KEY (list_id) +); + +ALTER TABLE vicidial_qc_codes ADD qc_result_type ENUM( 'PASS', 'FAIL', 'CANCEL', 'COMMIT' ) NOT NULL; + +INSERT INTO vicidial_qc_codes (code,code_name,qc_result_type) VALUES ('QCPASS','PASS','PASS'); +INSERT INTO vicidial_qc_codes (code,code_name,qc_result_type) VALUES ('QCFAIL','FAIL','FAIL'); +INSERT INTO vicidial_qc_codes (code,code_name,qc_result_type) VALUES ('QCCANCEL','CANCEL','CANCEL'); + +INSERT INTO vicidial_statuses (status, status_name, selectable, human_answered, category, sale, dnc, customer_contact, not_interested, unworkable, scheduled_callback) VALUES ('QCFAIL', 'QC_FAIL_CALLBK', 'N', 'Y', 'QC', 'N', 'N', 'Y', 'N', 'N', 'Y'); + +INSERT INTO vicidial_configuration (id, name, value) VALUES (NULL, 'qc_database_version', '1638'); +UPDATE vicidial_configuration set value='1766' where name='qc_database_version'; + +UPDATE system_settings set vdc_agent_api_active='1'; + +UPDATE system_settings SET db_schema_version='1331',db_schema_update_date=NOW() where db_schema_version < 1331; diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.6.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.6.txt index d81b56f6..4f991b3b 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.6.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.6.txt @@ -29,6 +29,8 @@ If this is enabled and the owner field of the lead is blank, the owner field for This field allows you to customize the name of the recording when Campaign recording is ONDEMAND or ALLCALLS. The allowed variables are|| The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. Te resulting filename must be less than 90 characters in length|| This field will override the Campaign Recording Filenaming Scheme unless it is set to NONE. The allowed variables are|| +Audit Comments|| +This option allows comments to be moved to an audit table. No longer editable, but viewable along with the date-time-creator of each comment. Default is N. This is a part of the Quality Control Add-On|| ############################################################ CLIENT @@ -47,6 +49,7 @@ Called Count|| Unidentified Hangup Cause Code|| YOU MUST SELECT AN AGENT TO TRANSFER TO WHEN USING AGENTDIRECT|| Another live agent session was open using your user ID. It has been disabled. Click OK to continue to the agent screen|| +View Comment History|| ############################################################ MANAGER Manual diff --git a/www/agc/audit_comments.php b/www/agc/audit_comments.php new file mode 100644 index 00000000..141ef589 --- /dev/null +++ b/www/agc/audit_comments.php @@ -0,0 +1,98 @@ +"; + } + $rslt=mysql_query($stmt, $link); + if ($mel > 0) { + mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-AuditComments2',$user,$server_ip,$session_name,$one_mysql_log); + } + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 0) { + $comment=$row[0]; + //Put comment in comment table + $stmt="INSERT INTO vicidial_comments (lead_id,user_id,list_id,campaign_id,comment) VALUES ('$lead_id','$user','$list_id','$campaign','$comment');"; + if ($format=='debug') { + echo "\n"; + } + $rslt=mysql_query($stmt, $link); + if ($mel > 0) { + mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-AuditComments3',$user,$server_ip,$session_name,$one_mysql_log); + } + $affected=mysql_affected_rows(); + if($affected>0) { + $stmt="UPDATE vicidial_list set comments='' where lead_id='$lead_id';"; + if ($format=='debug') { + echo "\n"; + } + $rslt=mysql_query($stmt, $link); + if ($mel > 0) { + mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-AuditComments4',$user,$server_ip,$session_name,$one_mysql_log); + } + } else { + mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-AuditCommentsERROR-Comment not moved',$user,$server_ip,$session_name,$one_mysql_log); + echo "\n"; + } + } + } +} +function audit_comments_active($list_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log){ + $stmt="select count(audit_comments) from vicidial_lists_custom where list_id='$list_id' and audit_comments='1' limit 1;"; + if ($format=='debug') { + echo "\n"; + } + $rslt=mysql_query($stmt, $link); + if ($mel > 0) { + mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-AuditComments5',$user,$server_ip,$session_name,$one_mysql_log); + } + $row=mysql_fetch_row($rslt); + if ($row[0] == '1') { + return true; + } else { + return false; + } +} +function get_audited_comments($lead_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log) { + global $ACcount; + global $ACcomments; + $stmt="select user_id,comment from vicidial_comments where lead_id='$lead_id';"; + if ($mel > 0) { + mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"00142-65-AuditComments:$stmt LeadID: $lead_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log",$user,$server_ip,$session_name,$one_mysql_log); + } + $rslt=mysql_query($stmt, $link); + if ($mel > 0) { + mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-69-AuditComments',$user,$server_ip,$session_name,$one_mysql_log); + } + $ACcount=mysql_num_rows($rslt); + mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-72-AuditComments $ACcount='.$ACcount,$user,$server_ip,$session_name,$one_mysql_log); + if($ACcount>0) { + $i=0; + while ($i < $ACcount) { + $row=mysql_fetch_row($rslt); + mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-77-AuditComments UserID='.$row[0],$user,$server_ip,$session_name,$one_mysql_log); + $ACcomments .= "UserID: $row[0]\n"; + mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-79-AuditComments Comment='.$row[1],$user,$server_ip,$session_name,$one_mysql_log); + $ACcomments .= $row[1]; + $ACcomments .= "\n----------------------------------\n"; + $i++; + } + return true; + } else { + return false; + } +} +?> diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index 372adac8..6e493cf9 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -315,10 +315,11 @@ # 121018-2320 - Added blank option to owner only dialing # 121029-0159 - Added owner_populate campaign option # 121114-1749 - Fixed manual dial lead preview script variable issue +# 121116-1409 - Added QC functionality # -$version = '2.6-213'; -$build = '121114-1749'; +$version = '2.6-214'; +$build = '121116-1409'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=443; $one_mysql_log=0; @@ -650,7 +651,7 @@ $hangup_cause_dictionary = array( ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,qc_features_active FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -666,6 +667,7 @@ if ($qm_conf_ct > 0) $alt_log_login = $row[5]; $alt_log_pass = $row[6]; $tables_use_alt_log_db = $row[7]; + $qc_features_active = $row[8]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -1186,6 +1188,14 @@ if ($ACTION == 'UpdateFields') { $rowx=mysql_fetch_row($rslt); if ($rowx[0] > 0) {$lead_id = $rowx[0];} + ### ADDED BY POUNDTEAM FOR AUDITED COMMENTS! acquire audited comment count for this lead + $stmt="SELECT count(comment_id) as comment_count FROM vicidial_comments where lead_id='$lead_id' and hidden is null"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00275',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_comment_count = trim("$row[0]"); + ##### grab the data from vicidial_list for the lead_id $stmt="SELECT vendor_lead_code,source_id,gmt_offset_now,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,rank,owner FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; $rslt=mysql_query($stmt, $link); @@ -1250,6 +1260,7 @@ if ($ACTION == 'UpdateFields') $LeaD_InfO .= $comments . "\n"; $LeaD_InfO .= $rank . "\n"; $LeaD_InfO .= $owner . "\n"; + $LeaD_InfO .= $lead_comment_count . "\n"; $LeaD_InfO .= "\n"; echo $LeaD_InfO; @@ -2166,6 +2177,23 @@ if ($ACTION == 'manDiaLnextCaLL') $entry_list_id = trim("$row[34]"); if ($entry_list_id < 100) {$entry_list_id = $list_id;} } + if ($qc_features_active > 0) + { + //Added by Poundteam for Audited Comments + ##### if list has audited comments, grab the audited comments + require_once('audit_comments.php'); + $ACcount = ''; + $ACcomments = ''; + $audit_comments_active=audit_comments_active($list_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log); + if ($audit_comments_active) + { + get_audited_comments($lead_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log); + } + $ACcomments = strip_tags(htmlentities($ACcomments)); + $ACcomments = eregi_replace("\r",'',$ACcomments); + $ACcomments = eregi_replace("\n",'!N',$ACcomments); + //END Added by Poundteam for Audited Comments + } $called_count++; @@ -2826,6 +2854,8 @@ if ($ACTION == 'manDiaLnextCaLL') $LeaD_InfO .= $LISTweb_form_address . "\n"; $LeaD_InfO .= $LISTweb_form_address_two . "\n"; $LeaD_InfO .= $post_phone_time_diff_alert_message . "\n"; + $LeaD_InfO .= $ACcount . "\n"; + $LeaD_InfO .= $ACcomments . "\n"; echo $LeaD_InfO; } @@ -4831,6 +4861,23 @@ if ($ACTION == 'VDADcheckINCOMING') $entry_list_id = trim("$row[34]"); if ($entry_list_id < 100) {$entry_list_id = $list_id;} } + if ($qc_features_active > 0) + { + //Added by Poundteam for Audited Comments + ##### if list has audited comments, grab the audited comments + require_once('audit_comments.php'); + $ACcount = ''; + $ACcomments = ''; + $audit_comments_active=audit_comments_active($list_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log); + if ($audit_comments_active) + { + get_audited_comments($lead_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log); + } + $ACcomments = strip_tags(htmlentities($ACcomments)); + $ACcomments = eregi_replace("\r",'',$ACcomments); + $ACcomments = eregi_replace("\n",'!N',$ACcomments); + //END Added by Poundteam for Audited Comments + } ##### if lead is a callback, grab the callback comments $CBentry_time = ''; @@ -5549,6 +5596,10 @@ if ($ACTION == 'VDADcheckINCOMING') $LeaD_InfO .= $custom_field_names . "\n"; $LeaD_InfO .= $custom_field_values . "\n"; $LeaD_InfO .= $custom_field_types . "\n"; + $LeaD_InfO .= $LISTweb_form_address . "\n"; + $LeaD_InfO .= $LISTweb_form_address_two . "\n"; + $LeaD_InfO .= $ACcount . "\n"; + $LeaD_InfO .= $ACcomments . "\n"; echo $LeaD_InfO; @@ -6198,12 +6249,14 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00285',$user,$server_ip,$session_name,$one_mysql_log);} } - $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142',$user,$server_ip,$session_name,$one_mysql_log);} + //Added by Poundteam Incorporated for Audit Comments Package + require_once('audit_comments.php'); + audit_comments($lead_id,$list_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log,$campaign); # $fp = fopen ("./vicidial_debug.txt", "a"); # fwrite ($fp, "$NOW_TIME|DISPO_CALL |$MDnextCID|$stage|$campaign|$lead_id|$dispo_choice|$user|$uniqueid|$auto_dial_level|$agent_log_id|\n"); # fclose($fp); diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index a3efd9fe..ca81c28f 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -388,10 +388,11 @@ # 121029-0122 - Added pause_after_next_call and owner_populate campaign options # 121114-1759 - Fixed manual dial lead preview script variable issue # 121114-1937 - Added INGROUP recording option +# 121116-1407 - Added QC functionality # -$version = '2.6-356c'; -$build = '121114-1937'; +$version = '2.6-357c'; +$build = '121116-1407'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=79; $one_mysql_log=0; @@ -476,7 +477,7 @@ $random = (rand(1000000, 9999999) + 10000000); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled,pllb_grouping_limit FROM system_settings;"; +$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled,pllb_grouping_limit,qc_features_active FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -498,6 +499,7 @@ if ($qm_conf_ct > 0) $static_agent_url = $row[11]; $custom_fields_enabled = $row[12]; $SSpllb_grouping_limit = $row[13]; + $qc_enabled = $row[14]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -3639,6 +3641,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var next_call_pause=''; var deactivated_old_session=''; var owner_populate=''; + var qc_enabled=''; var DiaLControl_auto_HTML = "\"\"Resume\""; var DiaLControl_auto_HTML_ready = "\"\"Resume\""; var DiaLControl_auto_HTML_OFF = "\"\"Resume\""; @@ -6833,6 +6836,16 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var list_webform = MDnextResponse_array[48]; var list_webform_two = MDnextResponse_array[49]; post_phone_time_diff_alert_message = MDnextResponse_array[50]; + //Added By Poundteam for Audited Comments (Manual Dial Section Only) + if (qc_enabled > 0) + { + document.vicidial_form.ViewCommentButton.value = MDnextResponse_array[51]; + document.vicidial_form.audit_comments_button.value = MDnextResponse_array[51]; + var REGACcomments = new RegExp("!N","g"); + MDnextResponse_array[52] = MDnextResponse_array[52].replace(REGACcomments, "\n"); + document.vicidial_form.audit_comments.value = MDnextResponse_array[52]; + } + //END section Added By Poundteam for Audited Comments timer_action = campaign_timer_action; timer_action_message = campaign_timer_action_message; @@ -7100,6 +7113,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.vicidial_form.email.value =''; document.vicidial_form.security_phrase.value=''; document.vicidial_form.comments.value =''; + document.vicidial_form.audit_comments.value =''; + if (qc_enabled > 0) + { + document.vicidial_form.ViewCommentButton.value =''; + document.vicidial_form.audit_comments_button.value =''; + } document.vicidial_form.called_count.value =''; document.vicidial_form.rank.value =''; document.vicidial_form.owner.value =''; @@ -7810,7 +7829,17 @@ function set_length(SLnumber,SLlength_goal,SLdirection) custom_field_names = check_VDIC_array[48]; custom_field_values = check_VDIC_array[49]; custom_field_types = check_VDIC_array[50]; - + //Added By Poundteam for Audited Comments (Manual Dial Section Only) + if (qc_enabled > 0) + { + document.vicidial_form.ViewCommentButton.value = check_VDIC_array[53]; + document.vicidial_form.audit_comments_button.value = check_VDIC_array[53]; + var REGACcomments = new RegExp("!N","g"); + check_VDIC_array[54] = check_VDIC_array[54].replace(REGACcomments, "\n"); + document.vicidial_form.audit_comments.value = check_VDIC_array[54]; + } + //END section Added By Poundteam for Audited Comments + // Add here for AutoDial (VDADcheckINCOMING in vdc_db_query) if (hide_gender > 0) { @@ -9238,6 +9267,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.vicidial_form.email.value =''; document.vicidial_form.security_phrase.value=''; document.vicidial_form.comments.value =''; + document.vicidial_form.audit_comments.value =''; + if (qc_enabled > 0) + { + document.vicidial_form.ViewCommentButton.value =''; + document.vicidial_form.audit_comments_button.value =''; + } document.vicidial_form.called_count.value =''; document.vicidial_form.call_notes.value =''; document.vicidial_form.call_notes_dispo.value =''; @@ -12005,6 +12040,7 @@ function phone_number_format(formatphone) { hideDiv('EAcommentsMinBox'); hideDiv('HotKeyActionBox'); hideDiv('HotKeyEntriesBox'); + hideDiv('ViewCommentsBox'); hideDiv('MainPanel'); hideDiv('ScriptPanel'); hideDiv('ScriptRefresH'); @@ -12093,6 +12129,8 @@ function phone_number_format(formatphone) { {hideDiv('ParkCustomerDial');} if (AllowManualQueueCallsChoice == '1') {document.getElementById("ManualQueueChoice").innerHTML = "Manual Queue is Off
";} + if (qc_enabled < 1) + {document.getElementById("viewcommentsdisplay").innerHTML = "";} document.vicidial_form.LeadLookuP.checked=true; @@ -12787,6 +12825,24 @@ function phone_number_format(formatphone) { } } + function ViewComments(VCommstate) + { + if ( (VCommstate == 'ON') ) + { + showDiv('ViewCommentsBox'); + //view_comments_active = 1; + document.getElementById("viewcommentsdisplay").innerHTML = ""; + } + else + { + hideDiv('ViewCommentsBox'); + //view_comments_active = 0; + document.getElementById("viewcommentsdisplay").innerHTML = ""; + document.vicidial_form.ViewCommentButton.value = document.vicidial_form.audit_comments_button.value; + + } + } + function ShoWTransferMain(showxfervar,showoffvar) { if (VU_vicidial_transfers == '1') @@ -13299,14 +13355,15 @@ $zi=2; } else { - echo "$label_comments: "; + echo "$label_comments:
+ "; if ( ($multi_line_comments) ) {echo "\n";} else {echo "\n";} } - - echo "\n"; + echo " + \n"; if ($per_call_notes == 'ENABLED') { @@ -13634,7 +13691,19 @@ Available Agents Transfer: - + + + px height='px'> + + + + + + +
View Comment History:
+
+ @@ -14191,4 +14260,4 @@ Available Agents Transfer: \ No newline at end of file +?> diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 8ee12aeb..4a8f0396 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -70,6 +70,8 @@ $reports_font = 'BLACK'; $cts_font = 'BLACK'; $subcamp_font = 'BLACK'; +### QC font and color variables +require_once('qc/QC_admin_variables.php'); ### comment this section out for colorful section headings $users_color = '#E6E6E6'; $campaigns_color = '#E6E6E6'; @@ -1540,6 +1542,8 @@ if (isset($_GET["auto_resume_precall"])) {$auto_resume_precall=$_GET["auto_res elseif (isset($_POST["auto_resume_precall"])) {$auto_resume_precall=$_POST["auto_resume_precall"];} if (isset($_GET["auto_pause_precall_code"])) {$auto_pause_precall_code=$_GET["auto_pause_precall_code"];} elseif (isset($_POST["auto_pause_precall_code"])) {$auto_pause_precall_code=$_POST["auto_pause_precall_code"];} +if (isset($_GET["audit_comments"])) {$audit_comments=$_GET["audit_comments"];} + elseif (isset($_POST["audit_comments"])) {$audit_comments=$_POST["audit_comments"];} if (isset($_GET["reload_dialplan_on_servers"])) {$reload_dialplan_on_servers=$_GET["reload_dialplan_on_servers"];} elseif (isset($_POST["reload_dialplan_on_servers"])) {$reload_dialplan_on_servers=$_POST["reload_dialplan_on_servers"];} if (isset($_GET["manual_dial_cid"])) {$manual_dial_cid=$_GET["manual_dial_cid"];} @@ -3162,12 +3166,13 @@ else # 121027-2344 - Added servers versions page # 121029-0109 - Added pause_after_next_call and owner_populate campaign options # 121114-1923 - Added Basic Lead Management page link. Added INGROUP as a recording filename option +# 121116-1410 - Added QC functionality # # 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.6-381a'; -$build = '121114-1923'; +$admin_version = '2.6-382a'; +$build = '121116-1410'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -3221,7 +3226,6 @@ if ($force_logout) echo "You have now logged out. Thank you\n"; exit; } - ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin,auto_dial_limit,user_territories_active,allow_custom_dialplan,callcard_enabled,admin_modify_refresh,nocache_admin,webroot_writable FROM system_settings;"; @@ -3262,6 +3266,10 @@ if ( ($reports_auth > 0) and ($auth < 1) ) $ADD=999999; $reports_only_user=1; } +############################################## +# Include QC Agents with no other permission # +############################################## +require_once('qc/QC_admin_include02.php'); if ($SSwebroot_writable > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} @@ -3270,7 +3278,7 @@ $date = date("r"); $ip = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); -if ( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or ( ($auth < 1 ) and ($reports_auth < 1) ) ) +if ( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or ( ($auth < 1 ) and ($reports_auth < 1) and ($qc_auth < 1)) ) { Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); Header("HTTP/1.0 401 Unauthorized"); @@ -3278,7 +3286,7 @@ if ( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or ( ($auth < 1 ) an exit; } -if ( ($auth > 0) or ($reports_auth > 0) ) +if ( ($auth > 0) or ($reports_auth > 0) or ($qc_auth > 0) ) { $office_no=strtoupper($PHP_AUTH_USER); $password=strtoupper($PHP_AUTH_PW); @@ -3774,6 +3782,8 @@ if ($ADD==180000000000) {$hh='admin'; $sh='label'; echo "SCREEN LABELS LIST";} if ($ADD==190000000000) {$hh='admin'; $sh='cts'; echo "CONTACTS LIST";} if ($ADD==1000000000000) {$hh='admin'; $sh='conference'; echo "CONFERENCE LIST";} if ($ADD==10000000000000) {$hh='admin'; $sh='conference'; echo "VICIDIAL CONFERENCE LIST";} +##QC +require_once('qc/QC_admin_variables01.php'); if ($ADD==550) {$hh='users'; echo "Search Form";} if ($ADD==551) {$hh='users'; echo "SEARCH PHONES";} if ($ADD==660) {$hh='users'; echo "Search Results";} @@ -5836,6 +5846,11 @@ if ($ADD==99999)
Reset Times - This field allows you to put times in, separated by a dash-, that this list will be automatically reset by the system. The times must be in 24 hour format with no punctuation, for example 0800-1700 would reset the list at 8AM and 5PM every day. Default is empty. +
+ +
+ Audit Comments - This option allows comments to be moved to an audit table. No longer editable, but viewable along with the date-time-creator of each comment. Default is N. This is a part of the Quality Control Add-On. +

@@ -13975,41 +13990,7 @@ if ($ADD==231111111111111) ###################### # ADD=241111111111111 adds the new qc status code to the system ###################### - -if ($ADD==241111111111111) - { - echo ""; - $stmt="SELECT count(*) from vicidial_qc_codes where code='$code';"; - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - if ($row[0] > 0) - {echo "
QC STATUS CODE NOT ADDED - there is already a qc status code in the system with this name: $row[0]\n";} - else - { - if ( (strlen($code) < 1) or (strlen($code_name) < 2) ) - { - echo "
QC STATUS CODE NOT ADDED - Please go back and look at the data you entered\n"; - echo "
code must be between 1 and 8 characters in length\n"; - echo "
code name must be between 2 and 30 characters in length\n"; - } - else - { - echo "
QC STATUS CODE ADDED: $code_name - $code\n"; - - $stmt="INSERT INTO vicidial_qc_codes (code,code_name) values('$code','$code_name');"; - $rslt=mysql_query($stmt, $link); - - ### LOG INSERTION Admin Log Table ### - $SQL_log = "$stmt|"; - $SQL_log = ereg_replace(';','',$SQL_log); - $SQL_log = addslashes($SQL_log); - $stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='QCSTATUSES', event_type='ADD', record_id='$code', event_code='ADMIN ADD QC STATUS', event_sql=\"$SQL_log\", event_notes='';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - } - } - $ADD=341111111111111; - } +//Moved to qc/QC_status_codes_include.php include file @@ -15782,7 +15763,6 @@ if ($ADD==401) $stmt="UPDATE vicidial_xfer_presets SET preset_dtmf='$preset_dtmf',preset_number='$preset_number',preset_hide_number='$preset_hide_number' where campaign_id='$campaign_id' and preset_name='$preset_name';"; $rslt=mysql_query($stmt, $link); - ### LOG INSERTION Admin Log Table ### $SQL_log = "$stmt|"; $SQL_log = ereg_replace(';','',$SQL_log); @@ -15855,6 +15835,12 @@ if ($ADD==411) $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description',list_changedate='$SQLdate',reset_time='$reset_time',agent_script_override='$agent_script_override',campaign_cid_override='$campaign_cid_override',am_message_exten_override='$am_message_exten_override',drop_inbound_group_override='$drop_inbound_group_override',xferconf_a_number='$xferconf_a_number',xferconf_b_number='$xferconf_b_number',xferconf_c_number='$xferconf_c_number',xferconf_d_number='$xferconf_d_number',xferconf_e_number='$xferconf_e_number',web_form_address='" . mysql_real_escape_string($web_form_address) . "',web_form_address_two='" . mysql_real_escape_string($web_form_address_two) . "',time_zone_setting='$time_zone_setting',inventory_report='$inventory_report' where list_id='$list_id';"; $rslt=mysql_query($stmt, $link); +## BEGIN QC Addition for Audited Comments + $stmt="INSERT INTO vicidial_lists_custom (audit_comments, list_id) VALUES ('" . mysql_real_escape_string($audit_comments) . "','$list_id') ON DUPLICATE KEY UPDATE audit_comments='" . mysql_real_escape_string($audit_comments) . "';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "|$stmt|\n";} +## END QC Addition for Audited Comments + ### LOG INSERTION Admin Log Table ### $SQL_log = "$stmt|"; $SQL_log = ereg_replace(';','',$SQL_log); @@ -24387,8 +24373,9 @@ if ($ADD==311) echo "
\n"; echo "\n"; echo "\n"; + if($audit_comments=='1') { + echo "\n"; + } else { + echo "\n"; + } echo "\n"; echo "\n"; @@ -30621,89 +30614,12 @@ if ($ADD==331111111111111) +##QC +require_once('qc/QC_status_codes_include.php'); ###################### # ADD=341111111111111 modify vicidial QC status code ###################### - -if ($ADD==341111111111111) - { - if ( ($LOGmodify_servers==1) and ($SSqc_features_active > 0) ) - { - if ( ($SSadmin_modify_refresh > 1) and ($modify_refresh_set < 1) ) - { - $modify_url = "$PHP_SELF?ADD=341111111111111"; - $modify_footer_refresh=1; - } - echo "
\n"; echo ""; - $stmt="SELECT list_id,list_name,campaign_id,active,list_description,list_changedate,list_lastcalldate,reset_time,agent_script_override,campaign_cid_override,am_message_exten_override,drop_inbound_group_override,xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two,time_zone_setting,inventory_report from vicidial_lists where list_id='$list_id' $LOGallowed_campaignsSQL;"; + $stmt="SELECT vicidial_lists.list_id,list_name,campaign_id,active,list_description,list_changedate,list_lastcalldate,reset_time,agent_script_override,campaign_cid_override,am_message_exten_override,drop_inbound_group_override,xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two,time_zone_setting,inventory_report,IFNULL(audit_comments,0) from vicidial_lists left outer join vicidial_lists_custom on vicidial_lists.list_id=vicidial_lists_custom.list_id where vicidial_lists.list_id='$list_id' $LOGallowed_campaignsSQL;"; $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); $list_name = $row[1]; $campaign_id = $row[2]; @@ -24410,6 +24397,7 @@ if ($ADD==311) $web_form_address_two = $row[18]; $time_zone_setting = $row[19]; $inventory_report = $row[20]; + $audit_comments = $row[21]; # grab names of global statuses and statuses in the selected campaign $stmt="SELECT status,status_name,selectable,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable,scheduled_callback,completed from vicidial_statuses order by status;"; @@ -24505,6 +24493,11 @@ if ($ADD==311) echo "
Active: $NWB#vicidial_lists-active$NWE
Reset Lead-Called-Status for this list: $NWB#vicidial_lists-reset_list$NWE
Reset Times: $NWB#vicidial_lists-reset_time$NWE
Audit Comments: $NWB#vicidial_lists-audit_comments$NWE
Audit Comments: $NWB#vicidial_lists-audit_comments$NWE
List Change Date: $list_changedate   $NWB#vicidial_lists-list_changedate$NWE
List Last Call Date: $list_lastcalldate   $NWB#vicidial_lists-list_lastcalldate$NWE
+ @@ -110,6 +112,7 @@ if ($hh=='admin') if ($hh=='reports') {$reports_hh="bgcolor=\"$reports_color\""; $reports_fc="$reports_font"; $reports_bold="$header_selected_bold";} else {$reports_hh=''; $reports_fc='WHITE'; $reports_bold="$header_nonselected_bold";} +include ('qc/QC_header_include01.php'); echo "\n"; echo " + + + + +QC CAMPAIGN $campaign_id: Lead $lead_id - ".urldecode($lead_name)."
\n"; +//end_call is set by submit button to denote "save", without it this is a VIEW, with it this is a SAVE +if ($end_call > 0) { + if($DB) { echo __LINE__."\n"; } + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',title='" . mysql_real_escape_string($title) . "',first_name='" . mysql_real_escape_string($first_name) . "',middle_initial='" . mysql_real_escape_string($middle_initial) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',phone_number='$phone_number',phone_code='$phone_code',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "',rank='" . mysql_real_escape_string($rank) . "',owner='" . mysql_real_escape_string($owner) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + //STATUS just changed, re-capture all data for client! + //Added by Poundteam for QC. Gather record data to display on page and prepopulate title and hrefs, etc. + $stmt="SELECT * from vicidial_list A inner join vicidial_lists B on A.list_id=B.list_id inner join vicidial_campaigns C on B.campaign_id=C.campaign_id left outer join vicidial_statuses D on A.status=D.status left outer join vicidial_qc_codes E on A.status=E.code where A.lead_id='$lead_id'"; + if($DB) { echo "$stmt\n"; } + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_assoc($rslt); + //QUALITY CONTROL CHANGE LOG BEGIN - CHANGE VERSION (VIEW VERSION IS BELOW, WHICH CREATES THE RECORD, THIS ONE MERELY MODIFIES THE EXISTING RECORD) + $new_record=$row; + //if status has changed, the join query above will have the "status" field of "vicidial_list" overwritten by the status field of "vicidial_statuses" ... which will be EMPTY if there is no matching status to the new QC status chosen. This will cause the changelog to be incorrect. + if ( strlen($new_record['status']) == '0' ) { + $new_record['status']=$new_record['code']; + } + + if($original_record != $new_record) { + //Information changed: Find out what and record it, first disable "view" logging + $qcchange='Y'; + $qcchangelist=''; + $qcchangecounter=0; + foreach($original_record as $key=>$value){ + //only list the changes in the first 35 fiels, those are from the vicidial_list table (the rest are from joined tables, and the changes cascade) + if(($new_record[$key]!=$value)&&($qcchangecounter<=35)) $qcchangelist.="----$key----\n$value => $new_record[$key]\n"; + $qcchangecounter++; + } + ### insert a NEW record to the vicidial_closer_log table + $qcchangelist=mysql_real_escape_string($qcchangelist); + $view_epoch = ereg_replace("[^0-9]","",$_POST['viewtime']); + $elapsed_seconds=$STARTtime-$view_epoch; + + $stmt="UPDATE vicidial_qc_agent_log set save_datetime='$NOW_TIME',save_epoch='$STARTtime',elapsed_seconds='$elapsed_seconds',old_status='{$original_record['status']}',new_status='{$new_record['status']}',details='$qcchangelist' + where view_epoch='$view_epoch' and lead_id='$lead_id'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + //QUALITY CONTROL CHANGE LOG END + $original_sales_rep=$row['user']; + $campaign_id =$row['campaign_id']; + $campaign_name =$row['campaign_name']; + $lead_name =trim(trim($row['first_name'].' '.$row['middle_initial']).' '.$row['last_name']); + $scheduled_callback =$row['scheduled_callback']; + + echo "
information modified

\n"; + echo "Go back to re-modify this QC lead


\n"; + echo "
Proceed to QC CAMPAIGN $campaign_id Queue

Callback Information:\n"; + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='LEADS', event_type='MODIFY', record_id='$lead_id', event_code='ADMIN MODIFY LEAD', event_sql=\"$SQL_log\", event_notes='';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if($DB) { + echo __LINE__."\n"; + } + + if ( ($dispo != $status) and ($dispo == 'CBHOLD') ) + { + if($DB) { + echo __LINE__."\n"; + } + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status='ACTIVE';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + //Duped CBHOLD version for vicidial status type 'Scheduled Callback' + if ( ($dispo != $status) and ($scheduled_callback == 'Y') ) + { + if($DB) { + echo __LINE__."\n"; + } + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status='ACTIVE';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + if ( ($dispo != $status) and ($dispo == 'CALLBK') ) + { + if($DB) { + echo __LINE__."\n"; + } + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + + if ( ($dispo != $status) and ($status == 'CBHOLD') ) + { + if($DB) { + echo __LINE__."\n"; + } + ### find any vicidial_callback records for this lead + $stmt="select callback_id from vicidial_callbacks where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE') order by callback_id desc LIMIT 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $CBM_to_print = mysql_num_rows($rslt); + if ($CBM_to_print > 0) + { + $rowx=mysql_fetch_row($rslt); + $callback_id = $rowx[0]; + } + else + { + $defaultappointment = date("Y-m-d H:i:s", mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y"))); + + $stmt="INSERT INTO vicidial_callbacks SET lead_id='" . mysql_real_escape_string($lead_id) . "',recipient='ANYONE',status='ACTIVE',user='$PHP_AUTH_USER',user_group='ADMIN',list_id='" . mysql_real_escape_string($list_id) . "',callback_time='$defaultappointment 12:00:00',entry_time='$NOW_TIME',comments='',campaign_id='" . mysql_real_escape_string($campaign_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
Scheduled Callback added: $lead_id - $phone_number
\n"; + } + } + + //Duped CBHOLD version for vicidial status type 'Scheduled Callback' + //This entry creates the callback + if ( ($dispo != $status) and ($scheduled_callback == 'Y') ) + { + if($DB) { + echo __LINE__."\n"; + } + ### find any vicidial_callback records for this lead + $stmt="select callback_id from vicidial_callbacks where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE') order by callback_id desc LIMIT 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $CBM_to_print = mysql_num_rows($rslt); + if ($CBM_to_print > 0) + { + $rowx=mysql_fetch_row($rslt); + $callback_id = $rowx[0]; + } + else + { + $defaultappointment = date("Y-m-d H:i:s", mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y"))); + + $stmt="INSERT INTO vicidial_callbacks SET lead_id='" . mysql_real_escape_string($lead_id) . "',recipient='USERONLY',status='ACTIVE',user='$original_sales_rep',user_group='ADMIN',list_id='" . mysql_real_escape_string($list_id) . "',callback_time='$defaultappointment 12:00:00',entry_time='$NOW_TIME',comments='',campaign_id='" . mysql_real_escape_string($campaign_id) . "';"; + $debug1=$stmt; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
Scheduled Callback added: $lead_id - $phone_number
\n"; + } + } + + + if ( ($dispo != $status) and ($status == 'DNC') ) + { + if($DB) { + echo __LINE__."\n"; + } + ### add lead to the internal DNC list + $stmt="INSERT INTO vicidial_dnc (phone_number) values('" . mysql_real_escape_string($phone_number) . "');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
Lead added to DNC List: $lead_id - $phone_number
\n"; + } + ### update last record in vicidial_log table + if (($dispo != $status) and ($modify_logs > 0)) + { + if($DB) { + echo __LINE__."\n"; + } + $stmt="UPDATE vicidial_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by call_date desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + + ### update last record in vicidial_closer_log table + if (($dispo != $status) and ($modify_closer_logs > 0)) + { + if($DB) { + echo __LINE__."\n"; + } + $stmt="UPDATE vicidial_closer_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by call_date desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + + ### update last record in vicidial_agent_log table + if (($dispo != $status) and ($modify_agent_logs > 0)) + { + if($DB) { + echo __LINE__."\n"; + } + $stmt="UPDATE vicidial_agent_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by agent_log_id desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + + if ($add_closer_record > 0) + { + if($DB) echo __LINE__."\n"; + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('" . mysql_real_escape_string($lead_id) . "','" . mysql_real_escape_string($list_id) . "','" . mysql_real_escape_string($campaign_id) . "','" . mysql_real_escape_string($parked_time) . "','$NOW_TIME','$STARTtime','1','" . mysql_real_escape_string($status) . "','" . mysql_real_escape_string($phone_code) . "','" . mysql_real_escape_string($phone_number) . "','$PHP_AUTH_USER','" . mysql_real_escape_string($comments) . "','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + + + } else { + echo "\n"; + //Not a "Submit" result, viewing the record (possibly with URL options such as those below which modify callback status but not record data) + if ($CBchangeUSERtoANY == 'YES') { + if($DB) echo __LINE__."\n"; + ### set vicidial_callbacks record to an ANYONE callback for this lead + $stmt="UPDATE vicidial_callbacks set recipient='ANYONE' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + echo "
vicidial_callback record changed to ANYONE
\n"; + $qcchange='Y'; + } + if ($CBchangeUSERtoUSER == 'YES') { + if($DB) echo __LINE__."\n"; + ### set vicidial_callbacks record to a different USERONLY callback record for this lead + $stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + echo "
vicidial_callback record user changed to $CBuser
\n"; + $qcchange='Y'; + } + if ($CBchangeANYtoUSER == 'YES') { + if($DB) echo __LINE__."\n"; + ### set vicidial_callbacks record to an USERONLY callback for this lead + $stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "',recipient='USERONLY' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + echo "
vicidial_callback record changed to USERONLY, user: $CBuser
\n"; + $qcchange='Y'; + } + if ($CBchangeDATE == 'YES') { + if($DB) echo __LINE__."\n"; + ### change date/time of vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set callback_time='" . mysql_real_escape_string($appointment_date) . " " . mysql_real_escape_string($appointment_time) . "',comments='" . mysql_real_escape_string($comments) . "' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + echo "
vicidial_callback record changed to $appointment_date $appointment_time
\n"; + $qcchange='Y'; + } + //QUALITY CONTROL LOGGING BEGIN - VIEW ONLY + //If no changes have been made, record "view" of this record. + if ($qcchange != 'Y') { + if($DB) echo __LINE__."\n QCCHANGE != Y"; + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_qc_agent_log (qc_user,qc_user_group,qc_user_ip,lead_user,web_server_ip,view_datetime,view_epoch,lead_id,list_id,campaign_id,processed) + values('" . mysql_real_escape_string($PHP_AUTH_USER) . "','$LOGuser_group','{$_SERVER['REMOTE_ADDR']}','{$original_record['user']}','{$_SERVER['SERVER_ADDR']}','$NOW_TIME','$STARTtime','" . mysql_real_escape_string($lead_id) . "','" . mysql_real_escape_string($original_record['list_id']) . "','" . mysql_real_escape_string($campaign_id) . "','N')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + //QUALITY CONTROL LOGGING END + if($DB) echo __LINE__."\n"; + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + if($DB) echo __LINE__."\n"; + ##### grab vicidial_list_alt_phones records ##### + $stmt="select phone_code,phone_number,alt_phone_note,alt_phone_count,active from vicidial_list_alt_phones where lead_id='" . mysql_real_escape_string($lead_id) . "' order by alt_phone_count limit 500;"; + $rslt=mysql_query($stmt, $link); + $alts_to_print = mysql_num_rows($rslt); + + $c=0; + $alts_output = ''; + while ($alts_to_print > $c) + { + if($DB) { + echo __LINE__."\n"; + } + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $c)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $c++; + $alts_output .= "
"; + $alts_output .= ""; + $alts_output .= ""; + $alts_output .= "\n"; + $alts_output .= "\n"; + $alts_output .= "\n"; + } + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + ##### grab vicidial_log records ##### + $stmt="select uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,user_group,term_reason,alt_dial from vicidial_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by uniqueid desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + if($DB) echo __LINE__."
\n"; + $u=0; + $call_log = ''; + $log_campaign = ''; + while ($logs_to_print > $u) + { + if($DB) echo __LINE__."
\n"; + $row=mysql_fetch_row($rslt); + if (strlen($log_campaign)<1) {$log_campaign = $row[3];} + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + $call_log .= "
"; + $call_log .= ""; + $call_log .= ""; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + + $campaign_id = $row[3]; + } + + ##### grab vicidial_agent_log records ##### + $stmt="select agent_log_id,user,server_ip,event_time,lead_id,campaign_id,pause_epoch,pause_sec,wait_epoch,wait_sec,talk_epoch,talk_sec,dispo_epoch,dispo_sec,status,user_group,comments,sub_status from vicidial_agent_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by agent_log_id desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $Alogs_to_print = mysql_num_rows($rslt); + if($DB) echo __LINE__."
\n"; + $y=0; + $agent_log = ''; + $Alog_campaign = ''; + while ($Alogs_to_print > $y) + { + $row=mysql_fetch_row($rslt); + if (strlen($Alog_campaign)<1) {$Alog_campaign = $row[5];} + if (eregi("1$|3$|5$|7$|9$", $y)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $y++; + $agent_log .= "
"; + $agent_log .= ""; + $agent_log .= ""; + $agent_log .= "\n"; + $agent_log .= "\n"; + $agent_log .= "\n"; + $agent_log .= "\n"; + $agent_log .= "\n"; + $agent_log .= "\n"; + $agent_log .= "\n"; + $agent_log .= "\n"; + $agent_log .= "\n"; + + $campaign_id = $row[5]; + } + + ##### grab vicidial_qc_agent_log records ##### + //Differentiate between View and Mod + $stmt="select * from vicidial_qc_agent_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by qc_agent_log_id desc limit 100;"; + $rslt=mysql_query($stmt, $link); + $Alogs_to_print = mysql_num_rows($rslt); + if($DB) echo "$stmt
\n"; + $y=0; + $qc_agent_log = ''; + $Alog_campaign = ''; + while ($Alogs_to_print > $y) + { + $row=mysql_fetch_assoc($rslt); + if (strlen($Alog_campaign)<1) {$Alog_campaign = $row[5];} + if (eregi("1$|3$|5$|7$|9$", $y)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $y++; + if (strlen($row['save_epoch'])=='0'){ //VIEW ONLY record + $qc_agent_log .= "
"; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= "\n"; + } else { // CHANGE record + $detailtooltip=str_replace("\n", " ", $row['details']); // tool tip line break and both work in IE, but not firefox. + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= ""; + $qc_agent_log .= "\n"; + } + } + + ##### grab vicidial_closer_log records ##### + $stmt="select closecallid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,queue_seconds,user_group,xfercallid,term_reason,uniqueid,agent_only from vicidial_closer_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by closecallid desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $Clogs_to_print = mysql_num_rows($rslt); + + $y=0; + $closer_log = ''; + $Clog_campaign = ''; + while ($Clogs_to_print > $y) + { + $row=mysql_fetch_row($rslt); + if (strlen($Clog_campaign)<1) {$Clog_campaign = $row[3];} + if (eregi("1$|3$|5$|7$|9$", $y)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $y++; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + + $campaign_id = $row[3]; + } + + ##### grab vicidial_list data for lead ##### + $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 0) + {$lead_id = $row[0];} + $dispo = $row[3]; + $tsr = $row[4]; + $vendor_id = $row[5]; + $list_id = $row[7]; + $gmt_offset_now = $row[8]; + $phone_code = $row[10]; + $phone_number = $row[11]; + $title = $row[12]; + $first_name = $row[13]; + $middle_initial = $row[14]; + $last_name = $row[15]; + $address1 = $row[16]; + $address2 = $row[17]; + $address3 = $row[18]; + $city = $row[19]; + $state = $row[20]; + $province = $row[21]; + $postal_code = $row[22]; + $country_code = $row[23]; + $gender = $row[24]; + $date_of_birth = $row[25]; + $alt_phone = $row[26]; + $email = $row[27]; + $security = $row[28]; + $comments = $row[29]; + $called_count = $row[30]; + $last_local_call_time = $row[31]; + $rank = $row[32]; + $owner = $row[33]; + $entry_list_id = $row[34]; + + if($DB) { + echo __LINE__."\n"; + } + echo "
Call information: $first_name $last_name - $phone_number

\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 ""; - - echo "
\n"; - echo "VICIDIAL QC STATUS CODES WITHIN THIS SYSTEM:   $NWB#vicidial_qc_status_codes$NWE
\n"; - echo "\n"; - echo "\n"; - - ##### go through each QC status code - $stmt="SELECT count(*) from vicidial_qc_codes;"; - $rslt=mysql_query($stmt, $link); - $rowx=mysql_fetch_row($rslt); - if ($rowx[0] > 0) - { - $stmt="SELECT code,code_name from vicidial_qc_codes order by code;"; - $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 "\n"; - echo "\n"; - } - } - echo "
STATUS CODEDESCRIPTIONMODIFY/DELETE
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "$rowx[0]
        \n"; - echo "   \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 QC STATUS CODE
\n"; - echo "\n"; - echo "Status:   \n"; - echo "Description:
\n"; - echo "
\n"; - - echo "

\n"; - - } - else - { - echo "You do not have permission to view this page\n"; - exit; - } - } - - - - - +//This section moved to include file as part of QC ###################### # ADD=550 user search form @@ -32387,7 +32303,10 @@ if ($ADD==10000000000000) } - +###################### +# ADD=100000000000000 display all qc campaigns +###################### +require_once('qc/QC_admin_include01.php'); ###################### diff --git a/www/vicidial/admin_header.php b/www/vicidial/admin_header.php index ba22f78f..e316b7b5 100644 --- a/www/vicidial/admin_header.php +++ b/www/vicidial/admin_header.php @@ -37,6 +37,7 @@ # 111106-0939 - Changes for user group restrictions # 111116-0208 - Added ALT and ADDR3 in-group handle methods # 120402-2134 - Changed lead loader link to fourth gen +# 121116-1412 - Added QC functionality # @@ -50,6 +51,7 @@ if($short_header) ?>
  Users     Campaigns     Lists     Scripts     Filters  
$c$row[0] $row[1] $row[2] $row[3] $row[4]
$u$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1] $row[15]   $row[10]
$y$row[3] $row[5] $row[1] $row[7] $row[9] $row[11] $row[13]   $row[14]   $row[15]   $row[17]
$y{$row['view_datetime']}View Only - No changes{$row['qc_user']}{$row['lead_user']}{$row['campaign_id']}{$row['list_id']}  
$y{$row['view_datetime']}{$row['old_status']}{$row['new_status']}{$row['qc_user']}{$row['lead_user']}{$row['campaign_id']}{$row['list_id']}{$row['elapsed_seconds']} DETAILS
$y$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]   $row[14]   $row[17]
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $stmt="SELECT user_id, timestamp, list_id, campaign_id, comment from vicidial_comments where lead_id='$lead_id' order by timestamp"; + $rslt=mysql_query($stmt, $link); + $row_count = mysql_num_rows($rslt); + $o=0; + $comments=false; + while ($row_count > $o) + { + if (!$comments) { + echo "\n"; + $comments=true; + } + $rowx=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + + if ($comments) { + echo "\n"; + } + echo "\n"; + +// Section Modified for QC Functionality By PoundTeam +// echo "\n"; +// echo "\n"; +// echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
$label_vendor_lead_code: $vendor_id     Lead ID: $lead_id
Fronter: $tsr     List ID: $list_id     Called Count: $called_count
$label_title:   \n"; + echo "$label_first_name:
$label_middle_initial:   \n"; + echo " $label_last_name:
$label_address1 :
$label_address2 :
$label_address3 :
$label_city :
$label_state:   \n"; + echo " $label_postal_code:
$label_province :
Country :
$label_phone_number :
$label_phone_code :
$label_alt_phone :
$label_email :
$label_security_phrase :
Rank :
Owner :
$label_comments :
Comment History
$rowx[0] :
$rowx[1]
List ID: $rowx[2]; Campaign ID: $rowx[3]
$rowx[4]

QC Result: (with $list_campaign statuses)
Modify vicidial log
Modify agent log
Modify closer log
Disable QC log entry (this feature is not active yet)
\n"; + echo "


\n"; + + echo "
\n"; + echo "Callback Details:
\n"; + //Added scheduled_callback regular statuses option + if ( ($dispo == 'CALLBK') or ($dispo == 'CBHOLD') || $scheduled_callback=='Y' ) + { + if($DB) { + echo __LINE__."\n"; + } + ### find any vicidial_callback records for this lead + $stmt="select callback_id,lead_id,list_id,campaign_id,status,entry_time,callback_time,modify_date,user,recipient,comments,user_group from vicidial_callbacks where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE') order by callback_id desc LIMIT 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $CB_to_print = mysql_num_rows($rslt); + $rowx=mysql_fetch_row($rslt); + + if ($CB_to_print>0) + { + if ($rowx[9] == 'USERONLY') + { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "New Callback Owner UserID: \n"; + echo "

\n"; + } + else + { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "New Callback Owner UserID: \n"; + echo "

\n"; + } + + $appointment_datetimeARRAY = explode(" ",$rowx[6]); + $appointment_date = $appointment_datetimeARRAY[0]; + $appointment_timeARRAY = explode(":",$appointment_datetimeARRAY[1]); + $appointment_hour = $appointment_timeARRAY[0]; + $appointment_min = $appointment_timeARRAY[1]; + + + ?> + +
+
Change Scheduled Callback Date:
+ + + + + + + + + + + + + +
+ > + + + + +
CallBack Date/Time: + + +     + + : + + +
+ Comments: + + +
+ + + + +
+
+ + No Callback records found
\n"; + } + + } + else + { + if($DB) { + echo __LINE__."\n"; + } + //Modifed text to allow for other than CBHOLD via custom statuses with scheduled callback chosen + echo "
If you want to change this lead to a scheduled callback, first change the Disposition to CBHOLD or similar, then submit and you will be able to set the callback date and time.
\n"; + } + echo "
\n"; + + echo "

\n"; + + echo "
\n"; + + if ($c > 0) + { + if($DB) { + echo __LINE__."\n"; + } + echo "EXTENDED ALTERNATE PHONE NUMBERS FOR THIS LEAD:\n"; + echo "\n"; + echo "\n"; + + echo "$alts_output\n"; + + echo "
# ALT PHONE ALT NOTE ALT COUNT ACTIVE
\n"; + echo "

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

"; + } + } + } + + + echo "CALLS TO THIS LEAD:\n"; + echo "\n"; + echo "\n"; + + echo "$call_log\n"; + + echo "
# DATE/TIME LENGTH STATUS TSR CAMPAIGN LIST LEAD HANGUP REASON PHONE
\n"; + echo "

\n"; + + echo "CLOSER RECORDS FOR THIS LEAD:\n"; + echo "\n"; + echo "\n"; + + echo "$closer_log\n"; + + echo "
# DATE/TIME LENGTH STATUS TSR CAMPAIGN LIST LEAD WAIT HANGUP REASON
\n"; + echo "

\n"; + + + echo "AGENT LOG RECORDS FOR THIS LEAD:\n"; + echo "\n"; + echo "\n"; + + echo "$agent_log\n"; + echo "
# DATE/TIME CAMPAIGN TSR PAUSE WAIT TALK DISPO STATUS GROUP SUB
\n"; + echo "

\n"; + echo "QUALITY CONTROL LOG RECORDS FOR THIS LEAD:\n"; + echo "\n"; + echo "\n"; + echo "$qc_agent_log\n"; + echo "
# DATE/TIME OLD STATUSNEW STATUSQC USERAGENTCAMPAIGNLISTELAPSED 
\n"; + echo "

\n"; + + echo "RECORDINGS FOR THIS LEAD:\n"; + echo "\n"; + echo "\n"; + + $stmt="select recording_id,channel,server_ip,extension,start_time,start_epoch,end_time,end_epoch,length_in_sec,length_in_min,filename,location,lead_id,user,vicidial_id from recording_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by recording_id desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + if ($DB) {echo "$logs_to_print|$stmt|\n";} + + $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"';} + + $location = $row[11]; + + if (strlen($location)>2) + { + $URLserver_ip = $location; + $URLserver_ip = eregi_replace('http://','',$URLserver_ip); + $URLserver_ip = eregi_replace('https://','',$URLserver_ip); + $URLserver_ip = eregi_replace("\/.*",'',$URLserver_ip); + $stmt="select count(*) from servers where server_ip='$URLserver_ip';"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + + if ($rowx[0] > 0) + { + $stmt="select recording_web_link,alt_server_ip from servers where server_ip='$URLserver_ip';"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + + if (eregi("ALT_IP",$rowx[0])) + { + $location = eregi_replace($URLserver_ip, $rowx[1], $location); + } + } + } + + if (strlen($location)>30) + {$locat = substr($location,0,27); $locat = "$locat...";} + else + {$locat = $location;} + if ( (eregi("ftp",$location)) or (eregi("http",$location)) ) + {$location = "$locat";} + else + {$location = $locat;} + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + + } + + + echo "
# LEADDATE/TIME SECONDS   RECIDFILENAMELOCATIONTSR
$u $row[12] $row[4] $row[8] $row[0]   $row[10] $location $row[13]


\n"; + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 9 and modify_leads='1';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $admin_display=$row[0]; + if ($admin_display > 0) + { + echo "Click here to see Lead Modify changes to this lead\n"; + } + + echo "\n"; + } + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + +original_record:
"; + print_r($original_record); + echo "
new_record:
"; + print_r($new_record); + echo "scheduled_callback:
"; + print_r($scheduled_callback); + echo "debug1:
"; + print_r($debug1); + echo "Post:
"; + print_r($_POST); + echo "qcchangelist:
"; + print_r($qcchangelist); + echo "
"; +} +exit; + + +?>