Auto-commit local changes before build (2026-01-15 14:24:54)

This commit is contained in:
Ivo Oskamp 2026-01-15 14:24:54 +01:00
parent 186807b098
commit 49f6d41715
3 changed files with 24 additions and 2 deletions

View File

@ -1 +1 @@
v20260115-10-autotask-customers-settings-helper-fix v20260115-11-autotask-companyname-unwrap

View File

@ -113,7 +113,25 @@ def api_autotask_companies_search():
def _normalize_company_name(company: dict) -> str: def _normalize_company_name(company: dict) -> str:
return str(company.get("companyName") or company.get("CompanyName") or company.get("name") or "").strip() # Autotask REST payload shapes vary between tenants/endpoints.
# - Some single-entity GETs return {"item": {...}}
# - Some may return {"items": [{...}]}
if isinstance(company, dict):
item = company.get("item")
if isinstance(item, dict):
company = item
else:
items = company.get("items")
if isinstance(items, list) and items and isinstance(items[0], dict):
company = items[0]
return str(
(company or {}).get("companyName")
or (company or {}).get("CompanyName")
or (company or {}).get("name")
or (company or {}).get("Name")
or ""
).strip()
@main_bp.get("/api/customers/<int:customer_id>/autotask-mapping") @main_bp.get("/api/customers/<int:customer_id>/autotask-mapping")

View File

@ -88,7 +88,11 @@ Changes:
- Added a local SystemSettings get-or-create helper in customers routes to prevent runtime NameError in mixed/partial deployments. - Added a local SystemSettings get-or-create helper in customers routes to prevent runtime NameError in mixed/partial deployments.
- Added explicit imports for SystemSettings, db, and datetime to keep the Customers page stable across versions. - Added explicit imports for SystemSettings, db, and datetime to keep the Customers page stable across versions.
## v20260115-11-autotask-companyname-unwrap
- Fixed Autotask company name being shown as "Unknown" by correctly unwrapping nested Autotask API responses.
- Improved company lookup handling to support different response shapes (single item and collection wrappers).
- Ensured the cached Autotask company name is stored and displayed consistently after mapping and refresh.
*** ***