Files
Siro/backend/serviceapp/update_complaint.php
T

34 lines
997 B
PHP
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
require_once __DIR__ . '/../connect.php';
// ‏كان هذا الملف بلا أي فحص دور. الحماية الآن من البوّابة المسارية في
// ‏connect.php (service/admin/super_admin لكل ما تحت serviceapp/).
$id = filterRequest("id");
$status = filterRequest("statusComplaint");
$resolution = filterRequest("resolution");
if ($id && $status) {
$sql = "UPDATE `complaint` SET `statusComplaint` = :status, `resolution` = :resolution";
if ($status == 'Resolved') {
$sql .= ", `date_resolved` = CURRENT_TIMESTAMP";
}
$sql .= " WHERE `id` = :id";
$stmt = $con->prepare($sql);
$stmt->bindParam(':status', $status);
$stmt->bindParam(':resolution', $resolution);
$stmt->bindParam(':id', $id);
if ($stmt->execute()) {
jsonSuccess(null, "Complaint updated successfully");
} else {
jsonError("Failed to update complaint");
}
} else {
jsonError("Missing required fields");
}
?>