From a7ef3f5a54cf45eaa5db4b200604a650929194dc Mon Sep 17 00:00:00 2001 From: arf20 Date: Thu, 21 Mar 2024 16:22:33 +0100 Subject: Add close comment to tickets --- managetickets.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'managetickets.php') diff --git a/managetickets.php b/managetickets.php index 5f6ecf7..66c5b13 100644 --- a/managetickets.php +++ b/managetickets.php @@ -36,7 +36,7 @@ $result = mysqli_stmt_get_result($stmt); $orders = $result->fetch_all(MYSQLI_ASSOC); // Get tickets -$sql = "SELECT id, `order`, subject, body, date, status, asignee FROM tickets"; +$sql = "SELECT id, `order`, subject, body, date, status, closecomment, asignee FROM tickets"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); @@ -58,13 +58,14 @@ if (isset($_GET["del"])) { if ($_SERVER["REQUEST_METHOD"] == "POST") { // add entry if (isset($_POST["add"])) { - $sql = "INSERT INTO tickets (`order`, subject, body, status, asignee) VALUES (?, ?, ?, ?, ?)"; + $sql = "INSERT INTO tickets (`order`, subject, body, status, closecomment, asignee) VALUES (?, ?, ?, ?, ?, ?)"; $stmt = mysqli_prepare($link, $sql); - mysqli_stmt_bind_param($stmt, "sssss", $param_order, $param_subject, $param_body, $param_status, $param_asignee); + mysqli_stmt_bind_param($stmt, "ssssss", $param_order, $param_subject, $param_body, $param_status, $param_closecomment, $param_asignee); $param_order = $_POST["order"]; $param_subject = $_POST["subject"]; $param_body = $_POST["body"]; $param_status = $_POST["status"]; + $param_closecomment = $_POST["closecomment"]; $param_asignee = $_POST["asignee"]; if (!mysqli_stmt_execute($stmt) || (mysqli_stmt_affected_rows($stmt) != 1)) { @@ -74,10 +75,11 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { // edit entry if (isset($_POST["save"])) { - $sql = "UPDATE tickets SET status = ?, asignee = ? WHERE id = ?"; + $sql = "UPDATE tickets SET status = ?, closecomment = ?, asignee = ? WHERE id = ?"; $stmt = mysqli_prepare($link, $sql); - mysqli_stmt_bind_param($stmt, "sss", $param_status, $param_asignee, $param_id); + mysqli_stmt_bind_param($stmt, "ssss", $param_status, $param_closecomment, $param_asignee, $param_id); $param_status = $_POST["status"]; + $param_closecomment = $_POST["closecomment"]; $param_asignee = $_POST["asignee"]; $param_id = $_POST["id"]; @@ -157,8 +159,9 @@ function getuserbyid($id) { ."

\n" ."
".$ticket["body"]."

\n" ."

\n" + ."