🐛 Fix deleting subs (hopefully)
Signed-off-by: Luke Tainton <luke@tainton.uk>
This commit is contained in:
@@ -9,16 +9,13 @@
|
|||||||
// Remove subscriber(s)
|
// Remove subscriber(s)
|
||||||
if ($is_authorised == true) {
|
if ($is_authorised == true) {
|
||||||
if($_SERVER['REQUEST_METHOD'] == 'POST') {
|
if($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
foreach ($_POST['addSubSelector[]'] as $sub) {
|
try {
|
||||||
try {
|
$stmt = "DELETE FROM ticket_subscribers WHERE WHERE sub_id IN (:sublist)";
|
||||||
$stmt = "DELETE FROM ticket_subscribers WHERE ticket_uuid=:tktuuid AND user_uuid=:usruuid";
|
$sql = $db->prepare($stmt);
|
||||||
$sql = $db->prepare($stmt);
|
$sql->bindParam(':sublist', $_POST['delSubSelector']);
|
||||||
$sql->bindParam(':tktuuid', $request['uuid']);
|
$sql->execute();
|
||||||
$sql->bindParam(':usruuid', $sub);
|
} catch (PDOException $e) {
|
||||||
$sql->execute();
|
$alert = array("danger", "Failed to remove subscriber(s): " . $e->getMessage());
|
||||||
} catch (PDOException $e) {
|
|
||||||
$alert = array("danger", "Failed to remove subscriber(s): " . $e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$newURL = "/editsub?rid=" . $request['uuid'];
|
$newURL = "/editsub?rid=" . $request['uuid'];
|
||||||
|
|||||||
@@ -7,6 +7,18 @@
|
|||||||
$is_authorised = isAuthorised($_SESSION['uuid'], $authorised_users, $request);
|
$is_authorised = isAuthorised($_SESSION['uuid'], $authorised_users, $request);
|
||||||
|
|
||||||
$all_users = get_all_users($db);
|
$all_users = get_all_users($db);
|
||||||
|
|
||||||
|
function get_req_subs($uuid) {
|
||||||
|
$stmt = "SELECT * FROM ticket_subscribers WHERE ticket_uuid=:uuid";
|
||||||
|
$sql = $db->prepare($stmt);
|
||||||
|
$sql->bindParam(':uuid', $uuid);
|
||||||
|
$sql->execute();
|
||||||
|
$sql->setFetchMode(PDO::FETCH_ASSOC);
|
||||||
|
$result = $sql->fetchAll();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
$subs = get_req_subs($request['uuid'])
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
@@ -103,10 +115,10 @@
|
|||||||
<form method="post" action="/actions/delsub">
|
<form method="post" action="/actions/delsub">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="hidden" id="rid" name="rid" value="<?php echo($request['uuid']); ?>">
|
<input type="hidden" id="rid" name="rid" value="<?php echo($request['uuid']); ?>">
|
||||||
<label for="delSubSelector[]">Remove subscribers:</label>
|
<label for="delSubSelector">Remove subscribers:</label>
|
||||||
<select multiple class="form-control" id="delSubSelector[]" name="delSubSelector[]">
|
<select multiple class="form-control" id="delSubSelector" name="delSubSelector">
|
||||||
<?php foreach($authorised_users as $usr) {
|
<?php foreach($subs as $sub) {
|
||||||
echo("<option value='" . $usr['uuid'] . "'>" . get_user_name($db, $usr) . "</option>");
|
echo("<option value='" . $sub['sub_id'] . "'>" . get_user_name($db, $sub['user_uuid']) . "</option>");
|
||||||
} ?>
|
} ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user