Fix: Rettet indentation fejl i kontakt linking kode
This commit is contained in:
parent
0b8a4ff5d0
commit
0fb404dff5
@ -285,12 +285,18 @@ async def sync_vtiger_contacts() -> Dict[str, Any]:
|
|||||||
# Link contact to customer if account_id exists
|
# Link contact to customer if account_id exists
|
||||||
account_id = contact.get('account_id')
|
account_id = contact.get('account_id')
|
||||||
|
|
||||||
# Debug: Log first 20 contacts with account_id info
|
# ALWAYS log first 20 for debugging
|
||||||
if debug_counter < 20:
|
if debug_counter < 20:
|
||||||
logger.info(f"🔍 Debug kontakt #{debug_counter+1}: {first_name} {last_name}, account_id='{account_id}', contact_id={contact_id if 'contact_id' in locals() else 'N/A'}")
|
logger.warning(f"🔍 DEBUG #{debug_counter+1}: name={first_name} {last_name}, account_id='{account_id}', has_contact_id={contact_id is not None if 'contact_id' in locals() else False}")
|
||||||
debug_counter += 1
|
debug_counter += 1
|
||||||
|
|
||||||
if account_id and contact_id:
|
if not account_id:
|
||||||
|
continue # Skip if no account_id
|
||||||
|
|
||||||
|
if not contact_id:
|
||||||
|
logger.warning(f"⚠️ Mangler contact_id for {first_name} {last_name}")
|
||||||
|
continue
|
||||||
|
|
||||||
# Find customer by vTiger account ID
|
# Find customer by vTiger account ID
|
||||||
customer = execute_query(
|
customer = execute_query(
|
||||||
"SELECT id, name FROM customers WHERE vtiger_id = %s",
|
"SELECT id, name FROM customers WHERE vtiger_id = %s",
|
||||||
@ -315,10 +321,6 @@ async def sync_vtiger_contacts() -> Dict[str, Any]:
|
|||||||
logger.info(f"🔗 Linket kontakt {first_name} {last_name} til firma: {customer_name}")
|
logger.info(f"🔗 Linket kontakt {first_name} {last_name} til firma: {customer_name}")
|
||||||
else:
|
else:
|
||||||
logger.info(f"⚠️ Kunde ikke fundet for account_id={account_id} (kontakt: {first_name} {last_name})")
|
logger.info(f"⚠️ Kunde ikke fundet for account_id={account_id} (kontakt: {first_name} {last_name})")
|
||||||
elif account_id:
|
|
||||||
logger.info(f"⚠️ Ingen contact_id for {first_name} {last_name} (account_id={account_id})")
|
|
||||||
else:
|
|
||||||
logger.debug(f"⏭️ Ingen account_id for kontakt {first_name} {last_name}")
|
|
||||||
|
|
||||||
logger.info(f"✅ vTiger kontakt sync fuldført: {created_count} oprettet, {updated_count} opdateret, {linked_count} linket, {skipped_count} sprunget over af {len(contacts)} totalt")
|
logger.info(f"✅ vTiger kontakt sync fuldført: {created_count} oprettet, {updated_count} opdateret, {linked_count} linket, {skipped_count} sprunget over af {len(contacts)} totalt")
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user