function formEmail($postData) { echo "Subject: " . getEmailType($postData['type']) . "Executive Notification: "; echo $postData['subject']; echo "\nNotification Time: " . $postData['time']; echo "\nNotification Date: " . date('m/d/Y', strtotime($postData['date'])); echo "\nParent Ticket: INC" . $postData['parentTicket']; echo "\nPriority: " . $postData['priority']; echo "\nIncident Coordinator: " . nameByNetId($postData['ic']); echo "\nProblem Description: " . $postData['desc']; }
$updateResponse = $incidentClient->update(array('sys_id' => $sysId, 'short_description' => $_POST['subject'], 'u_work_log' => "(Internal Comment)" . html2text($ticketEntry))); if (isset($updateResponse->sys_id)) { echo "<h2> Ticket's work-log has been updated successfully. </h2>"; } else { echo "<h2> Updating the work-log for the ticket failed. Please attempt to do so manually. </h2>"; } } catch (Exception $E) { if ($env == 2) { $errorInfo = ''; } else { $errorInfo = "ERROR " . print_r($E, true); } echo "<h2> Unable to connect to service-now to insert your update to the work-log. Please attempt to do so manually. <br><br>{$errorInfo}</h2>"; } $emailBody = formEmail($_POST); $subject = getEmailType($type) . $_POST['subject']; if ($env == 2) { $recipient = ''; try { $notificationMemberQuery = $db->prepare("SELECT * FROM `notificationMember` WHERE `memberId` IN (SELECT `memberId` FROM `notificationGroupMember` WHERE `groupName` = 'Executive Notification')"); $notificationMemberQuery->execute(); } catch (PDOException $e) { exit("error in query"); } while ($execNoteRecipient = $notificationMemberQuery->fetch(PDO::FETCH_ASSOC)) { if ($recipient === '') { $recipient = $execNoteRecipient['email']; } else { $recipient .= ', ' . $execNoteRecipient['email']; } }