|
@@ -21,7 +21,29 @@ if (empty($_GET["id"])) {
|
|
|
}
|
|
|
$tickets_id = filter_input(INPUT_GET, "id", FILTER_SANITIZE_STRING);
|
|
|
|
|
|
-if (isset($_POST["do_comment_tickets"])) {
|
|
|
+$res = $dbpdo->find_and('tickets', ["id" => $tickets_id]);
|
|
|
+if ($res) {
|
|
|
+ $data = $res;
|
|
|
+} else {
|
|
|
+ setMsg("msg_notify", "The Tickets Not Found.", "warning");
|
|
|
+ redirect("admin", "tickets");
|
|
|
+}
|
|
|
+
|
|
|
+if (isset($_POST["do_close_tickets"])) {
|
|
|
+ if ($dbpdo->update('tickets', ["status" => 0, "lastupdated" => time()], "`id`={$tickets_id}")) {
|
|
|
+ setMsg("msg_notify", "The Tickets Closed Successfully.");
|
|
|
+ } else {
|
|
|
+ setMsg("msg_notify", "The Tickets Close Failed.", "warning");
|
|
|
+ }
|
|
|
+ redirect("admin", "tickets_details", ["id" => $tickets_id]);
|
|
|
+} elseif (isset($_POST["do_open_tickets"])) {
|
|
|
+ if ($dbpdo->update('tickets', ["status" => 1, "lastupdated" => time()], "`id`={$tickets_id}")) {
|
|
|
+ setMsg("msg_notify", "The Tickets Opened Successfully.");
|
|
|
+ } else {
|
|
|
+ setMsg("msg_notify", "The Tickets Open Failed.", "warning");
|
|
|
+ }
|
|
|
+ redirect("admin", "tickets_details", ["id" => $tickets_id]);
|
|
|
+} elseif (isset($_POST["do_comment_tickets"])) {
|
|
|
$comment = filter_input(INPUT_POST, "comment", FILTER_SANITIZE_SPECIAL_CHARS);
|
|
|
$errors = array();
|
|
|
|
|
@@ -35,13 +57,13 @@ if (isset($_POST["do_comment_tickets"])) {
|
|
|
if ($dbpdo->find_and('tickets', ["id" => $tickets_id, "user_id" => $user->id])) {
|
|
|
if ($dbpdo->add("tickets_comment", $data)) {
|
|
|
$dbpdo->update("tickets", ["lastupdated" => $data["date"]]);
|
|
|
- setMsg("msg_notify", "Add Comment successfully.", "success");
|
|
|
+ setMsg("msg_notify", "Add Comment Successfully.", "success");
|
|
|
} else {
|
|
|
- setMsg("msg_notify", "Add Comment failed.", "warning");
|
|
|
+ setMsg("msg_notify", "Add Comment Failed.", "warning");
|
|
|
}
|
|
|
redirect("admin", "tickets_details", ["id" => $res]);
|
|
|
} else {
|
|
|
- setMsg("msg_notify", "The Tickets Not found.", "warning");
|
|
|
+ setMsg("msg_notify", "The Tickets Not Found.", "warning");
|
|
|
redirect("admin", "tickets");
|
|
|
}
|
|
|
} else {
|
|
@@ -49,12 +71,4 @@ if (isset($_POST["do_comment_tickets"])) {
|
|
|
setMsg("errors", $errors);
|
|
|
redirect("admin", "tickets_details", ["id" => $res]);
|
|
|
}
|
|
|
-} else {
|
|
|
- $res = $dbpdo->find_and('tickets', ["id" => $tickets_id]);
|
|
|
- if ($res) {
|
|
|
- $data = $res;
|
|
|
- } else {
|
|
|
- setMsg("msg_notify", "The Tickets Not found.", "warning");
|
|
|
- redirect("admin", "tickets");
|
|
|
- }
|
|
|
}
|