diff --git a/functions.php b/functions.php index 12c7190..350ae3b 100755 --- a/functions.php +++ b/functions.php @@ -462,6 +462,9 @@ function sendFCM_Internal( function logAudit($con, $adminId, $action, $tableName = null, $recordId = null, $details = null) { try { + if (empty($adminId)) { + $adminId = 'unknown_admin'; + } $stmt = $con->prepare(" INSERT INTO `admin_audit_log` (`admin_id`, `action`, `table_name`, `record_id`, `details`) VALUES (:admin_id, :action, :table_name, :record_id, :details) diff --git a/ride/kazan/update.php b/ride/kazan/update.php index 6994628..bb31470 100644 --- a/ride/kazan/update.php +++ b/ride/kazan/update.php @@ -30,12 +30,13 @@ $params[":id"] = $id; $stmt = $con->prepare($sql); $stmt->execute($params); +// تسجيل العملية في السجل دائماً (حتى لو لم تتغير القيمة) لضمان الشفافية +logAudit($con, $user_id, "تحديث عمولة/أسعار النظام (Kazan)", "kazan", $id, $params); + if ($stmt->rowCount() > 0) { - // تسجيل العملية في السجل - logAudit($con, $user_id, "تحديث عمولة/أسعار النظام (Kazan)", "kazan", $id, $params); jsonSuccess(null, "Kazan data updated successfully"); } else { - // تسجيل محاولة التحديث حتى لو لم تتغير القيم (اختياري) + // If no rows were changed but execute was successful, it might be because the data is the same jsonSuccess(null, "Kazan data remains unchanged or updated"); } ?> \ No newline at end of file