Fix: Contact model has phone_2 not mobilephone — fix export+import service

This commit is contained in:
Agent Zero
2026-07-26 02:42:07 +02:00
parent a3a5a10514
commit d468456fe1
+4 -4
View File
@@ -1,6 +1,6 @@
"""Import/export service — CSV import with dry-run preview, CSV/XLSX export.
Uses unified Contact model fields: firstname, surname, email_1, phone_1, mobilephone, function.
Uses unified Contact model fields: firstname, surname, email_1, phone_1, phone_2, function.
Company import creates Contact with type='company'.
"""
@@ -122,7 +122,7 @@ async def import_contacts(
"""Import contacts from CSV using unified Contact model fields.
CSV columns: firstname, surname, email, phone, mobile, function, department.
Maps to Contact fields: firstname, surname, email_1, phone_1, mobilephone, function.
Maps to Contact fields: firstname, surname, email_1, phone_1, phone_2, function.
"""
rows = _parse_csv(csv_content)
total = len(rows)
@@ -161,7 +161,7 @@ async def import_contacts(
displayname=f"{row['firstname']} {row['surname']}",
email_1=row.get("email", "").strip() or None,
phone_1=row.get("phone", "").strip() or None,
mobilephone=row.get("mobile", "").strip() or None,
phone_2=row.get("mobile", "").strip() or None,
function=row.get("function", "").strip() or None,
created_by=user_id,
updated_by=user_id,
@@ -244,7 +244,7 @@ async def export_contacts_csv(
c.name or "",
c.email_1 or "",
c.phone_1 or "",
c.mobilephone or "",
c.phone_2 or "",
c.function or "",
c.mailing_city or "",
c.mailing_postalcode or "",