false, 'ERROR' => 'missing_params', 'MESSAGE' => 'BusinessID is required']); } if ($taskID <= 0) { apiAbort(['OK' => false, 'ERROR' => 'missing_params', 'MESSAGE' => 'ScheduledTaskID is required']); } try { $existing = queryOne("SELECT ID FROM ScheduledTaskDefinitions WHERE ID = ? AND BusinessID = ?", [$taskID, $businessID]); if (!$existing) { apiAbort(['OK' => false, 'ERROR' => 'not_found', 'MESSAGE' => 'Scheduled task not found']); } queryTimed("DELETE FROM ScheduledTaskDefinitions WHERE ID = ?", [$taskID]); jsonResponse(['OK' => true, 'MESSAGE' => 'Scheduled task deleted']); } catch (Exception $e) { jsonResponse(['OK' => false, 'ERROR' => 'server_error', 'MESSAGE' => $e->getMessage()]); }