$page[] = ' <span class="type_text" id="type_text_' . $call['id'] . '">For ' . $call['type'] . ' Team</span>'; $page[] = ' </div>'; // Add the repair number if it exists. if ($call['repair']) { $page[] = ' <div class="call_info" id="call_repair_' . $call['id'] . '">'; $page[] = ' <span class="repair_text" id="repair_text_' . $call['id'] . '"><strong>Repair:</strong> ' . $call['repair'] . '</span>'; $page[] = ' </div>'; } // Add the primary number. $page[] = ' <div class="call_info" id="call_primary_' . $call['id'] . '">'; $page[] = ' <span class="primary_text" id="primary_text_' . $call['id'] . '"><strong>Phone #1:</strong> ' . phone_text($call['primary']) . '</span>'; $page[] = ' </div>'; // Add the secondary number if it exists. if ($call['secondary']) { $page[] = ' <div class="call_info" id="call_secondary_' . $call['id'] . '">'; $page[] = ' <span class="secondary_text" id="secondary_text_' . $call['id'] . '"><strong>Phone #2:</strong> ' . phone_text($call['secondary']) . '</span>'; $page[] = ' </div>'; } // Employee who closed the call. $employee = mysql_real_escape_string($_COOKIE['wywo_user']); $password = $_COOKIE['wywo_pass']; // Get employee info for ability to close. $user = get_ldap($employee, $password); // Add the close link if a WYWO admin and the call is old. if (strpos($user[0]['apple-user-printattribute'][0], 'ALL') != FALSE && $call['status'] == 'old') { $page[] = ' <div class="call_close" id="call_close_' . $call['id'] . '">'; $page[] = ' <a class="helped" href="./?area=close&id=' . $call['id'] . '" id="link_close_' . $call['id'] . '">Mark as Helped</a>'; $page[] = ' </div>'; } // Finish the left side. $page[] = ' </div>';
// The call ID. $call = mysql_fetch_assoc(mysql_query("SELECT * FROM `calls` WHERE `id`='" . $_GET['id'] . "'")); // Employee who closed the call. $employee = mysql_real_escape_string($_COOKIE['wywo_user']); $password = $_COOKIE['wywo_pass']; // Get employee info to see if the person is allowed to remove calls. $user = get_ldap($employee, $password); // Don't let regular employees remove calls. This is a backup in case they traverse the URL. if (strpos($user[0]['apple-user-printattribute'][0], 'ALL') == FALSE) { die(header('Location:./')); } // Starts the 'info' block with the primary number. $info = mysql_real_escape_string(phone_text($call['primary'])); // Adds the secondary number if it's there. if ($call['secondary']) { $info .= ' / ' . mysql_real_escape_string(phone_text($call['secondary'])); } // Adds the repair number if it's there. if ($call['repair']) { $info .= ' / ' . mysql_real_escape_string($call['repair']); } // Pulls the notes, loops through them, and puts them in a block. $notes_pull = mysql_query("SELECT * FROM `notes` WHERE `call`='" . $call['id'] . "'"); while ($note = mysql_fetch_assoc($notes_pull)) { $notes .= mysql_real_escape_string(date('m/d/Y', $note['timestamp'])) . ' at ' . mysql_real_escape_string(date('g:ia', $note['timestamp'])) . ' by ' . mysql_real_escape_string($note['employee']) . ': ' . mysql_real_escape_string(str_replace("\n", '', $note['content'])) . "\n"; } // Insert the closed call into the archive, delete it, and delete all notes associated with it. mysql_query("INSERT INTO `archive` (`opened`, `closed`, `employee`, `type`, `customer`, `info`, `notes`) VALUES ('" . $call['timestamp'] . "', '" . time() . "', '" . $employee . "', '" . mysql_real_escape_string($call['type']) . "', '" . mysql_real_escape_string($call['customer']) . "', '" . $info . "', '" . $notes . "')"); mysql_query("DELETE FROM `calls` WHERE `id`='" . $call['id'] . "'"); mysql_query("DELETE FROM `notes` WHERE `call`='" . $call['id'] . "'"); }