diff --git a/app/modules_app/batches/status.php b/app/modules_app/batches/status.php index f9a1230..b777c52 100644 --- a/app/modules_app/batches/status.php +++ b/app/modules_app/batches/status.php @@ -27,14 +27,14 @@ $db = Database::getInstance(); // 1. Get batch info $stmt = $db->prepare(" - SELECT id, status, total_images, processed_images, failed_images, created_at, completed_at + SELECT id, tenant_id, status, total_images, processed_images, failed_images, created_at, completed_at FROM invoice_batches - WHERE id = ? AND tenant_id = ? + WHERE id = ? "); -$stmt->execute([$batchId, $tenantId]); +$stmt->execute([$batchId]); $batch = $stmt->fetch(); -if (!$batch) { +if (!$batch || ($decoded['role'] !== 'super_admin' && $batch['tenant_id'] !== $tenantId)) { json_error('الدفعة غير موجودة', 404); }