Fix: Remove WHERE clauses and cf_854 field from vTiger queries (API doesn't support empty string comparison)
This commit is contained in:
parent
8bc633d59c
commit
3f66bd07e6
@ -37,7 +37,7 @@ async def sync_from_vtiger() -> Dict[str, Any]:
|
|||||||
vtiger = get_vtiger_service()
|
vtiger = get_vtiger_service()
|
||||||
|
|
||||||
# Query vTiger for all accounts with CVR or name
|
# Query vTiger for all accounts with CVR or name
|
||||||
query = "SELECT id, accountname, email1, siccode, cf_accounts_cvr, cf_854, website1, bill_city, bill_code, bill_country FROM Accounts WHERE accountname != '' LIMIT 1000;"
|
query = "SELECT id, accountname, email1, siccode, cf_accounts_cvr, website, bill_city, bill_code, bill_country FROM Accounts LIMIT 1000;"
|
||||||
|
|
||||||
accounts = await vtiger.query(query)
|
accounts = await vtiger.query(query)
|
||||||
logger.info(f"📥 Fetched {len(accounts)} accounts from vTiger")
|
logger.info(f"📥 Fetched {len(accounts)} accounts from vTiger")
|
||||||
@ -50,7 +50,7 @@ async def sync_from_vtiger() -> Dict[str, Any]:
|
|||||||
vtiger_id = account.get('id')
|
vtiger_id = account.get('id')
|
||||||
name = account.get('accountname', '').strip()
|
name = account.get('accountname', '').strip()
|
||||||
cvr = account.get('cf_accounts_cvr') or account.get('siccode')
|
cvr = account.get('cf_accounts_cvr') or account.get('siccode')
|
||||||
economic_customer_number = account.get('cf_854') # Custom field for e-conomic number
|
economic_customer_number = None # Will be set by e-conomic sync
|
||||||
|
|
||||||
if not name:
|
if not name:
|
||||||
skipped_count += 1
|
skipped_count += 1
|
||||||
@ -169,7 +169,7 @@ async def sync_vtiger_contacts() -> Dict[str, Any]:
|
|||||||
vtiger = get_vtiger_service()
|
vtiger = get_vtiger_service()
|
||||||
|
|
||||||
# Query vTiger for contacts
|
# Query vTiger for contacts
|
||||||
query = "SELECT id, firstname, lastname, email, phone, mobile, title, department, account_id FROM Contacts WHERE firstname != '' OR lastname != '' LIMIT 1000;"
|
query = "SELECT id, firstname, lastname, email, phone, mobile, title, department, account_id FROM Contacts LIMIT 1000;"
|
||||||
|
|
||||||
contacts = await vtiger.query(query)
|
contacts = await vtiger.query(query)
|
||||||
logger.info(f"📥 Fetched {len(contacts)} contacts from vTiger")
|
logger.info(f"📥 Fetched {len(contacts)} contacts from vTiger")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user