Commit Graph

109 Commits

Author SHA1 Message Date
1d9f3662a1 Fix automatic mail import unable to be disabled once enabled
Fixed bug where unchecked automatic mail import checkbox was not
processed by the backend, preventing users from disabling the
automatic import after enabling it.

Root cause: HTML forms do not send unchecked checkbox values. The
existing check `if "auto_import_enabled" in request.form` would skip
updating the setting when the checkbox was unchecked.

Solution: Added import_form_touched flag to detect when the import
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 <noreply@anthropic.com>
2026-02-05 22:15:38 +01:00
9388ec4c01 Improve Autotask customer mapping with auto-search
Added automatic search for similar company names when opening unmapped
customers in the edit modal. This speeds up the mapping process by
eliminating manual searches.

Changes:
- Clear search box when opening customer edit modal
- Auto-populate search with customer name for unmapped customers
- Automatically display matching Autotask companies as suggestions
- Refactor search logic into reusable performAutotaskSearch() function

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 21:39:02 +01:00
873b22f225 Clear search box when opening Autotask Link existing modal
Fixed issue where the search input retained previous search text when
reopening the Link existing modal. The search box now always starts
empty for a better user experience.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 21:26:14 +01:00
077e1fb176 Add cross-company ticket search for overarching issues
The "Link existing ticket" dialog now searches across all companies when
a ticket number is entered, enabling linking of overarching issues.

Changes:
- Added query_tickets_by_number() to Autotask client
- Route searches both customer's company and cross-company when ticket number detected
- Results are combined and deduplicated (customer tickets shown first)
- Enables linking multi-company infrastructure issues to any job

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 17:01:43 +01:00
cc76068206 Make Autotask resolve messages dynamic based on time entries
The resolve confirmation dialog and ticket notes now correctly indicate
whether the ticket will be closed or remain open based on time entry check.

Changes:
- Frontend: Updated confirmation message to explain conditional closure
- Backend: Check time entries before creating note
- Dynamic message in ticket note:
  * "ticket will be closed in Autotask" (no time entries)
  * "ticket remains open in Autotask due to existing time entries" (has time entries)
- Updated route docstring to reflect conditional status behaviour

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 16:46:43 +01:00
9b905fa24f Add conditional ticket status update based on time entries
Implements API contract section 9: ticket resolution workflow with
conditional status updates based on time entry existence.

- Added query_time_entries_by_ticket_id() for POST /TimeEntries/query
- update_ticket_resolution_safe() now checks time entries:
  * No time entries: sets status to 5 (Complete)
  * Has time entries: keeps current status (ticket remains open)

This ensures tickets are only auto-closed when appropriate per the
validated Autotask API workflow.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 16:35:28 +01:00
8a733a356b Fix Autotask resolution to preserve exact field values from GET response
The issueType, subIssueType, and source fields must be sent in the PUT
payload with their exact values from GET response, including null. This
fixes HTTP 500 error where Autotask rejected picklist value 0.

Changed _pick function to return (found, value) tuple to distinguish
between "field missing" and "field is null".

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 16:29:54 +01:00
a9a60e3315 Restore Autotask PSA integration
Restored from branch v20260203-13-autotask-resolution-item-wrapper with
the following functionality:

- Autotask REST API client with support for tickets, notes, companies,
  and reference data (queues, sources, priorities, statuses)
- Safe ticket updates preserving stabilizing fields per API contract
- Database models for Autotask settings, customer mapping, and ticket linkage
- Settings UI for Autotask configuration with connection test
- Run Checks integration for ticket creation
- Customers page with Autotask company mapping
- Ticket linking during mail import

Also preserved the require_daily_dashboard_visit setting from the
current branch.

Added docs/autotask_rest_api.md with validated API contract from Postman tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 14:43:44 +01:00
abf8b89d7c Add setting to enable/disable daily dashboard redirect
Added a new setting in Settings > General > Navigation that allows
administrators to control whether users are redirected to the dashboard
on their first page view each day.

Changes:
- Added require_daily_dashboard_visit column to SystemSettings model
- Added migration for the new column (default: FALSE)
- Modified before_request hook to check the setting before redirecting
- Added Navigation card with toggle in Settings General page
- Restored changelog-claude.md with performance and feature updates

Default is OFF - users can navigate directly to any page without
being forced to visit the dashboard first.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 22:03:11 +01:00