Creation of button and SQL
This commit is contained in:
27
app/public/actions/reopen.php
Normal file
27
app/public/actions/reopen.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
$PAGE_NAME = "Close request";
|
||||||
|
require_once __DIR__ . "/../../includes/prereqs.php";
|
||||||
|
|
||||||
|
$request = get_request($db, $_GET['rid']);
|
||||||
|
$authorised_users = get_subscribers($db, $request);
|
||||||
|
$is_authorised = isAuthorised($_SESSION['uuid'], $authorised_users, $request);
|
||||||
|
|
||||||
|
// Close request
|
||||||
|
if ($is_authorised == true) {
|
||||||
|
try {
|
||||||
|
$stmt = "UPDATE tickets SET status='Reopened' WHERE uuid=:uuid";
|
||||||
|
$sql = $db->prepare($stmt);
|
||||||
|
$sql->bindParam(':uuid', $_GET['rid']);
|
||||||
|
$sql->execute();
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$alert = array("danger", "Failed to reopen request: " . $e->getMessage());
|
||||||
|
}
|
||||||
|
$newURL = "/";
|
||||||
|
echo("<script>window.location = '$newURL'</script>");
|
||||||
|
} else {
|
||||||
|
$alert = array("danger", "You are not authorised to close this request.");
|
||||||
|
$newURL = "/view?rid=" . $request['uuid'];
|
||||||
|
echo("<script>window.location = '$newURL'</script>");
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -53,7 +53,9 @@
|
|||||||
<p>
|
<p>
|
||||||
<?php if ($_SESSION['uuid'] == $request['created_by']) { ?>
|
<?php if ($_SESSION['uuid'] == $request['created_by']) { ?>
|
||||||
<a href='/editsub?rid=<?php echo($request["uuid"]); ?>' class='btn btn-secondary my-2'>Manage subscribers</a>
|
<a href='/editsub?rid=<?php echo($request["uuid"]); ?>' class='btn btn-secondary my-2'>Manage subscribers</a>
|
||||||
<?php } ?>
|
<?php if ($request['status'] == 'Closed') { ?>
|
||||||
|
<a href='/editsub?rid=<?php echo($request["uuid"]); ?>' class='btn btn-success my-2'>Reopen request</a>
|
||||||
|
<?php }} ?>
|
||||||
<?php if ($request['status'] != 'Closed') { ?>
|
<?php if ($request['status'] != 'Closed') { ?>
|
||||||
<a href='/update?rid=<?php echo($request["uuid"]); ?>' class='btn btn-primary my-2'>Update the request</a>
|
<a href='/update?rid=<?php echo($request["uuid"]); ?>' class='btn btn-primary my-2'>Update the request</a>
|
||||||
<a href='/upload?rid=<?php echo($request["uuid"]); ?>' class='btn btn-primary my-2'>Add attachment(s)</a>
|
<a href='/upload?rid=<?php echo($request["uuid"]); ?>' class='btn btn-primary my-2'>Add attachment(s)</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user