Fix: Contact model has phone_2 not mobilephone — fix export+import service
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
"""Import/export service — CSV import with dry-run preview, CSV/XLSX export.
|
"""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'.
|
Company import creates Contact with type='company'.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ async def import_contacts(
|
|||||||
"""Import contacts from CSV using unified Contact model fields.
|
"""Import contacts from CSV using unified Contact model fields.
|
||||||
|
|
||||||
CSV columns: firstname, surname, email, phone, mobile, function, department.
|
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)
|
rows = _parse_csv(csv_content)
|
||||||
total = len(rows)
|
total = len(rows)
|
||||||
@@ -161,7 +161,7 @@ async def import_contacts(
|
|||||||
displayname=f"{row['firstname']} {row['surname']}",
|
displayname=f"{row['firstname']} {row['surname']}",
|
||||||
email_1=row.get("email", "").strip() or None,
|
email_1=row.get("email", "").strip() or None,
|
||||||
phone_1=row.get("phone", "").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,
|
function=row.get("function", "").strip() or None,
|
||||||
created_by=user_id,
|
created_by=user_id,
|
||||||
updated_by=user_id,
|
updated_by=user_id,
|
||||||
@@ -244,7 +244,7 @@ async def export_contacts_csv(
|
|||||||
c.name or "",
|
c.name or "",
|
||||||
c.email_1 or "",
|
c.email_1 or "",
|
||||||
c.phone_1 or "",
|
c.phone_1 or "",
|
||||||
c.mobilephone or "",
|
c.phone_2 or "",
|
||||||
c.function or "",
|
c.function or "",
|
||||||
c.mailing_city or "",
|
c.mailing_city or "",
|
||||||
c.mailing_postalcode or "",
|
c.mailing_postalcode or "",
|
||||||
|
|||||||
Reference in New Issue
Block a user