diff --git a/action.php b/action.php
index 7ba7014..749d039 100644
--- a/action.php
+++ b/action.php
@@ -1,4 +1,3 @@
-
@@ -227,17 +226,41 @@ function opDetail() {
echo "Outbound To:" . $row['out_to'] . "
";
echo "ETD:" . $row['etd'] . "
";
-
echo "Email Address: " . $row['email'] . "
";
echo "Phone: " . $row['phone'] . "
";
-
echo "Notes: " . $row['notes'] . "
";
echo "PPR created at: " . $row['submitted_dt'] . " by " . $row['created_by'] . "
";
+ // Fetch journal entries
+ $journalSql = "SELECT * FROM journal WHERE ppr_id = " . $_GET['id'];
+ $journalResult = $conn->query($journalSql);
+ $journalCount = $journalResult->num_rows;
+
+ // Add button to toggle journal entries
+ echo '';
+ echo '';
+ echo '
Journal Entries
';
+ echo '
';
+ echo '| Timestamp | User | Entry |
';
+
+ if ($journalCount > 0) {
+ while ($journalRow = $journalResult->fetch_assoc()) {
+ echo '';
+ echo '| ' . $journalRow['entry_dt'] . ' | ';
+ echo '' . $journalRow['user'] . ' | ';
+ echo '' . $journalRow['entry'] . ' | ';
+ echo '
';
+ }
+ } else {
+ echo '| No journal entries found. |
';
+ }
+
+ echo '
';
+ echo '
';
+ echo '';
} else {
echo "No details found for the given ID.";
-
}
$conn->close();
}
@@ -262,7 +285,44 @@ switch($_GET['op']) {
default:
}
-
?>
+
+
+
+
diff --git a/webhook.php b/webhook.php
index ce84a7d..fc81135 100644
--- a/webhook.php
+++ b/webhook.php
@@ -1,24 +1,19 @@
connect_error) {
- die("Connection failed: " . $conn->connect_error);
+// Check if the URL has a 'test' parameter set
+if (isset($_GET['test'])) {
+ $payload = json_decode(file_get_contents('testhook.json'), true);
+} else {
+ $payload = json_decode(file_get_contents('php://input'), true);
}
-// Webhook payload
-#$payload = json_decode(file_get_contents('php://input'), true);
-$payload = json_decode(file_get_contents('testhook.json'), true);
+// Log the received payload for debugging
+error_log("Received payload: " . print_r($payload, true));
// Mapping of JSON 'name' keys to database column names
$columnMapping = [
@@ -92,15 +87,15 @@ $stmt->bind_param($types, ...$values);
// Execute the statement
if ($stmt->execute()) {
- echo "New record created successfully";
+ error_log("New record created successfully");
$lastId = $stmt->insert_id;
if (!empty($email)) {
generatePprEmail($lastId, $email, $ac_reg);
} else {
- echo "Email is not set.";
+ error_log("Email is not set.");
}
} else {
- echo "Error: " . $stmt->error;
+ error_log("Error: " . $stmt->error);
}
// Close the connection