$session_id = $_POST['session_id']; $p_t = $_POST['p_t']; $mileage = $_POST['mileage']; // Initialize variables $job_name = ''; $employee_name = ''; // Parse passthrough data (p_t) to an array $p_t_Array = IfByPhone_Util::processPassThrough($p_t); // Create variables from data needed in the passthrough array $event_id = $p_t_Array['event_id']; $job_name = $p_t_Array['company']; $employee_name = $p_t_Array['employee_name']; $job_id = $p_t_Array['job_pk_id']; // If user hung up the tasks will be "NA". Exit script and do not update the database if ($sweep == 'NA' || $trashcans == 'NA' || $handpick == 'NA') { Database::logMessage('Hangup without service tasks with passthrough (' . $p_t . ')'); exit; } // If user entered "No" (case sensitive) for all options, send them to the IVR error message: // (4. Sweep - All NO Answers Error) and reprompt. // Not all answers can be "No". if ($sweep == 'No' && $trashcans == 'No' && $handpick == 'No') { echo "<action>\n\t\t\t<app>survo</app>\n\t\t\t\t<parameters>\n\t\t\t\t\t<id>412191</id>\n\t\t\t\t\t<p_t>" . $p_t . "</p_t>\n\t\t\t\t</parameters>\n\t\t\t</action>"; // Stop the PHP script before it hits the database; exit; } // Query statement $query = "CALL proc_endSweepJob('{$event_id}', '{$timestamp}', '{$caller_id}', '{$session_id}',\n\t\t\t\t'{$message}', '{$mileage}', '{$sweep}', '{$trashcans}', '{$can_qty}', '{$handpick}', @confirmation)"; // Connect to the database $conn = Database::getDB(); try {
<?php require 'com/Database.php'; $employee_id = $_POST['id']; $passcode = $_POST['passcode']; // If the employee_id or passcode were skipped the IVR sends 'NA' and that will generate an error in the database call. // This is caused by a hangup without entering information. Check for this first and exit without logging an error. if ($employee_id == 'NA' || $passcode == 'NA') { Database::logMessage('Hangup without employee info'); exit; } try { $conn = Database::getDB(); $results = $conn->query("CALL verify_employee('{$employee_id}', '{$passcode}', @isValid, @employee_pkID,\n\t\t@remotePunch, @ivrAccess, @isActive, @employee_name)"); $results = $conn->query("SELECT @isValid, @employee_pkID, @ivrAccess, @isActive, @employee_name"); foreach ($results as $result) { if (!$result["@isValid"]) { // for invalid combination echo "<action>\n\t\t\t\t\t<app>survo</app>\n\t\t\t\t\t\t<parameters>\n\t\t\t\t\t\t\t<id>362191</id>\n\t\t\t\t\t\t</parameters>\n\t\t\t\t\t</action>"; } else { if (!$result["@ivrAccess"] || !$result["@isActive"]) { // for IVR access not authorized echo "<action>\n\t\t\t\t\t<app>survo</app>\n\t\t\t\t\t\t<parameters>\n\t\t\t\t\t\t\t<id>397881</id>\n\t\t\t\t\t\t</parameters>\n\t\t\t\t\t</action>"; } else { $employee_id = $result["@employee_pkID"]; $employee_name = $result["@employee_name"]; // for valid combination, check to see if there is an open job $open_event_check = $conn->query("CALL proc_checkForOpenEvent('{$employee_id}', @event_pk_id, @serviceCategory,\n\t\t\t@name, @survo, @job_pk_id)"); $open_event_check = $conn->query("SELECT @event_pk_id, @serviceCategory, @name, @survo, @job_pk_id"); // Create instance of Utility to clean data foreach ($open_event_check as $checks) {
<?php require 'com/Database.php'; //require ('com/IfByPhone_Util.php'); $job_id = $_POST['job_id']; $p_t = $_POST['p_t']; // If the job_id was skipped the IVR sends 'NA' and that will generate an error in the database call. // This is caused by a hangup without entering information. Check for this first and exit without logging an error. if ($job_id == 'NA') { Database::logMessage('Hangup without job number with passthrough (' . $p_t . ')'); exit; } try { $conn = Database::getDB(); $results = $conn->query("CALL verify_job('{$job_id}',@job_name,@job_pk_id,@isValid)"); $results = $conn->query("SELECT @job_name,@job_pk_id,@isValid"); foreach ($results as $result) { if (!$result["@isValid"]) { // for invalid combination // 1/29/13 UPDATE: must pass through data because employee information has already been verified echo "<action>\n\t\t\t\t\t<app>survo</app>\n\t\t\t\t\t\t<parameters>\n\t\t\t\t\t\t\t<id>362471</id>\n\t\t\t\t\t\t\t<p_t>" . $p_t . " </p_t>\n\t\t\t\t\t\t</parameters>\n\t\t\t\t\t</action>"; } else { // for valid combination $name_clean = IfByPhone_Util::removeInvalidChar($result["@job_name"]); $job_pk_id = $result["@job_pk_id"]; echo "<action>\n\t\t\t\t\t<app>survo</app>\n\t\t\t\t\t\t<parameters>\n\t\t\t\t\t\t\t<id>362481</id>\n\t\t\t\t\t\t\t<user_parameters>\n\t\t\t\t\t\t\t\t<job_name>" . $name_clean . "</job_name>\n\t\t\t\t\t\t\t</user_parameters>\n\t\t\t\t\t\t\t<p_t>" . $p_t . "||job_id|" . $job_id . "||company|" . $name_clean . "||job_pk_id|" . $job_pk_id . " </p_t>\n\t\t\t\t\t\t</parameters>\n\t\t\t\t\t</action>"; } } } catch (PDOException $e) { Database::logError('verify_job', $e); Database::sendToIvrError();
<?php require 'com/Database.php'; $servicecategory = $_POST['servicecategory']; // If the servicecategory was skipped the IVR sends 'NA' and that will generate an error in the database call. // This is caused by a hangup without entering information. Check for this first and exit without logging an error. if ($servicecategory == 'NA') { Database::logMessage('Hangup without servicecategory with passthrough (' . $p_t . ')'); exit; } $caller_id = $_POST['caller_id']; $timestamp = $_POST['timestamp']; $session_id = $_POST['session_id']; $employee_id = ''; $job_id = ''; $job_pk_id = ''; $job_name = ''; $employee_name = ''; $p_t = $_POST['p_t']; // passthrough data = employee_id|value||job_id|value $passthrough_array = IfByPhone_Util::processPassThrough($p_t); $employee_id = $passthrough_array['employee_id']; $job_id = $passthrough_array['job_id']; $job_pk_id = $passthrough_array['job_pk_id']; $job_name = $passthrough_array['company']; $employee_name = $passthrough_array['employee_name']; try { // create connection to DB $conn = Database::getDB(); $query = "CALL start_event('{$servicecategory}','{$caller_id}','{$timestamp}','{$session_id}','{$employee_id}','{$job_id}')"; $conn->query($query);