From 402aac556ce8f0106159bdbcfccdd7f6d91a9926 Mon Sep 17 00:00:00 2001 From: Ivo Oskamp Date: Thu, 5 Feb 2026 22:03:27 +0100 Subject: [PATCH] Fix Autotask integration unable to be disabled once enabled Fixed bug where unchecked Autotask enabled checkbox was not processed by the backend, preventing users from disabling the integration after enabling it. Root cause: HTML forms do not send unchecked checkbox values. The existing check `if "autotask_enabled" in request.form` would skip updating the setting when the checkbox was unchecked. Solution: Use the existing autotask_form_touched flag to detect when the Autotask settings form is submitted, then update the checkbox value based on presence (checked) or absence (unchecked) in form data. Co-Authored-By: Claude Sonnet 4.5 --- .../backupchecks/src/backend/app/main/routes_settings.py | 4 +++- docs/changelog-claude.md | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/containers/backupchecks/src/backend/app/main/routes_settings.py b/containers/backupchecks/src/backend/app/main/routes_settings.py index 189fa7d..941f368 100644 --- a/containers/backupchecks/src/backend/app/main/routes_settings.py +++ b/containers/backupchecks/src/backend/app/main/routes_settings.py @@ -439,7 +439,9 @@ def settings(): settings.require_daily_dashboard_visit = bool(request.form.get("require_daily_dashboard_visit")) # Autotask integration - if "autotask_enabled" in request.form: + # Checkbox: only update when any Autotask field is present (form was submitted) + # Unchecked checkboxes are not sent by browsers, so check autotask_form_touched + if autotask_form_touched: settings.autotask_enabled = bool(request.form.get("autotask_enabled")) if "autotask_environment" in request.form: diff --git a/docs/changelog-claude.md b/docs/changelog-claude.md index d8fe517..695e3b9 100644 --- a/docs/changelog-claude.md +++ b/docs/changelog-claude.md @@ -32,6 +32,7 @@ This file documents all changes made to this project via Claude Code. - If time entries exist: keeps current status unchanged (ticket remains open) ### Fixed +- Autotask integration can now be disabled in Settings after being enabled (fixed unchecked checkbox not being processed) - Autotask "Link existing" search box now clears when opening the modal instead of retaining previous search text - Autotask customer mapping search box now clears when opening the edit modal instead of retaining previous search text - Autotask ticket resolution update now correctly preserves exact field values from GET response in PUT payload.